DPB(1)

๐Ÿ“ฆ in nixpkgs unstable

๐Ÿ‘‘ DPB(1) ๐Ÿ‘‘

General Commands Manual ยท distributed ports builder

โœจ NAME โœจ

dpb โ€” distributed ports builder ๐Ÿ’–

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

dpb [-acemqRrsUuvx] [-A arch] [-B chroot] [-b logfile] [-C pathlist]
    [-D PARAM=value] [-F m] [-f m] [-h hosts] [-I pathlist] [-J p]
    [-j n] [-L logdir] [-l lockdir] [-M threshold] [-P pathlist]
    [-p parallel] [-S logfile] [-X pathlist] [pathlist ...]

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

Okay bestie, so dpb is used to build ports on a cluster of machines, or on a single machine with several cores. It literally walks the ports tree to figure out dependencies and starts building ports as soon as it can. Main character energy fr fr. โœจ

dpb will run with sensible defaults if used without options. But lowkey note this: it will produce logs, lock files, packages, and package installations. No cap.

If run as non-root, dpb will warn. The preferred way is to run it as root (and preferably under a chroot, see bulk(8) and proot(1) for example setups). dpb will then change its identity to different users as needed. See โ€œTHE SECURITY MODEL OF DPBโ€ for details. ๐Ÿ‘‘

dpb can be restricted to a subset of the tree by giving it pathlist ... to build as parameters.

A pathlist is either a pkgpath(7) to build, or a filename that contains pkgpaths (one per line). pathlist parameters can also take the form filename*scale in order to multiply the weights of all pkgpath(7) in a file by a given scale, or pkgpath=value, in order to set the weight of a given pkgpath(7) to a specific value. Slay. ๐Ÿ’…

dpb supports โ€˜hot-fixesโ€™: if a particular port errors out, it is possible to fix the problem, remove the corresponding lockfile, and dpb will pick it up without needing to be stopped and restarted. Obsessed with not restarting tbh.

In order to build on a cluster, the ports tree itself should be identical on each machine (shared through NFS or copied at start).

Some directories must be shared: PACKAGE_REPOSITORY, DISTDIR, and PLIST_REPOSITORY. The WRKOBJDIR and LOCKDIR should be local to each machine, and on a high-speed partition.

Also note that dpb's logs and locks are managed by the main dpb process, which runs locally, and hence those directories do not need to be shared on the cluster. That's giving convenience, honestly.

Some log files ("rolling logs") are kept from one run to the next and stored under ${DISTDIR}/build-stats. On each run, the most recent entries for each pkgpath (see STATS_USED) are used to figure out in which order things should be built. Meanwhile, some more entries are kept around (see STATS_BACKLOG) for potential data analysis over longer periods. ๐Ÿ“

Option -h file is used to specify hosts to use, where file may contain lots of information, but can be as simple as a list of hosts to use, one host per line (however, it is recommended to also include a STARTUP script).

Most filenames will go through some control sequence expansions. For instance, the default logdir location can be specified as %p/logs/%a. The following sequences are recognized:

  • %a โ€” architecture being used.
  • %d โ€” date at start of dpb, GMtime, formatted as yyyy-mm-dd@hh:mm:ss.
  • %f โ€” fetch distfiles location (DISTDIR).
  • %h โ€” short hostname running dpb.
  • %L โ€” logdir location.
  • %p โ€” portsdir location.
  • %t โ€” timestamp (number of seconds since January 1 1970) at start of dpb.
  • %$ โ€” Pid of the main dpb process .

๐Ÿ’… Options are as follows ๐Ÿ’…

  • -A arch โ€” Build packages for given architecture, selecting relevant hosts from the cluster. By default, the current host's architecture will be used.
  • -a โ€” Walk the whole tree and builds all packages (default if no pathlist is given).
  • -B chroot โ€” chroot to chroot before building. See proot(1) for preparing such an environment.
  • -b logfile โ€” Explicitly prime the heuristics module with a previous build log, so that packages that take a long time to build will happen earlier. The rolling log file under %f/build-stats/%a is automatically used.
  • -C pathlist โ€” Don't clean port working directories after build. Only use simple pkgpath(7) in the list, as this does not take subpackages and flavors into account.
  • -c โ€” Clean port working directory and log before each build.
  • -D PARAM=value โ€” Set defined parameter to value. Known parameters are as follows:
    • ALWAYS_CLEAN โ€” Set to 1 if dpb should clean work directories even if the port errored out.
    • BUILD_USER โ€” Default value for build_user if you want to specify it on the command line, and want to ensure even the small "discover PORTSDIR" activity at the beginning of dpb is not run as root.
    • COLOR โ€” Set to 1 to have the normal display in color.
    • CONNECTION_TIMEOUT โ€” Connection timeout for ssh. Defaults to 10 seconds (but ssh will retry 3 times).
    • CONTROL โ€” Let dpb create a unix socket of the given name for external control. Defaults to %L/control-%h-%$. If no socket is wanted, explicitly set CONTROL to empty.
    • DISPLAY_TIMEOUT โ€” Display timeout (in seconds) while waiting for jobs to finish, so that the display is updated even if jobs didn't finish. Defaults to 10 seconds.
    • DONT_BUILD_ONCE โ€” By default, dpb will use the BUILD_ONCE optimization (see bsd.port.mk(5)) if run with -a: pseudo-flavors that disable subpackages and are not necessary for bootstrap will be disabled, so that the same port is built once, as far as possible. This flag disables that optimization, which might be desirable if you want to build a small subset of packages which would pull in the kitchen sink otherwise.
    • DONT_CLEAN_LOCKS โ€” By default, dpb will clean old locks from dpb running on the same host that no longer exist, provided they didn't end in error. This is usually the right thing to do after a crash, or after killing dpb abruptly. Sometimes, one may want manual control over which locks to remove.
    • FETCH_JOBS โ€” Alternate way to specify the number of fetch jobs.
    • FETCH_TIMEOUT โ€” Timeout (in seconds) after which fetches that don't show any progress will be killed. This can be instead set in DEFAULT or localhost as the fetch_timeout property.
    • FETCH_CMD โ€” Override for the default FETCH_CMD coming from ports. This might be useful because fetching isn't chroot'd and is run as ${FETCH_USER}.
    • FETCH_USER โ€” User for all fetch activities if possible (defaults to _pfetch).
    • FTP_ONLY โ€” Don't fetch distfiles/don't build packages that are not allowed for ftp.
    • HISTORY_ONLY โ€” Don't fetch or build anything. Only run dpb to figure out old distfiles and update %f/history.
    • LISTING_EXTRA โ€” Alternate way to specify -e.
    • LOCKDIR โ€” Alternate way to specify the locking directory.
    • LOGDIR โ€” Alternate way to specify the logging directory.
    • LOG_USER โ€” User for all log files if possible (defaults to build_user).
    • MIRROR โ€” Applicable to fetch modes. If 0, will only fetch normal DISTFILES (default for dpb -f). If 1, will also fetch extra SUPDISTFILES (default for dpb -F).
    • NEVER_CLEAN โ€” If 1, dpb will never clean any work directory after build.
    • NO_BUILD_STATS โ€” Disable reading/saving of default build stats under ${DISTDIR}/build-stats/${ARCH}.
    • NO_CHECKSUM โ€” Do not run checksum again for files already fetched.
    • NO_CURSOR โ€” Make the terminal cursor invisible if possible. Avoids flickering on slow graphics cards.
    • NO_HISTORY โ€” Do not update the distfiles history. For instance, if dpb is run a second time after a problem during the first run.
    • NO_QUICK_SCAN โ€” Disable the quick scan default heuristic, where full bulks will start by scanning the most prominent ports in former builds.
    • PORT_USER โ€” User that can write to the ports tree. Not really used for anything yet.
    • RECORD โ€” Define a file which will save all terminal output. Mostly useful for presentations, as a way to save dpb output and replay it later at a faster rate. Defaults to %L/term-report.log, can be set to nothing to disable.
    • STARTUP โ€” Define a start-up script on the command-line, override any host file contents.
    • STATS_BACKLOG โ€” Max number of stats (per individual pkgpath) to save in the rolling log file (defaults to 25).
    • STATS_USED โ€” Clamp number of stats (per individual pkgpath) used for computing build order (defaults to 10).
    • STUCK_TIMEOUT โ€” Timeout (in seconds * speed factor) after which tasks that don't show any progress will be killed. This can be instead set on a per-core basis as the stuck property. Note that this will always be divided by the core's speed factor.
    • SYSLOG โ€” Make dpb call syslog(3) on every task start/end while creating packages. This does produce lots of messages, it is intended to route the logging on another machine, while tracking down panics and other hangs.
  • WANTSIZE โ€” ngl bestie this is just another way to spell -s, same energy, different outfit ๐Ÿ’…
  • -e โ€” makes the listing job extra: once it's done it does not go back into the pool. It's a main-character job, it doesn't do returns ๐ŸŽ€
  • -F m โ€” fetch-only mode, for mirroring hosts โœจ Do not build any package, just fetch everything, straight up disregarding BROKEN and ONLY_FOR_ARCHS info like they're last season. Creates m localhost jobs for fetching files ๐Ÿ“ฅ
  • -f m โ€” create m jobs for fetching files. These are separate from the build jobs (they don't eat cpu, they run on the localhost) ๐Ÿงš Defaults to 2. You can set it to 0 to bypass fetching jobs entirely and reduce dpb memory footprint by a lot โ€” like, genuinely a lot, no cap ๐Ÿ’€
  • -h hosts โ€” file with the hosts to use for building. One host per line, plus properties, like so:
espie@aeryn jobs=4 arch=i386

Lines starting with a known variable name, such as

STARTUP=path

or

FETCH_JOBS=5

can also be set inside a configuration file, so you don't have to pass a million options on the command line ๐Ÿซถ

The special hostname DEFAULT can be used to preset defaults โ€” put it at the start of the file, bestie, it's the opening act ๐Ÿ‘‘

Use localhost to specify the local machine. dpb special-cases it and will not use ssh(1) to connect ๐Ÿ™ˆ

Properties are as follows:

  • always_clean=n โ€” set to 0 or 1, on a per-host basis. See the ALWAYS_CLEAN parameter ๐ŸŒธ
  • arch=value โ€” architecture of the concerned host. (There should be a startup task to check consistency, but currently you have to set this manually on heterogeneous networks. Not me explaining the lore ๐Ÿ˜ญ)
  • build_user=user โ€” use user for non-root jobs if possible (defaults to the whoami(1) value) ๐ŸŽ€
  • chroot=dir โ€” chroot to dir before building ๐Ÿงš
  • fetch_timeout=s โ€” timeout (in seconds) after which fetches that don't show any progress get killed. Only makes sense for DEFAULT or localhost โฐ
  • jobs=n โ€” number of jobs to run on that host, defaults to hw.ncpuonline ๐Ÿ”ฅ
  • junk=n โ€” junk unused packages each n steps. See the -J option ๐Ÿ—‘๏ธ
  • memory=thr โ€” build everything below that wrkdir threshold with USE_MFS=โ€˜Yesโ€™, assuming the ports tree has been configured so that WRKOBJDIR_MFS points to a memory filesystem. thr is the sum, in KBytes, of ports that will be allowed to build in memory. dpb understands suffixes, such as -M 2G or -M 500M.

โš ๏ธ Note that you should always allow for some margin, as dpb makes its decision based on the size info collected during previous builds โ€” so in cases of significant updates, the work directory size will usually grow ๐Ÿ“ˆ

  • nochecksum=0/1 โ€” defaults to 1. During the junk stage, run pkg_delete(1) with the -q (no checksum) option โœ…
  • parallel=p โ€” run big ports on several cores. See the -p option ๐Ÿ’ช
  • parallel2=p โ€” run the largest ports on many cores. Defaults to the same value as the parallel option, but can be increased for, say, chromium ๐Ÿ‘€
  • repair=0/1 โ€” defaults to 1. Run pkg_add(1) with the repair option. Lowkey useful on some bulk machines that tend to crash a lot and leave /var/db/pkg in a weird state ๐Ÿ™ˆ
  • sf=n โ€” speed factor. An estimate of that machine's speed with that number of jobs compared to other machines in the same network. Works better with small values, in the range 1..50. The machine (or machines) with the highest speed factor gets access to all jobs, whereas other machines get clamped to stuff that doesn't take too long. Requires previous build information to be effective. Defaults to 1 ๐ŸŽ๏ธ
  • small=s โ€” small threshold (in seconds ร— sf): ports known to build under that duration are deemed small, so dpb won't bother calling fine-grained steps for patch/configure/fake โ€” it goes straight to build and package instead. Defaults to 120 seconds โšก
  • squiggles=n โ€” number of squiggles on this host (see โ€œTHE SQUIGGLE HEURISTICSโ€ below). Defaults to 1 squiggle for hosts with 4 jobs or more, 0.7 for hosts with more than 1 job, 0 for single-job hosts ๐ŸŒ€
  • stuck=s โ€” stuck timeout (in seconds ร— sf) after which tasks that show no progress get killed ๐Ÿ’€
  • timeout=s โ€” defines a specific connection timeout for ssh to that host โฑ๏ธ

There are no fine-grained options to control ssh(1) options, because those can be specified through virtual host declarations in ssh_config(5) โœจ

  • -I pathlist โ€” list of pkgpath(7) to install, on the local box. This will also add them to the list of things to build ๐Ÿ“
  • -J p โ€” override the value for the โ€œjunkโ€ property. Delete unneeded installed packages during the build. Each prepare stage is followed by a show-prepare-results stage. After every p new dependencies, it gets followed by a junk stage, which uses pkg_delete(1) with the -aXI options to delete automatically installed packages that are currently not needed ๐Ÿ—‘๏ธ

dpb keeps track of the list of dependencies on a given host by storing each dependency list in the lockfile corresponding to the package being built ๐Ÿ”

To avoid a race condition between the depends and junk stages, dpb allows only one job on a given host to be in the depends โ€ฆ junk stages at one time, by using a per-host lock ๐Ÿซถ

Defaults to 150. Can be disabled by setting to 0.

โš ๏ธ Some ports โ€” most notably cmake-based ones โ€” have an annoying dependency handling bug: they compute their makefile dependencies based on all include files present, not just the ones that are actually enabled. Those ports' builds may be broken by a junk phase that removes some unused includes that were added as makefile prerequisites. Those ports should be annotated with DPB_PROPERTIES = nojunk until that bug is fixed: while a port with the โ€˜nojunkโ€™ property is building, junk will be postponed ๐Ÿ™

Those ports get marked with a ! in the display, so it's way more obvious why junk seems to be ineffective ๐Ÿ‘€

Note that the โ€˜nojunkโ€™ property is still active for ports in error โ€” in the belief that trivial fixes can be made that will allow the port build to finish ๐Ÿคž

  • -j n โ€” number of jobs to run on a single host (defaults to hw.ncpuonline) ๐Ÿ”ฅ
  • -L logdir โ€” choose a log directory. (Defaults to %p/logs/%a.) ๐Ÿ“
  • -l lockdir โ€” choose a lock directory. (Defaults to %L/locks.) Override it to keep it local, because locks don't really like NFS ๐Ÿ˜ฌ
  • -M threshold โ€” build ports below the memory threshold under a memory filesystem, as configured through WRKOBJDIR_MFS (see bsd.port.mk(5)). threshold is the sum, in KBytes, of ports allowed to build there ๐Ÿง 
  • -m โ€” force tty-style reporting ๐Ÿ–ฅ๏ธ
  • -P pathlist โ€” read the list of pkgpath(7) from file ๐Ÿ“„
  • -p parallel โ€” override the value for the โ€œparallelโ€ property.

Run big jobs on several cores on the same host, by using MAKE_JOBS=k ๐Ÿ’ช

Once such a job has started, dpb will not start new jobs on the same host until the big job has stolen enough cores from other finishing jobs ๐Ÿ˜ค

Only big ports that are safe for parallel building (annotated with DPB_PROPERTIES = parallel in their Makefile) are affected ๐ŸŽ€

It's advisable to set k to an integral fraction of the number of cores available on a given host. parameter can be an integer, or of the form /n, in which case dpb sets k to a fraction of the total number of jobs on the machine, but never below 2 ๐Ÿงฎ

Defaults to /2 โœจ

  • -q โ€” don't quit while errors/locks are around. It's giving "we stay" energy ๐Ÿ’…
  • -R โ€” rebuild existing packages based on discrepancies between the package signature and what the port says it should be. Concretely, use this to run a partial bulk build after some library change ๐Ÿ”„
โš ๏ธ Note that -R won't always work, since rebuilding a package when another version is already installed is not supported. Building in a chroot is strongly recommended ๐Ÿงš
  • -r โ€” random build order. Disregard any kind of smart heuristics. Useful to try to find missing build dependencies ๐ŸŽฒ
  • -S logfile โ€” read logfile as an initial workdir size log ๐Ÿ“š
  • -s โ€” compute workdir sizes before cleaning up, and stash them in the log file %L/size.log. This also maintains a rolling log of build sizes under %f/build-stats/%a-size. To save time, dpb actually won't always compute new sizes for known directories โ€” mostly just for new ones, or when the package name changes โณ
  • -U โ€” insist on updating existing packages during dependency solving, even if the new package apparently didn't change. Like, insist insist ๐Ÿ™…โ€โ™€๏ธ
  • -u โ€” update the packages you already have while it's solving deps. You can use this to do a bulk-build on a machine that already has stuff installed, but ngl it might break a little, since some packages only build on a totally clean machine right now ๐Ÿ™ˆ
  • -X pathlist โ€” read a list of pkgpath(7) from a file and pass them along in the junk phase: these are the packages that should stay on the machine if some dependency pulled them in. Basically the anti-churn flag โ€” use it so you're not endlessly removing and reinstalling the usual suspects, like devel/gmake.
  • -x โ€” no tty report, only the actually important stuff gets reported: hosts going down and coming back up, build errors, or builds that just aren't progressing. Minimalist queen ๐Ÿ’…

dpb figures out the build order on the fly and constantly shows you info about whatever's building right now. There's a list of what's currently running, one line per job, and those jobs are in strict chronological order โ€” which means long-running builds tend to percolate up to the top of the list. Normal jobs look like this:

      www/mozilla-firefox(build) [9452] 41% unchanged for 92 seconds

So what's in there? Let's break it down:

  • an optional โ€˜~โ€™ squiggle marker (more on that below ๐Ÿ‘€),
  • the pkgpath being built,
  • the step currently being run,
  • an optional โ€˜!โ€™ for ports with the โ€˜nojunkโ€™ property,
  • an optional โ€˜+โ€™ for ports built in memory,
  • the pid running that task (heads up: this is always a pid on the host running dpb โ€” for distributed builds, it'll be an ssh(1) to another machine),
  • the current size of the log file (shown as a percentage if there are previous build stats available),
  • and a possible notice that things might be stuck when the log file doesn't change for long periods.

And fetch jobs look like this:

      <dist-3.0.tgz(#1) [4321] 25%

Which contains:

  • the file being fetched,
  • the number of the MASTER_SITE being tried,
  • the pid of the ftp(1) process (note that fetch jobs are always local),
  • a progress percentage.

After that comes a host line with the name of each host dpb is using. They're followed by a โ€˜-'โ€™` for unresponsive hosts, and the pid of the ssh master for distant hosts.

And it all wraps up with a summary display:

  • I= โ€” number of built packages that can be installed.
  • B= โ€” number of built packages not yet known to be installable, because of run depends that still need to be built.
  • Q= โ€” number of packages in the queue, e.g. stuff that can be built now, assuming we have a free slot.
  • T= โ€” number of packages to build, where dependencies are not yet resolved.
  • F= โ€” number of distfiles to fetch, when -f is used.
  • != โ€” number of ignored packages. Details in engine.log.
  • L= โ€” list of packages that cannot currently be built because of locks.
  • E= โ€” list of packages in error, that cannot currently be built.
  • H= โ€” list of packages that haven't shown up yet, usually due to nfs, but watch out for revision bumps ๐Ÿ‘€

If those three lists are empty, they won't even show up. Packages in errors may be followed by a โ€˜!โ€™ if they prevent junk from happening.

Heads up: those numbers refer to pkgpaths known to dpb. In general those numbers will be slightly higher than the actual number of packages being built, since several paths may lead to the same package. No cap.

dpb uses some heuristics to try to maximise the queue as soon as possible. There are also provisions for a feedback-directed build, where info from previous builds gets used to try to build the long-running jobs first. Obsessed honestly ๐Ÿ’–

Similarly, fetches will use the continue option of ftp(1), since distfiles are checksummed after the fetch anyways.


โœจ THE SQUIGGLE HEURISTICS โœจ

So here's the tea: on machines with lots of cores, the basic scheduling heuristics yields a tail of very small jobs, where dpb mostly just waits on pkg_add(1) to solve dependencies. ๐Ÿ˜ญ Starting with OpenBSD 5.5, a new mechanism (squiggles) was introduced to counter-balance this effect: big machines devote some of their cores to โ€˜squigglesโ€™, jobs that walk the queue in reverse, thus building the smallest ports first. As a result, small ports get built as a trickle alongside the largest ports, offsetting the negative effect of the exponential queue for a large part. Slay ๐Ÿฆ‹

Note that โ€˜squigglesโ€™ can be a non-integral value, usually lower than 1, in which case they represent the fraction of cores that should be affected to squiggles, as decided randomly at the start of each build. 0.7 or 0.8 might be a good choice for dual core machines.


๐ŸŒธ DPB PROPERTIES ๐ŸŒธ

The bsd.port.mk(5) variable DPB_PROPERTIES may hold several annotations that only dpb will look at. These properties are as follows:

  • lonesome โ€” a large port that stresses the memory limits of the machine, so it should be built alone. Prevents dpb from scheduling anything else on the same host after it starts building. It's giving "do not perceive me" energy ๐Ÿ’…
  • noconfigurejunk โ€” a port that looks for unneeded dependencies during its configure phase (typically, optional tools like doxygen to rebuild documentation). Similar to nojunk but less expensive, since the configure phase is most often limited in scope.
  • nojunk โ€” a port that hardcodes includes in its Makefile mechanisms. Prevents junk from running while the port is building.
  • parallel โ€” a port that can be built in parallel, uses MAKE_JOBS and several build slots.
  • parallel2 โ€” a very large port that should be built in parallel, uses MAKE_JOBS and lots of build slots. Main character energy ๐Ÿ”ฅ

๐Ÿ‘‘ THE SECURITY MODEL OF DPB ๐Ÿ‘‘

When dpb is run as root, it uses a privilege drop model instead of the dangerous privilege elevation model of doas(1). When run as root, by default, _pbuild is used as the build and log user, and _pfetch is used as the fetch user.

  • Start dpb as root.
  • dpb will drop privileges for every operation except pkg_add(1), pkg_delete(1) and the STARTUP script.
  • For cluster builds, provide an ssh(1) connection to distant hosts from root as root.
  • build_user is used to build stuff locally or distantly (can be per-host), using: chroot -u build_user /build_root (with /build_root = / if there's no actual chroot needed). It must have read access to ${DISTDIR} and ${PORTSDIR}, and write access to ${WRKOBJDIR}, ${PACKAGE_REPOSITORY}, and ${PLIST_REPOSITORY}. It does not require network access.
  • LOG_USER is used to open all log files. LOG_USER only needs to exist locally. It needs write access to the log directories, including ${DISTDIR}/build-stats. It does not need network access.
  • FETCH_USER is used to fetch distfiles and handle corresponding log info. It needs write access to ${DISTDIR}, and network access. Thus, ftp(1) does not happen as root. Petition signed successfully ๐Ÿซถ
  • _dpb is used as a fail-safe for any other activities that do not require any rights.
  • dpb creates local directories as root, then gives them to the appropriate user.

๐ŸŽ€ LOCKS AND ERRORS ๐ŸŽ€

dpb still uses the normal ports tree mechanism while building, which includes LOCKDIR. When starting up, dpb will normally detect stale locks from old dpb runs and remove them. If this doesn't happen, builds will stay stuck in their initial stage, that is: show-prepare-results, patch, build depending on the port. A telltale message โ€˜Awaiting lock ...โ€™ can be found in the corresponding logfile paths/pkgpath.log.

In addition, when building a package, dpb produces a lockfile in the locks directory, whose name is deduced from the basic pkgpath with slashes replaced by dots. This lockfile is filled with such info as the build start time or the host, or the needed dependencies for this pkgpath.

The lockfile will also contain the name of a parent pkgpath, for paths that were discovered as dependencies. This is particularly useful for bogus paths, where it would be hard to know where the path came from otherwise.

At the end of a successful build, these lockfiles are removed. The lock will stay around in case of errors (raw value from wait(2)), and the name of the next task in the build pipeline (with todo=<nothing> in case of failure during clean-up). Normal list of tasks is: depends prepare fetch patch configure build fake package clean.

At the end of each job, dpb rechecks the locks directory for existing lockfiles. If some locks have vanished, it will put the corresponding paths back in the queue and attempt another build.

This eases manual repairs: if a package does not build, the user can look at the log, go to the port directory, fix the problem, and then remove the lock. dpb will pick up the ball and keep building without interruption. Iconic behaviour, honestly ๐Ÿ’œ

It is perfectly safe to run several dpb in parallel on the same machine. This is not optimal, since each dpb ignores the others, and only uses the lock info to avoid the other's current work โ€” but it can be handy: in an emergency, one can start a second dpb to obtain a specific package right now, in parallel with the original dpb.

Note that dpb is very careful not to run two builds from the same pkgpath at the same time, even on different machines: in some cases, MULTI_PACKAGES and FLAVOR combinations may lead to the same package being built simultaneously, and since the package repository is shared, this can easily lead to trouble. ๐Ÿ’€

Handling of shared log files and history is also done very carefully, by systematically appending to files or using atomic mv operations.

For obvious reasons, this won't work as well with masters running on distinct machines sharing their logs through NFS.

๐Ÿ” BUILD CYCLES ๐Ÿ”

There are some various interdependencies in package builds that can be hard to trace in case something goes wrong. Refer to summary.log to fix those specific issues.


๐ŸŒˆ AFFINITY ๐ŸŒˆ

dpb now maintains a list of pkgpath-per-host that are currently building in the affinity directory of its log directory, along with building-in-memory status.

That information is only wiped out when a given build finishes successfully.

Otherwise dpb will try to restart that build on the same host, which can be handy if you interrupt dpb while it's building a large port, or if you remove a lock after fixing a problem. It remembers. It cares. ๐Ÿ˜ญโœจ

๐Ÿท๏ธ TAGS FOR EXCLUSIVE BUILDS ๐Ÿท๏ธ

Okay so storytime bestie ๐Ÿ’… โ€” back in the day we had kde3 and kde4, and the way that these two literally could not be built at the same time ๐Ÿ˜ญ like, a single host had to be exclusively building kde3 ports or kde4 ports at any given moment. No mixing, no vibes.

So the conflicting ports got annotated, right? With DPB_PROPERTIES=tag:kde3 and DPB_PROPERTIES=tag:kde4 respectively. Cute little labels โœจ

More generally: with DPB_PROPERTIES=tag:A and DPB_PROPERTIES=tag:B, dpb will keep track of tags. For instance, if host X is building ports tagged with A, then any port with tag B will be prevented from building on X until the next junk phase. It's giving "you can't sit with us" ๐Ÿšซ

This heavily relies on the junk stage to clean up hosts periodically โ€” and it can even forcibly provoke a junk stage even if junk=0. Iconic but aggressive.

That โ€˜force-junkโ€™ stage is actually implemented as a pseudo path called junk-proxy, which does only junk. Nothing else. Just junk. ๐Ÿ—‘๏ธ

In order for builds to proceed gracefully, machines should start in a clean slate, without any of the problematic ports installed. Fresh face, no baggage ๐Ÿง–

As a special-case, failing ports with a tag will not interfere with clean-up, so that hosts do not get locked down to a specific tag. This also means that their dependencies may vanish before human intervention addresses the problem. Yeah. That's the trade-off, ngl ๐Ÿ˜ฌ

This is supposed to be an exceptional hack, helpful while porters figure out how to remove the deadlock. It's a band-aid, not a lifestyle ๐Ÿฉน

๐ŸŽฎ EXTERNAL CONTROL ๐ŸŽฎ

By default (see CONTROL), dpb will create a Unix socket at %L/control-%h-%$, only accessible by LOG_USER, that can accept a few commands โ€” e.g., usable as nc -U path. Yes bestie, you can literally just talk to it ๐Ÿซถ

Current commands are as follows:

  • addhost hostline โ€” add a new host.
  • addpath fullpkgpath ... โ€” add fullpkgpath to scan.
  • bye โ€” close the socket connection. Bye ๐Ÿ‘‹
  • dontclean pkgpath ... โ€” add new pkgpath to the list of paths that should not be cleaned after build.
  • help โ€” self explanatory. (Truly self explanatory. No notes.)
  • info cores โ€” debug info for cores (to be extended to other data).
  • rescan โ€” force dpb to rescan all ignored paths (for various errors, including bogus dependencies).
  • stats โ€” show the current stats line.
  • status fullpkgpath ... โ€” show the current status of fullpkgpath: whether it's built, installable, ready to build, to build later, along with current dependencies if applicable.
  • stub fullpkgpath ... โ€” stub out fullpkgpath and unlock it if needed.
  • wipe fullpkgpath ... โ€” wipe out an existing lock: clean up the corresponding fullpkgpath on the appropriate host, then remove all lock and affinity info pertaining to the port. Full reset energy โœจ
  • wipe-all โ€” wipe out all existing packages with an error state. This operates like the wipe control.
  • wipehost hostname ... โ€” remove all information relevant to a given host from dpb, including running jobs, locks, and affinity information.

๐Ÿ›‘ SHUTTING DOWN GRACEFULLY ๐Ÿ›‘

dpb periodically checks for a file named stop in its log directory. If this file exists, then it won't start new jobs, and it'll shutdown when the current jobs are finished โ€” unless -q. Chill exit ๐Ÿ˜Œ

dpb also checks for files named stop-<hostname> in its log directory. If such a file exists, then it won't start new jobs on the corresponding machine. Per-host timeout corner, we love to see it ๐ŸŽ€


๐Ÿ“ FILES ๐Ÿ“

Apart from producing packages, dpb may create temporary files as ${FULLDISTDIR}/${DISTFILE}.part.

In fetch mode (-f and -F), dpb populates ${DISTDIR}/by_cipher/sha256 with links. It also uses ${DISTDIR}/distinfo and ${DISTDIR}/history as a โ€˜permanent logโ€™:

  • distinfo โ€” cache of distfiles checksum. Contains all sha256(1) checksums of known files under ${DISTDIR}. Fetching uses this to avoid re-checksumming known files. Efficiency queen ๐Ÿ‘‘
  • history โ€” log of old files under distinfo. After successfully scanning a full ports tree (dpb -a), the fetch engine knows precisely which files are needed by the build (and their checksums). Anything that is:
    • recorded in distinfo but unneeded
    • recorded in distinfo but with the wrong checksum
    • not recorded in distinfo, but not needed

โ€ฆwill be entered at the end of history as a line:

ts SHA256 (file) = value

with ts a timestamp from Unix epoch.

When cleaning up old files, with a tool such as clean-old-distfiles(1), it is vital to check both the checksum and the file name: since mirroring stores permanent links under by_cipher, files which are still needed will appear in history under their old checksums, as an indication the link should be removed, but possibly not the file itself. Like, do not just delete stuff, fr fr ๐Ÿ˜ญ check both or perish.

If ${DISTDIR} ever becomes corrupted, removing ${DISTDIR}/distinfo will force dpb into checking all files again. Hard reset, but for checksums ๐Ÿ”„

All those files belong to the FETCH_USER if it is defined. They should be readable for the build_user.

dpb also records rolling build statistics under ${DISTDIR}/build-stats/${ARCH}, and uses them automatically (see STATS_BACKLOG and STATS_USED) in the absence of -b logfile. That file belongs to the LOG_USER if it is defined.

If -s is used, size information for successful builds will be recorded under ${DISTDIR}/build-stats/${ARCH}-size (by default, location adjustable with -S sizelog). This is then reused for the mfs threshold option. That file also belongs to the LOG_USER if it is defined. ๐Ÿ“

dpb also maintains a list of pkgpath frequencies ${DISTDIR}/build-stats/${ARCH}-dependencies, filled at end of LISTING if -a. This list will be automatically reused when restarting a build: a quick LISTING of the most important dependencies will happen before the general LISTING, in order to prime further LISTING steps with most common ports first. Main character ports get the head start ๐Ÿ’ซ

dpb will also create a large number of log files under ${PORTSDIR}/logs/${ARCH}, which will belong to LOG_USER if it is defined:

  • affinity/ โ€” affinity information. One file per full pkgpath, with slash replaced by dots like so: affinity/lang.ghc,-main.
  • affinity.log โ€” on startup dpb reads existing affinity information, and records it in that log, together with its pid. This log just exists to verify, along with engine.log, whether correct affinity was heeded.
  • awaiting-locks.log โ€” this is purely for gathering performance statistics, about how much lock contention happened around pkg_add(1) and pkg_delete(1) usage. Plotting cumulated time may help in fine-tuning squiggles parameters.
  • build.log โ€” actual build log. Each line summarizes build of a single pkgpath, as: โ€˜pkgpath host time logsize (detailed timing)[!]โ€™ where time is the actual build time in seconds, host is the machine name where this occurred, logsize is the corresponding log file size, and a ! is appended in case the build didn't succeed.

The detailed timing info gives a run-down of the build, with clean, fetch, prepare, patch (actually extract+patch), configure, build, fake, package, clean detailed timing info. Note that the actual build time starts at โ€˜extractโ€™ and finishes at โ€˜packageโ€™.

  • built-packages.log โ€” the actual list of fullpkgname.tgz as they get built. Trophies ๐Ÿ†
  • cpu-concurrency.log โ€” shows the actual concurrency achieved as a result of job starvation / parallel handling. Only gets a new line when the value changes: pid timestamp jobs
  • debug.log โ€” contains various information related to the main engine spinning (RTFS, haven't figured that one yet) along with the more useful warning and die traces that happen when something wrong occurs. Especially useful for the warning messages that tend to be overwritten by subsequent displays. Will also contain error messages pertaining to failure at parsing existing lock files.
  • dist/<distfile>.log โ€” log of the ftp(1) process(es) that attempted to fetch the distfile.
  • control-%h-%$ โ€” default name for the external control socket.
  • dump.log โ€” a long log file generated at the end of build that yields any information pertinent to ports still in the โ€˜to buildโ€™ and the โ€˜builtโ€™ queues. See also summary.log for an expurged version of same.
  • engine.log โ€” build engine log. Each line corresponds to a state change for a pkgpath and starts with the pid of dpb, plus a timestamp of the log entry. The codes, bestie, the codes ๐Ÿ‘‡
    • ^ โ€” pkgpath temporarily put aside, because a job is running in the same directory.
    • ! โ€” pkgpath ignored, either directly, or indirectly because a dependency was ignored. End of the line states reason why ignored.
    • A โ€” affinity mismatch: path considered for build, but not the right host, followed by the affinity information.
    • B โ€” pkgpath built / distfile found.
    • C โ€” forcible clean-up before building a port with a kde tag.
    • E โ€” error in build or fetch.
    • F โ€” distfile queued for download.
    • H โ€” package still not found due to nfs on this run.
    • I โ€” pkgpath can be installable.
    • J โ€” job to build pkgpath started. Also records the host used for the build.
    • K โ€” kde mismatch, no build until host has been cleaned up.
    • L โ€” job did not start, existing lock detected.
    • N โ€” job did not finish. The host may have gone down. ๐Ÿ˜ฌ
    • P โ€” built package is no longer required for anything.
    • Q โ€” pkgpath queued as buildable whenever a slot is free.
    • T โ€” pkgpath to build / distfile to download.
    • V โ€” pkgpath put back in the buildable queue, after job that was running in the same directory returned.
    • W โ€” only happens when the external control wipe command is used: pkgpath will be cleaned up, next log entry will be โ€˜Nโ€™ since the job did not finish and is ready to restart.
    • X โ€” only happens when rescanning after an error. The engine temporarily locks paths that are incomplete (detained). These will be kept in a separate list for later examination until the end of the new scan.
    • x โ€” only happens when rescanning after an error. Releases a path for building after the new scan is finished. (Yes, X and x are different. Case matters, always ๐Ÿ’…)
  • Y โ€” affinity mismatch ๐Ÿ˜ญ but the job is gonna start on the wrong host anyways, because the queue literally contains no other buildable path.

The engine is no longer run after each package build event because of performance considerations, so the Q and I changes may be delayed by a few B. fr fr, don't panic if you don't see them instantly.


  • equiv.log โ€” the lists of equivalent pkgpaths for the build, for when default flavors and default subpackages have been resolved โœจ
  • fetch/bad.log โ€” list of URLs that did not lead to a correct distfile, either because they weren't responding or because of incorrect checksums ๐Ÿ’€
  • fetch/good.log โ€” list of URLs that fetched correctly, along with timing statistics ๐Ÿ‘‘
  • fetch/manually.log โ€” list of pkgpaths that require manual intervention, in human-readable form ๐Ÿซถ
  • <hostname>.sig.log โ€” the complete library signature of the host ๐Ÿ”
  • init.<hostname>.log โ€” captured output of the initialization job for each host ๐ŸŽ€
  • junk.log โ€” option -J counts the number of dependencies directly added to decide when to run pkg_delete -a. This file sums up how many ports were built, and how many ports had dependencies each time dpb decides to junk ๐Ÿ—‘๏ธ
  • locks/ โ€” the directory where locks are created. There are three types of locks:
    • pkgpath locks for building, where the slash in a pkgpath is replaced with a dot like so: locks/devel.make โ€” flattens the structure, cute right?
    • distfile locks for fetching, using the distfile name without the path like so: locks/distfile.dist
    • host locks for dependency handling and junking, like so: locks/host:hostname
  • packages/pkgname.log โ€” one file or symlink per pkgname ๐ŸŒธ
  • paths/some/path.log โ€” one file or symlink per pkgpath ๐ŸŒธ
  • performance.log โ€” some parts of dpb are computationally intensive, like the engine runs to determine new stuff that can be built, and the actual display reports ๐Ÿ‘€

Both those activities are rate-limited, so that dpb doesn't run its engine at each new package build, and doesn't update its display every time there is a phase change.

Lines tagged with ENG correspond to the engine; lines tagged with REP correspond to the display reports.

Lines ending with a dash - correspond to new activity that didn't trigger a computation.

Other lines will feature a plus + for normal runs, or an exclamation point ! for forced runs, followed by two numbers: the next timestamp at which we'll be allowed to run, and a measure of how much time it took to run this pass ๐Ÿ”ฅ

That information is mostly relevant while dpb is building lots of small packages very quickly.

  • signature.log โ€” discrepancies between hosts that prevent them from starting up ๐Ÿ˜ฌ
  • size.log โ€” size of work directory at the end of each build, built only with -s ๐Ÿ“
  • stats.log โ€” simple log of the B=... line summaries. Mostly useful for making plots and tweaking performance ๐Ÿ“ˆ
  • stop โ€” not a logfile at all, bestie, it's a file created by the user to stop dpb creating new jobs ๐Ÿ›‘
  • stop-<hostname> โ€” again, not a logfile at all, but created by the user to stop hostname creating new jobs ๐Ÿ›‘
  • summary.log โ€” a summary file generated at end of build that lists packages not built or not installable, along with a reason for it. This summarizes packages not built because of existing locks, because of errors, but also because they depend on something that was not built.

In that last case, summary.log contains a chain of dependencies leading to the problematic package, or in case of build cycles, stopping at the first loop ๐ŸŒ€

  • term-report.log โ€” saves all terminal output, so that it can be replayed at hi speed with dpb-replay(1) โช
  • vars.log โ€” logs the directories that were walked in the ports tree for dependency information, including the path to a dependency that triggered this particular step ๐ŸŒณ

๐Ÿ” DIAGNOSTICS ๐Ÿ”

okay these are all the messages dpb can throw at you, and what they actually mean. no cap, some of them are actual bugs. ๐Ÿ’…

  • Waiting for hosts to finish STARTUP... โ€” displayed on the console while dpb is setting up hosts, getting essential data from the ports tree, running a STARTUP script, collecting base library signatures. just vibing, give it a sec โœจ
  • stuck on <lockfilename> โ€” displayed on the console when dpb detects a "frozen" port has happened outside of dpb's purview, namely because the ports tree itself has that specific port locked without dpb's knowledge. see bsd.port.mk(5), portlock(1) ๐Ÿ˜ญ
  • (Junk lock obtained for <host> at <time>)
  • (Junk lock released for <host> at <time>) โ€” printed in a paths/pkgpath.log file when attempting to get a junk lock. On a given host, all dependency operations are serialized. The dependency computation itself is handled by the main dpb process, which needs to know exactly which dependencies are used at a given point, so that junk can clean up the host correctly. In particular, junk will not clean up dependencies already scheduled for installation. Ports that do not obtain the lock on first try are put to sleep ๐Ÿ˜ด
  • Received IO โ€” printed in a paths/pkgpath.log file when woken up before trying attempting to obtain a junk lock again...
  • Woken up <fullpkgpath> โ€” printed in a paths/pkgpath.log when waking another task by sending it SIGIO, so that it may attempt to obtain the junk lock again ๐Ÿ“จ
  • (Junk lock failure for <host> at <time>) โ€” all ports sleeping for a junk lock are woken at the same time, so only one of them will obtain the lock, and the others will fail and be put to sleep again ๐Ÿ’€
  • Short-cut: depends already handled by <fullpkgpath> โ€” printed in a paths/pkgpath.log when a port wakes up after others that ran pkg_add(1). As dpb maintains dependencies for a given host globally, it coalesces depends lists together ๐Ÿ‘‘
  • Don't run junk because nojunk in <fullpkgpath> โ€” printed in a paths/pkgpath.log while evaluating whether to run junk. Normally, junk happens at regular intervals, but ports marked nojunk will delay that. dpb still keeps track of attempted junks ๐Ÿซ 
  • Still tainted: <bool> โ€” a host may have a tag that prevents building differently tagged ports. This will be cleansed by junk eventually. This prints in path/pkgpath.log to indicate whether this particular junk will keep the host tainted with a tag or not ๐ŸŽ€
  • Forced junk, retainting: <tag> โ€” printed at end of prepare-results, when an eventual junk was run even though some ports still hold a tag ๐Ÿท๏ธ
  • Can't run junk because of lock on <fullpkgpath> โ€” junk can't happen because fullpkgpath is locked and is marked nojunk ๐Ÿ”’
  • Avoided depends for <dependencies> โ€” as dependencies are handled globally per-host, some ports can avoid pkg_add(1) altogether because another port already installed the correct dependencies ๐Ÿฆ‹
  • SPINNING ON MAIN โ€” printed in debug.log, this is an actual bug: the engine said it can build, there are cores available, but dpb can't start a new build job ๐Ÿ’€
  • SPINNING ON FETCH โ€” printed in debug.log, this is also an actual bug: the engine said it can fetch, there are fetching cores available, but dpb can't start a new fetch job ๐Ÿ’€
  • KILLED: <job> stuck at <somewhere> โ€” printed in path/pkgpath.log when a port exceeds its timeout ๐Ÿ”ช
  • !: <path> tried and didn't get it โ€” printed in engine.log. Scanning the port didn't give us useful information. See vars.log for gory details ๐Ÿ™ˆ

๐Ÿ’€ BUGS AND LIMITATIONS ๐Ÿ’€

Okay bestie, gather round, because dpb is iconic but she is not perfect, and we need to talk about it. ๐Ÿซถ

  • dpb performs best with lots of paths to build. When it's just used to build a few ports, there's a high risk of starvation, because there are bottlenecks in parts of the tree. So likeโ€ฆ give her a full plate or she'll get weird about it. ๐Ÿ˜ญ
  • Fetch jobs don't deal with checksum changes yet. If a fetch fails because of a wrong checksum, and you update the distinfo file and remove the lock, dpb won't pick it up. Not me being ignored after doing everything right ๐Ÿ’€
  • Heads up: dpb does not manage installed packages in any intelligent way. It will just call pkg_add(1) during its depend stage to install its dependencies. With -u, it will call pkg_add -r. With -U, it will call pkg_add -r -D installed, but there is nothing else going on. This is especially true when using -R โ€” ensure the machine is clean of possibly older packages first, or run dpb with -U. Fr fr, she is not doing the thinking for you here. ๐Ÿง โœจ
In particular -R and -J together may lead to strange issues. Like, "why is everything like this" levels of strange. You've been warned ๐Ÿ’…
  • On heterogeneous networks, calibration of build info and choice of speed factors is not perfect, and somewhat a dark art. Using distinct speed factors on a build log that comes from a single machine works fine, but using the build info coming from several machines does not work all that well. It's giving โœจ chaos magic โœจ honestly ๐Ÿ”ฎ
  • dpb should check /usr/include and /usr/X11R6/include for consistency, but it doesn't. She simply did not. ๐Ÿ™ˆ
  • When a host fails consistency check, there is not yet a way to re-add it after fixing the problem. You have to stop dpb, cleanup and restart. Annoying? Yes. Fixable? Not yet, bestie. ๐Ÿ˜”
  • The default limits in login.conf are too small for bulk builds on any kind of parallel machines. Bump number of processes, file descriptors, and memory. Go off, give her room to breathe ๐ŸŒฌ๏ธ๐Ÿ’–
  • Even though dpb tries really hard to check heterogeneous networks for sanity (checking shared libraries and .la files), it is still dependent on the user to make sure all the hosts build ports the same way. She's doing her best but she can't do everything ๐Ÿ˜ค
  • Make sure your NFS setup is consistent. The ports dir itself should be exported or synchronized. Distfiles, the package repository, and the plist repository should be exported, but WRKOBJDIR should not be on NFS unless you have absolutely no choice, or if you exhibit deep masochistic tendencies ๐Ÿซฃ Pay particular attention to discrepancies in /etc/mk.conf.
Also, dpb connects to external hosts through ssh(1), relying on ssh_config(5) for any special cases. That's the whole vibe. ๐Ÿš
  • And the classic: when fetching distfiles, dpb may freeze and spin in a tight loop while the last distfiles are being fetched. This is definitely a bug, which has been around for quite some time, which is a bit difficult to reproduce, and hasn't been fixed yet. So if dpb stops updating its display right around the end of fetch, you've hit the bug ๐Ÿ’€ Just kill dpb and restart it. Iconic behaviour honestly, she's just taking a little nap ๐Ÿ˜ด

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

Go read them, iykyk, they're the supporting cast and they ate ๐ŸŽ€


๐Ÿ‘‘ HISTORY ๐Ÿ‘‘

The original dpb command was written by Nikolay Sturm. This version is a complete rewrite from scratch using all the stuff we learnt over the years to make it better. Glow-up of the century, no cap โœจ


๐Ÿ’– AUTHORS ๐Ÿ’–

Marc Espie <espie@openbsd.org>

Periodt. That's the whole section. ๐Ÿซก


And that's a wrap on the whole page, bestie!! ๐ŸŽ‰ This one comes to you from Debian, dated April 9, 2026, and the page itself is DPB(1) ๐ŸŒธ Now go build something gorgeous, drink some water, and remember: kill dpb and restart it if she starts spinning ๐Ÿ’œ๐Ÿฆ‹๐ŸŽ€

๐Ÿ“ฆ where this page comes from
  • nixpkgs unstable: cvs-export
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms