PKGRRXX(8)

NAME
pkgrrxx - rebuild or update packages using 'make replace' in tsorted order

SYNOPSIS
pkgrrxx [-BFhknrsuv] [-D VARIABLE=VALUE] [-j concurrency] [-L path] [-X pkgs] [-x pkgs]

DESCRIPTION
pkgrrxx runs “make replace” on packages that have been marked to have unsafe dependencies, to be mismatched, or marked to be rebuilt. Optionally it can discover, mark and replace any mismatched packages (as reported by pkgchkxx(8)) as well.

Whenever “make replace” is run on a package, all installed packages that depend on it are marked with the “unsafe_depends_strict=YES” flag. If the version of the replaced package has changed, this indicates that it may no longer be ABI-compatible so “unsafe_depends=YES” is also set for all packages that depend on it. Running pkgrrxx with no arguments will restore such packages to a safe state by building a dependency graph, performing a topological sort on it, and running “make replace” in order. The dependency graph and topological sort are re-calculated after each “make replace”, in case it causes additional packages to be marked unsafe. pkgrrxx will pass “IN_PKG_ROLLING_REPLACE=1” to make(1), so users can set flags depending on interactive usage and batch-replace in their /usr/pkg/etc/mk.conf.

The user can mark additional packages to be rebuilt by setting the “rebuild=YES” flag on them using the command
    % pkg_admin set rebuild=YES <pkg>

If the -u option is given, pkgrrxx will use the same logic as “pkgchkxx -u -s” to check for packages for which the version in pkgsrc is different than the installed version, and run “make replace” on those packages as well (tsorting them along with the unsafe/rebuild packages). (Usually this results in packages being upgraded to newer versions, assuming the pkgsrc tree is more recent than the currently installed packages.) The packages discovered this way will be marked as mismatched, so that in a re-run of pkgrrxx you don't need to repeat the -u flag.

  Options

-B  Use the same logic as “pkgchkxx -B” to also mark any packages with any change in build version data.

-D VARIABLE=VALUE
    Passes VARIABLE=VALUE to each make call. “-D” can be specified more than once to pass several variables to make.

-F  Just fetches the sources of all mismatched packages required to be updated (and it's dependencies).

-h  Brief help.

-j concurrency
    Spawn up to the given number of threads for various bookkeeping tasks, defaults to the number of available CPUs. This option does not affect the number of make(1) jobs.

-k  Keep on going, even on error during handling current package. Warning: This could (potential will) rebuild package depending on the failed package, anyway. This may cause a broken tree. Use with caution!

-L path
    Logs each build (each command output from the commands which are run for packages) to given path. The full log file name is composed from the path given by this argument, the category name of the package and the package name: “given-path/category/pkgname”. The specified path is automatically created as needed.

-n  Display actions that would be taken, but don't actually run “make replace” or change any flags on installed packages. This option attempts to calculate the new packages that would be marked unsafe after each “make replace”.

-r  Just replace packages, do not build binary packages.

-s  Enable strict mode. This makes pkgrrxx look at “unsafe_depends_strict” tags instead of “unsafe_depends” tags. This will replace packages more aggressively and can be used to solve shared library problems.

-u  Use the same logic as “pkgchkxx -u” to check for mismatched packages, mark them with “mismatch=YES”, and replace those too. Otherwise, consider packages marked “mismatch=YES” to be mismatched. Marking with “mismatch=YES” occurs via ${SU_CMD} so that non-root users can also use the option. It is not an error if this fails; it just does not persist the status.

-v  Verbose output.

-X pkgs
    Exclude the comma-separated list of package base names from being rebuilt for any reason.

-x pkgs
    Exclude the comma-separated list of package base names from the check for mismatched packages. This does not prevent packages from being rebuilt for any other reason (such as being a dependency of another package that is also rebuilt, or having any of the pkg_admin(1) “unsafe_depends”, “unsafe_depends_strict”, or “rebuild” variables set to “YES”).

ENVIRONMENT
pkgrrxx uses the following environment variables.

MAKECONF
    Path to mk.conf. Defaults to /usr/pkg/etc/mk.conf, /usr/pkg/etc/mk.conf, or /etc/mk.conf.

PKGSRCDIR
    Base of pkgsrc tree. If not set in the environment, then this variable is read from ${MAKECONF}. If it is still not set, and if the current working directory appears to be inside a pkgsrc tree, then this variable is set to the base of that pkgsrc tree. Finally, if /usr/pkgsrc appears to contain a pkgsrc tree, then that is used as a last resort.

PKG_DBDIR
    pkgsrc database directory. If not set in environment then defaults to /usr/pkg/pkgdb.

EXAMPLES
To update all packages on the system and ensure correct shared library dependencies:

    pkgrrxx -rsuv

To update all packages on the system, do as little rebuilding as possible, and also produce binary packages:

    pkgrrxx -uv

To fetch all distfiles for the packages requiring an update on the system (packages with different version numbers than installed), and exit after it:

    pkgrrxx -F

To update gtk2+ and all packages that depend on it, except openoffice2:

    pkg_admin set rebuild=YES gtk2+
    pkgrrxx -rsv -X openoffice2

To force rebuild of gtk2+ and all packages that depend on it, keep going on even if one package fails, except openoffice2 - log to “/var/log/pkg_rr”:

    pkg_admin set rebuild=YES gtk2+
    pkgrrxx -krsv -L /var/log/pkg_rr -X openoffice2

To mark all packages that compiled against X11 as needing rebuild (used after switching to X11_TYPE=modular):

    cd /usr/pkg/pkgdb  grep "blddep x11-links" */* | cut -d/ -f1 | \
    sort -u | xargs pkg_admin set rebuild=YES

To compile all packages heavily parallel, use

    pkgrrxx -D MAKE_JOBS=8

AUTHORS
-nosplit Nick Goffee <ngoffee@bbn.com>, with initial idea and many suggestions from Greg Troxel <gdt@ir.bbn.com>. The options -s and -r were added by Tobias Nygren <tnn@NetBSD.org>. The options -k, -D, -F and -L were added by Jens Rehsack <sno@NetBSD.org>. The option -j was added and the entire program was rewritten in C++ by PHO <pho@NetBSD.org> to gain speed.

BUGS
pkgrrxx does not run fully automatically when any significant number of packages need to be replaced.

pkgrrxx does not run fully automatically when the PKGNAME of a package changes.