This is an old revision of the document!


portupgrade TableOfContents(3)

Portupgrade (aka pkgtools) is a tool set for working with ports and packages. It enhances abilities of system tools and adds many new ones. It is highly tunable via its configuration file and allows you to create individual svariable environment for every port you like, to define commands that will be executed before/after port upgrade stages.

pkgtools uses hash databases to keep information about available ports (in the ports tree), installed ports, dependencies, etc. So access to the information is fast. E.g. portversion(1) is much faster than pkg_version(1). (But note: you have to have a fresh INDEX file for relevant results).

pkgtools consist of the utils:

  • portupgrade - upgrade a port using ports or packages.
  • portinstall - helps you install new ports in a handy way.
  • pkg_deinstall - wraps pkg_delete(1) and provides additional features.
  • pkg_fetch - fetches packages from a remote site.
  • pkg_which - checks which package a file came from quickly.
  • portversion - a fast version of pkg_version(1).
  • portsclean - cleans ports workdirs, unreferenced distfiles, old and orphan shared libraries, and stale packages.
  • portcvsweb - instantly lets you browse change history via CVSweb.
  • pkgdb - manages and searches the package database.
  • portsdb - creates binary database from the ports INDEX.

and a few other.

Initially pkgtools was written by Akinori MUSHA <knu@FreeBSD.org>. After knu, KOMATSU Shinichiro <koma2@lovepeers.org> supported it for some time.

Currently, SergeyMatveychuk supports it. Send your wishes, bug reports and comments to him.

  • Look at pkgtools.conf. You'll find many interesting examples there.
  • portupgrade can stop/start/restart services when you like. Add these lines in pkgtools.conf and you'll always have service started after an upgrade process:
AFTERINSTALL = {
  '*' => proc { |origin|
    cmd_start_rc(origin)
  },
}
  • You can fetch INDEX and rebuild portsdb with one command:
portsdb -Fu
  • Use portinstall(1) and pkg_deinstall(1) as an alternative to pkg_add(1) and pkg_delete(1).
  • You can see a port history in your browser with portcvsweb(1) easily.
  • portsclean -D will purge old distfiles. portsclean -C will clean all 'work' directories. portsclean -L will clean up unused libraries in /usr/local/lib/compat/pkg. portsclean -P will clean up outdated packages.
  • Add portsbackup and portsrestore utilites. They will save ports data (/etc/make.conf, /var/db/pkg, /var/db/ports, /usr/local/etc) and restore all ports on another computer by rebuilding them from the ports tree. (The idea belongs to AndrejZverev).

Send your wishes to SergeyMatveychuk

From: MatthiasAndree

  • When unregistering a package installed that was installed twice or more often (for me, it happened recently with pkgconfig and pkg-config), pkgdb -F offers to unregister one package's metadata without removing its files. pkgdb -F might however compare the package lists of all packages and remove files that are unique to the package to be deinstalled (i. e. not installed by the package that remains). Example: assume package-1.1 with files a, b, c and package-1.1_4 with files a, c, e are installed. In this case, pkgdb -F could offer to remove “b” if package-1.1 is deinstalled.
  • When unregistering a package that was installed twice or more often, pkgdb -F might count the number of MD5 mismatches of the installed files to figure out which package data is more current or fits the existing installation better, and default to installing metadata with most mismatches.

From: Hannes Hauswedell <hannes.hauswedell at gmail.com>

  • I would wish for portupgrade to automatically meet new requirements upon upgrading. both pkg_add and make install do this, portupgrade should too. Upgrading a port and not installing a new requirement is almost never desired and shouldnt be default. (i.e. -R should not be required for this, instead if at all it should be achieved by -N )
  • When using portupgrade in -P mode it should check dependencies before:idea: doing a make install, otherwise requirements will always be installed via source, even though a current package might exist. an example: port A has no package and requires B that does have package. if I portupgrade -P “A” both are installed from source although B could have - and following the manual for -P, should have - been installed via package.

From: RW <list-freebsd-2004 at morbius.sent.com>

  • Portupgrade uses pkg_add -f to install packages. pkg_add is supposed to install the missing dependencies itself, but sometimes they are missing in the repository. Because it uses the -f option pkg_add is able to proceed without the missing dependency. Personally, I think it might be cleaner to drop the -f option and allow the pkg_add to fail.

From: AndrewPantyukhin

  • Deliver SIGSTOP to spawned processes.

From: AlexanderLeidinger

  • option to keep the logs of failed builds/updates (this is not '-L', but similar)
  • parse the output of the install phase and present a list of installed startup scripts before portupgrade exits (hidden behind an option or not)
  • parse the output of the install phase and present a list of all the stuff in the security report before portupgrade exits (only as an option)
  • portupgrade.1201366150.txt.gz
  • Last modified: 2008/01/26 16:49
  • by SergeyMatveychuk