Upgrading packages - portupgrade confusion

Michael Powell nightrecon at hotmail.com
Sun Sep 12 14:34:59 UTC 2010

Kaya Saman wrote:

> The thing I don't quite understand though is that if the ports tree
>>  gets refreshed, do the packages get upgraded or will I need to
>>  rebuild them??
> You have to rebuild them.
> Does this apply to ports too??

Yes. A package is just a port that someone has compiled into a pre-built 
binary package for use with pkg_add. These binary packages are placed on ftp 
servers where pkg_add may download from and install. 

A port is just you doing the compiling locally yourself using the ports 
system. The installed result is the same, except for one thing. When a 
package is built some build options may have been selected as defaults while 
others were excluded. When you build the port locally you have complete 
control over all options.
> "portupgrade -a" or "portmanager -u" depending on what application you
> are using. Switching between multiple port maintenance applications is
> not the worse thing you could do; however, I would not recommend it as
> an everyday occurrence.
> Ok so "portupgrade -a" upgrades all ports according to the manual.

> Ok, so if I understand correctly now is that the csup command refreshes
> the ports tree while portupgrade upgrades the actual port itself....

Update the ports tree first! csup -L 2 ports <- this file "ports" is a 
supfile. An example of a supfile was included in a previous mail. More 
detailed info in the Handbook.
> eg:
> cd /usr/ports/*/nano
> make install clean

cd /usr/ports/editors/nano/
make install clean

This installs nano when it was not installed before.

The manual method to update would be:
(with a freshly updated ports tree)

cd /usr/ports/editors/nano/
make && make deinstall && make reinstall

> although not the case but say if this was to build version 1.8 of the
> Nano text editor, running:
> portupgrade nano
> would upgrade the installed version to 1.9??

Yes - provided you had installed portupgrade and are using an up to date 
ports tree. If your ports tree is as old as the old version of nano then as 
far as FreeBSD is concerned it does not know of any new version. Refreshing 
your ports tree is where that information comes from.

The utility of automation with portupgrade really comes into play when you 
are trying to update more than one port. One port at a time can be done 
manually as in the above example, but that quickly becomes tiresome when 
there are many.

Sometimes a port may provide a shared library which many other ports depend 
upon. Updating that library may cause dependent apps to break. In such a 
situation portupgrade can recurse and rebuild all apps depending on that 
library so they will be linked against the new.

Another tip: Whenever there are situations which can get sticky most of the 
time notes are placed into a file containing instructions on how to deal 
with the problem. Get into the habit of always reading the UPDATING file 
located in /usr/ports so you will know about these *before* updating.

More information about the freebsd-questions mailing list