sudo port upgrade all

Ryan Schmidt ryandesign at macports.org
Fri Nov 28 11:40:05 PST 2008


On Nov 28, 2008, at 04:05, Keith J. Schultz wrote:

> Am 28.11.2008 um 02:47 schrieb Ryan Schmidt:
>
>> Preventing this from happening in the future by keeping people  
>> from using the "all" pseudo-port with the "upgrade" or "install"  
>> targets would be good, but I don't think it's that  
>> straightforward, since AFAIK MacPorts *first* expands the pseudo- 
>> port to a list of ports, and *then* hands that list to the  
>> "upgrade" or "install" target; the targets do not see a difference  
>> between you typing "all" and you typing the names of all 5163  
>> ports. One possible remedy would be to have a sanity check for  
>> "install" and "upgrade" (any other targets?) to have it bail out  
>> if more than n ports are requested, where n is, I don't know, 100?  
>> 200? I have over 300 ports installed, but not many of those need  
>> upgrading; one would use "sudo port upgrade outdated" to upgrade  
>> only the outdated ports; "sudo port upgrade installed" wouldn't be  
>> a good thing to run. Comments on this strategy, or suggestions for  
>> other strategies to prevent this situation?
>
> Just thought about it. Thier should be a sanity check!
> upgrade should work only on installed ports!!
> It would semantically the correct thing to do.
> You know you can not upgrade hardware you do not have.

Yes, I mentioned that in the part you didn't quote:

>> One problem here is that if you "sudo port upgrade x" and port x  
>> is not already installed, MacPorts installs it. It would make more  
>> sense to me if MacPorts would instead issue an error ("cannot  
>> upgrade port x because it is not installed") and exit. Anyone know  
>> why "upgrade" installs a port if it's not installed?

I'm hoping someone who's been with the project longer than me will  
remember why it was implemented this way, and what the implications  
would be of changing it now.


> Then sudo port upgrade all would equate to sudo port upgrade  
> installed.

which would still be a bad command to run; you really want "sudo port  
upgrade outdated".


> Two ways to go about it:
> 	1) catch this when the command line is parsed
> 	2) upgrade checks the portlist given againt installed
>            ports before it starts its magic. It could then give out
> 	   a warning port xyz is not installed. Of course having some
> 	   5000 warnings is not nice. So probably method one would be
> 	   better as it would effect the rest of the way port works.





More information about the macports-users mailing list