When using portupgrade -Pa to to FreeBSD updates from packages all updated packages will be installed even if you compile one of the updated packages was compiled locally from the ports tree with custom options or libraries. This causes any customizations to be lost and possibly version mismatches with system libraries.
The only ways around this problem was to either only upgrade some subset of the ports or to set HOLD_PKGS and manually update problem ports after a package update. Neither of these solutions is optimal so I took the time to make a patch for portupgrade.
The patch adds a USE_PORTS configuration option that specifies a lit of packages to always build from the ports tree even when portupgrade -P is called. (The -PP option still works the same as before.) Thus any custom packages can be added to this list and then an automatic update can be done that will favor binary version when available and when not overridden. This also means that if one package is built from source its parents and children will still come from binary packages if available.
Build the pached version
Patch, build, and install.
cd /usr/ports/ports-mgmt/portupgrade sudo make extract cd work sudo wget http://pynej.dnsalias.com/Shared/pkgtools-2.4.6-1.patch sudo patch -p0 < pkgtools-2.4.6-1.patch cd pkgtools-2.4.6 sudo make isntall cleanYou may also want to add portupgrade to your HOLD_PKGS list in /usr/local/etc/pkgtools.conf so it doesn't get replaced in the future.
To configure the list of overrides you will need to edit the following section:
sudo vim /usr/local/etc/pkgtools.conf USE_PORTS = [ ]Here is a sample of some common overrides.
- php5 to enable the apache module
- php5-mysql to get the binding to the correct version of mysql-server
- mod_perl2 to enable apache module
- phpmyadmin as it depends ont he wrong php5-mysql paskage)
sudo vim /usr/local/etc/pkgtools.conf USE_PORTS = [ 'lang/php5', 'databases/php5-mysql', 'databases/phpmyadmin', 'www/mod_perl2', ]