xref: /openbsd-src/share/man/man1/dpb.1 (revision ff0e7be1ebbcc809ea8ad2b6dafe215824da9e46)
1.\"	$OpenBSD: dpb.1,v 1.33 2023/05/29 21:13:24 aisha Exp $
2.\"
3.\" Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: May 29 2023 $
18.Dt DPB 1
19.Os
20.Sh NAME
21.Nm dpb
22.Nd distributed ports builder
23.Sh SYNOPSIS
24.Nm dpb
25.Op Fl acemqRrsUuvx
26.Op Fl A Ar arch
27.Op Fl B Ar chroot
28.Op Fl b Ar logfile
29.Op Fl C Ar pathlist
30.Op Fl D Ar PARAM Ns = Ns Ar value
31.Op Fl F Ar m
32.Op Fl f Ar m
33.Op Fl h Ar hosts
34.Op Fl I Ar pathlist
35.Op Fl J Ar p
36.Op Fl j Ar n
37.Op Fl L Ar logdir
38.Op Fl l Ar lockdir
39.Op Fl M Ar threshold
40.Op Fl P Ar pathlist
41.Op Fl p Ar parallel
42.Op Fl S Ar logfile
43.Op Fl X Ar pathlist
44.Op Ar pathlist ...
45.Sh DESCRIPTION
46.Nm
47is used to build ports on a cluster of machines, or on a single machine
48with several cores.
49.Nm
50walks the ports tree to figure out dependencies, and starts building ports
51as soon as it can.
52.Pp
53.Nm
54will run with sensible defaults if used without options.
55Note, however, that it will produce logs, lock files, packages, and package
56installations.
57.Pp
58If run as non-root,
59.Nm
60will warn.
61The preferred way is to run it as root (and preferably under a chroot, see
62.Xr bulk 8
63and
64.Xr proot 1
65for example setups).
66.Nm
67will then change its identity to different users as needed.
68See
69.Sx THE SECURITY MODEL OF DPB
70for details.
71.Pp
72.Nm
73can be restricted to a subset of the tree by giving it
74.Ar pathlist ...
75to build as parameters.
76.Pp
77A
78.Ar pathlist
79is either a
80.Xr pkgpath 7
81to build, or a filename that contains pkgpaths (one per line).
82.Ar pathlist
83parameters can also take the form
84.Li filename*scale
85in order to multiply the weights of all
86.Xr pkgpath 7
87in a file by a given
88.Ar scale ,
89or
90.Li pkgpath=value ,
91in order to set the weight of a given
92.Xr pkgpath 7
93to a specific value.
94.Pp
95.Nm
96supports
97.Sq hot-fixes :
98if a particular port errors out, it is possible to fix the problem, remove
99the corresponding lockfile, and
100.Nm
101will pick it up without needing to be stopped and restarted.
102.Pp
103In order to build on a cluster, the ports tree itself should be identical
104on each machine (shared through NFS or copied at start).
105.Pp
106Some directories must be shared:
107.Ev PACKAGE_REPOSITORY ,
108.Ev DISTDIR ,
109and
110.Ev PLIST_REPOSITORY .
111The
112.Ev WRKOBJDIR
113and
114.Ev LOCKDIR
115should be local to each machine, and on a high-speed partition.
116.Pp
117Also note that
118.Nm Ns 's
119logs and locks are managed by the main
120.Nm
121process, which runs locally, and hence those directories do not need to
122be shared on the cluster.
123.Pp
124Some log files ("rolling logs") are kept from one run to the run and
125stored under
126.Pa ${DISTDIR}/build-stats .
127.Pp
128Option
129.Fl h Ar file
130is used to specify hosts to use, where
131.Ar file
132may contain lots of information,
133but can be as simple as a list of hosts to use, one host per line
134(however, it is recommended to also include a
135.Ar STARTUP
136script).
137.Pp
138Most filenames will go through some control sequence expansions.
139For instance, the default logdir location can be specified as
140.Pa %p/logs/%a .
141The following sequences are recognized:
142.Bl -tag -offset aaaa -width %aa
143.It Cm %a
144architecture being used.
145.It Cm %d
146date at start of
147.Nm ,
148GMtime, formatted as yyyy-mm-dd@hh:mm:ss.
149.It Cm %f
150fetch distfiles location (DISTDIR).
151.It Cm %h
152short hostname running
153.Nm .
154.It Cm %L
155logdir location.
156.It Cm %p
157portsdir location.
158.It Cm %t
159timestamp (number of seconds since January 1 1970) at start of
160.Nm .
161.It Cm %$
162Pid of the main
163.Nm
164process .
165.El
166.Pp
167Options are as follows:
168.Bl -tag -width pkgpathlong
169.It Fl A Ar arch
170Build packages for given architecture, selecting relevant hosts from the
171cluster.
172By default, the current host's architecture will be used.
173.It Fl a
174Walk the whole tree and builds all packages (default if no
175.Ar pathlist
176is given).
177.It Fl B Ar chroot
178chroot to
179.Ar chroot
180before building.
181See
182.Xr proot 1
183for preparing such an environment.
184.It Fl b Ar logfile
185Explicitly prime the heuristics module with a previous build log,
186so that packages that take a long time to build will happen earlier.
187The rolling log under
188.Pa %f/build-stats/%a
189is automatically used.
190.It Fl C Ar pathlist
191Don't clean port working directories after build.
192Only use simple
193.Xr pkgpath 7
194in the list,
195as this does not take subpackages and flavors into account.
196.It Fl c
197Clean port working directory and log before each build.
198.It Fl D Ar PARAM Ns = Ns Ar value
199Set defined parameter to value.
200Known parameters are as follows:
201.Bl -tag -width DISP
202.It Ar ALWAYS_CLEAN
203Set to 1 if
204.Nm
205should clean work directories even if the port errored out.
206.It Ar BUILD_USER
207Default value for
208.Ar build_user
209if you want to specify it on the command line, and want to ensure even
210the small "discover PORTSDIR" activity at the beginning of
211.Nm
212is not run as root.
213.It Ar COLOR
214Set to 1 to have the normal display in color.
215.It Ar CONNECTION_TIMEOUT
216Connection timeout for ssh.
217Defaults to 10 seconds (but ssh will retry 3 times).
218.It Ar CONTROL
219Let
220.Nm
221create a unix socket of the given name for external control.
222Defaults to
223.Sq %L/control-%h-%$ .
224If no socket is wanted, explicitly set
225.Ar CONTROL
226to empty.
227.It Ar DISPLAY_TIMEOUT
228Display timeout (in seconds) while waiting for jobs to finish, so that the
229display is updated even if jobs didn't finish.
230Defaults to 10 seconds.
231.It Ar DONT_BUILD_ONCE
232By default,
233.Nm
234will use the
235.Ev BUILD_ONCE
236optimization
237.Po
238see
239.Xr bsd.port.mk 5
240.Pc
241if run with
242.Fl a :
243pseudo-flavors that disable subpackages and are not necessary for bootstrap
244will be disabled, so that the same port is built once, as far as possible.
245This flag disables that optimization, which might be desirable if you want
246to build a small subset of packages which would pull in the kitchen sink
247otherwise.
248.It Ar DONT_CLEAN_LOCKS
249By default,
250.Nm
251will clean old locks from dpb running on the same host that no longer exist,
252provided they didn't end in error.
253This is usually the right thing to do after a crash, or after killing dpb
254abruptly.
255Sometimes, one may want manual control over which locks to remove.
256.It Ar FETCH_JOBS
257Alternate way to specify the number of fetch jobs.
258.It Ar FETCH_TIMEOUT
259Timeout (in seconds) after which fetches that don't show
260any progress will be killed.
261This can be instead set in
262.Ar DEFAULT
263or
264.Ar localhost
265as the
266.Sq fetch_timeout
267property.
268.It Ar FETCH_CMD
269Override for the default
270.Ar FETCH_CMD
271coming from ports.
272This might be useful because fetching isn't chroot'd
273and is run as ${FETCH_USER}.
274.It Ar FETCH_USER
275User for all fetch activities if possible
276.Po defaults to
277.Ar _pfetch
278.Pc .
279.It Ar FTP_ONLY
280Don't fetch distfiles/don't build packages that are not allowed for ftp.
281.It Ar HISTORY_ONLY
282Don't fetch or build anything.
283Only run
284.Nm
285to figure out old distfiles and update
286.Pa %f/history .
287.It Ar LISTING_EXTRA
288Alternate way to specify
289.Fl e .
290.It Ar LOCKDIR
291Alternate way to specify the locking directory.
292.It Ar LOGDIR
293Alternate way to specify the logging directory.
294.It Ar LOG_USER
295User
296for all log files if possible
297.Po defaults to
298.Ar build_user
299.Pc .
300.It Ar MIRROR
301Applicable to fetch modes.
302If 0, will only fetch normal
303.Ev DISTFILES
304.Po
305default for
306.Nm Fl f
307.Pc .
308If 1, will also fetch extra
309.Ev SUPDISTFILES
310.Po
311default for
312.Nm Fl F
313.Pc .
314.It Ar NEVER_CLEAN
315If 1,
316.Nm
317will never clean any work directory after build.
318.It Ar NO_BUILD_STATS
319Disable reading/saving of default build stats under
320.Pa ${DISTDIR}/build-stats/${ARCH} .
321.It Ar NO_CHECKSUM
322Do not run
323.Ar checksum
324again for files already fetched.
325.It Ar NO_CURSOR
326Make the terminal cursor invisible if possible.
327Avoids flickering on slow graphics cards.
328.It Ar NO_HISTORY
329Do not update the distfiles history.
330For instance, if
331.Nm
332is run a second time after a problem during the first run.
333.It Ar NO_QUICK_SCAN
334Disable the quick scan default heuristic,
335where full bulks will start by scanning the most prominent ports
336in former builds.
337.It Ar PORT_USER
338User that can write to the ports tree.
339Not really used for anything yet.
340.It Ar RECORD
341Define a file which will save all terminal output.
342Mostly useful for presentations, as a way to save
343.Nm dpb
344output and replay it later at a faster rate.
345Defaults to
346.Pa %L/term-report.log ,
347can be set to nothing to disable.
348.It Ar STARTUP
349Define a start-up script on the command-line, override any host file contents.
350.It Ar STUCK_TIMEOUT
351Timeout (in seconds * speed factor) after which tasks that don't show
352any progress will be killed.
353This can be instead set on a per-core basis as the
354.Sq stuck
355property.
356Note that this will always be divided by the core's speed factor.
357.It Ar SYSLOG
358Make
359.Nm
360call
361.Xr syslog 3
362on every task start/end while creating packages.
363This does produce lots of messages, it is intended to route the logging
364on another machine, while tracking down panics and other hangs.
365.It Ar WANTSIZE
366Alternate way to specify
367.Fl s .
368.El
369.It Fl e
370The listing job is extra and won't be given back to the pool when it's
371finished.
372.It Fl F Ar m
373Fetch-only mode, for mirroring hosts.
374Do not build any package but fetch everything, disregarding
375.Ev BROKEN
376and
377.Ev ONLY_FOR_ARCHS
378information.
379Create
380.Ar m
381localhost jobs for fetching files.
382.It Fl f Ar m
383Create
384.Ar m
385jobs for fetching files.
386Those are separate from the build jobs, since they don't consume cpu, and they
387run on the localhost.
388Defaults to 2.
389Can be set to 0 to bypass fetching jobs entirely,
390and reduce
391.Nm
392memory footprint by a lot.
393.It Fl h Ar hosts
394File with hosts to use for building.
395One host per line, plus properties, such as:
396.Bd -literal -offset indent
397espie@aeryn jobs=4 arch=i386
398.Ed
399.Pp
400Lines starting with a known variable name such as
401.Bd -literal -offset indent
402STARTUP=path
403.Ed
404or
405.Bd -literal -offset indent
406FETCH_JOBS=5
407.Ed
408can also be set inside a configuration file, to reduce the number of
409options you must pass on the command line.
410.Pp
411The special hostname
412.Ar DEFAULT
413can be used to preset defaults.
414It should be used at the start of the file.
415.Pp
416Use
417.Ar localhost
418to specify the local machine.
419.Nm
420will special-case it and not use
421.Xr ssh 1
422to connect.
423.Pp
424Properties are as follows:
425.Bl -tag -width memory=150
426.It always_clean=n
427Set to 0 or 1 on per-host basis.
428See
429.Ar ALWAYS_CLEAN
430parameter.
431.It arch=value
432Architecture of the concerned host.
433(there should be a startup task to check consistency, but
434currently this has to be set manually on heterogeneous networks.)
435.It build_user=user
436Use
437.Ar user
438for non root jobs if possible (defaults to
439.Xr whoami 1
440value).
441.It chroot=dir
442Chroot to
443.Ar dir
444before building.
445.It fetch_timeout=s
446Timeout (in seconds) after which fetches that don't show
447any progress will be killed.
448Only makes sense for
449.Ar DEFAULT
450or
451.Ar localhost .
452.It jobs=n
453Number of jobs to run on that host, defaults to hw.ncpuonline.
454.It junk=n
455Junk unused packages each n steps.
456See
457.Fl J
458option.
459.It memory=thr
460Build everything below that wrkdir threshold with
461.Ev USE_MFS Ns = Ns Sq Yes ,
462assuming the ports tree has been configured so that
463.Ev WRKOBJDIR_MFS
464points to a memory filesystem.
465.Ar thr
466is the sum, in KBytes, of ports that will be allowed to build in memory.
467.Nm
468understands suffixes, such as
469.Fl M Ar 2G
470or
471.Fl M Ar 500M .
472.Pp
473Note that you should always allow for some margin, as
474.Nm
475makes its decision based on the size information collected during previous
476builds, so in cases of significant updates, the work directory size will
477usually grow.
478.It nochecksum=0/1
479Defaults to 1.
480During the junk stage, run
481.Xr pkg_delete 1
482with the
483.Fl q
484(no checksum) option.
485.It parallel=p
486Run big ports on several cores.
487See
488.Fl p
489option.
490.It parallel2=p
491Run largest ports on many cores.
492Defaults to the same value as the parallel option, but can be increased for,
493say, chromium.
494.It repair=0/1
495Defaults to 1.
496Run
497.Xr pkg_add 1
498with the repair option.
499This is useful on some bulk machines which tend to crash a lot, leaving
500.Pa /var/db/pkg
501in a weird state.
502.It sf=n
503Speed factor.
504An estimate of that machine's speed with that number of jobs
505compared to other machines in the same network.
506Works better with small values, in the range of 1..50.
507The machine (or machines) with the highest speed factor will
508get access to all jobs, whereas other machines will be clamped
509to stuff which does not take too long.
510Requires previous build information to be effective.
511Defaults to 1.
512.It small=s
513Small threshold (in seconds * sf):
514ports known to build under that duration are deemed to be small, so
515.Nm
516won't bother calling fine-grained steps for patch/configure/fake.
517It will go straight to build and package instead.
518Defaults to 120 seconds.
519.It squiggles=n
520Number of squiggles on this host (see
521.Sx THE SQUIGGLE HEURISTICS
522below).
523Defaults to 1 squiggle for hosts with 4 jobs or more, 0.7 for hosts with more than 1 job,
5240 for single job hosts.
525.It stuck=s
526Stuck timeout (in seconds * sf) after which tasks which show no progress
527will get killed.
528.It timeout=s
529Defines a specific connection timeout for ssh to that host.
530.El
531.Pp
532There are no fine-grained options to control
533.Xr ssh 1
534options, as those can be specified through virtual host declarations in
535.Xr ssh_config 5 .
536.It Fl I Ar pathlist
537List of
538.Xr pkgpath 7
539to install, on the local box.
540This will also add them to the list of things to build.
541.It Fl J Ar p
542Override value for the
543.Dq junk
544property.
545Delete unneeded installed packages during the build.
546Each
547.Ar prepare
548stage is followed by a
549.Ar show-prepare-results
550stage.
551After every
552.Ar p
553new dependencies, it will be followed by a
554.Ar junk
555stage which uses
556.Xr pkg_delete 1
557with the
558.Fl aXI
559options to delete automatically installed packages that are currently
560not needed.
561.Pp
562.Nm
563keeps track of list of dependencies on a given host, by storing each
564dependency list in the lockfile corresponding to the package being built.
565.Pp
566To avoid a race condition between the
567.Ar depends
568and
569.Ar junk
570stages,
571.Nm
572allows only one job on a given host to be in the
573.Ar depends
574\&...
575.Ar junk
576stages at one time, by using a per-host lock.
577.Pp
578Defaults to
579.Ar 150 .
580Can be disabled by setting to
581.Ar 0 .
582.Pp
583Some ports, most notably cmake-based, have an annoying dependency handling
584bug: they compute their makefile dependencies based on all include files
585present, not just the ones that are actually enabled.
586Those ports' build may be broken by a
587.Ar junk
588phase that removes some unused includes that were added as makefile
589prerequisites.
590Those ports should be annotated with
591DPB_PROPERTIES = nojunk
592until that bug is fixed:
593while a port with the
594.Sq nojunk
595property is building,
596.Ar junk
597will be postponed.
598.Pp
599Those ports will be marked with a
600.Sq \&!
601in the display, to make it more obvious why junk seems to be ineffective.
602.Pp
603Note that the
604.Sq nojunk
605property is still active for ports in error, in the belief that trivial fixes
606can be made that will allow the port build to finish.
607.It Fl j Ar n
608Number of jobs to run on a single host (defaults to hw.ncpuonline).
609.It Fl L Ar logdir
610Choose a log directory.
611.Po
612Defaults to
613.Pa %p/logs/%a
614.Pc .
615.It Fl l Ar lockdir
616Choose a lock directory.
617.Po
618Defaults to
619.Pa %L/locks
620.Pc .
621Override to keep local, as locks don't really like NFS.
622.It Fl M Ar threshold
623Build ports below the memory threshold under a memory
624filesystem, as configured through
625.Ev WRKOBJDIR_MFS
626.Po
627see
628.Xr bsd.port.mk 5
629.Pc .
630.Ar threshold
631is the sum, in KBytes, of ports allowed to build there.
632.It Fl m
633Force tty-style reporting.
634.It Fl P Ar pathlist
635Read list of
636.Xr pkgpath 7
637from file.
638.It Fl p Ar parallel
639Override value for the
640.Dq parallel
641property.
642.Pp
643Run big jobs on several cores on the same host, by using
644MAKE_JOBS=k.
645.Pp
646Once such a job has started,
647.Nm
648will not start new jobs on the same host until the big job has
649stolen enough cores from other finishing jobs.
650.Pp
651Only big ports which are safe for parallel building (annotated with
652DPB_PROPERTIES = parallel in their Makefile) will be affected.
653.Pp
654It is advisable to set k to an integral fraction of the
655number of cores available on a given host.
656.Ar parameter
657can be an integer, or of the form
658.Sq /n ,
659in which case,
660.Nm
661will set k to a fraction of the total number of jobs
662on the machine, but never below 2.
663.Pp
664Defaults to
665.Sq /2 .
666.It Fl q
667Don't quit while errors/locks are around.
668.It Fl R
669Rebuild existing packages based on discrepancies between the package
670signature and what the port says it should be.
671Concretely, use to run a partial bulk build after some library change.
672.Pp
673Note that
674.Fl R
675won't always work, as rebuilding a package when another version is already
676installed is not supported.
677Building in a chroot is strongly recommended.
678.It Fl r
679Random build order.
680Disregard any kind of smart heuristics.
681Useful to try to find missing build dependencies.
682.It Fl S Ar logfile
683Read
684.Ar logfile
685as an initial workdir size log.
686.It Fl s
687Compute workdir sizes before cleaning up, and stash them in log file
688.Pa %L/size.log .
689Also maintain a rolling log of build sizes under
690.Pa %f/build-stats/%a-size .
691In order to save time,
692.Nm
693will actually not always compute new sizes for known directories, but mostly
694for new ones, or when the package name changes.
695.It Fl U
696Insist on updating existing packages during dependency solving,
697even if the new package apparently didn't change.
698.It Fl u
699Update existing packages during dependency solving.
700Can be used to run a bulk-build on a machine with installed packages,
701but might break a bit, since some packages only build on a clean machine
702right now.
703.It Fl X Ar pathlist
704Read a list of
705.Xr pkgpath 7
706from file, and pass them along in the junk phase:
707those are packages that should stay on the machine if they've been
708installed by a dependency.
709Can be used to avoid endlessly removing/reinstalling the most common
710packages, e.g.,
711.Pa devel/gmake .
712.It Fl x
713No tty report, only report really important things, like hosts going down
714and coming back up, build errors, or builds not progressing.
715.El
716.Pp
717.Nm
718figures out in which order to build things on the fly, and constantly
719displays information relative to what's currently building.
720There's a list of what is currently running, one line per job.
721Those jobs are ordered in strict chronological order, which means that
722long running builds will tend to percolate to the top of the list.
723Normal jobs look like this:
724.Bd -literal -offset indent
725www/mozilla-firefox(build) [9452] 41% unchanged for 92 seconds
726.Ed
727.Pp
728This contains:
729.Bl -dash
730.It
731an optional
732.Sq ~
733squiggle marker (see below),
734.It
735the pkgpath being built,
736.It
737the step currently being run,
738.It
739an optional
740.Sq \&!
741for ports with the
742.Sq nojunk
743property.
744.It
745an optional
746.Sq +
747for ports built in memory.
748.It
749the pid running that task (note that this is always a pid on the host
750running dpb: for distributed builds, it will be an
751.Xr ssh 1
752to another machine),
753.It
754the current size of the log file (displayed as a percentage if previous
755build statistics are available).
756.It
757and a possible notice that things might be stuck when
758the log file doesn't change for long periods.
759.El
760.Pp
761And fetch jobs look like this:
762.Bd -literal -offset indent
763<dist-3.0.tgz(#1) [4321] 25%
764.Ed
765.Pp
766This contains:
767.Bl -dash
768.It
769the file being fetched
770.It
771the number of the
772.Ev MASTER_SITE
773being tried
774.It
775the pid of the
776.Xr ftp 1
777process (note that fetch jobs are always local).
778.It
779a progress percentage.
780.El
781.Pp
782This is followed by a host line, containing the name
783of each host used by dpb.
784Host names may be tagged with kde3 or kde4.
785They are followed by a
786.Sq `-'
787for unresponsive hosts, and the pid of the ssh master
788for distant hosts.
789.Pp
790This ends with a summary display:
791.Bl -tag -width BB=
792.It I=
793number of built packages that can be installed.
794.It B=
795number of built packages, not yet known to be installable,
796because of run depends that still need to be built.
797.It Q=
798number of packages in the queue, e.g., stuff that can be built now, assuming
799we have a free slot.
800.It T=
801number of packages to build, where dependencies are not yet resolved.
802.It F=
803number of distfiles to fetch, when
804.Fl f
805is used.
806.It !=
807number of ignored packages.
808Details in
809.Pa engine.log .
810.It L=
811list of packages that cannot currently be built because of locks.
812.It E=
813list of packages in error, that cannot currently be built.
814.It H=
815list of packages that haven't shown up yet, usually due to nfs, but
816watch out for revision bumps.
817.El
818.Pp
819If those three lists are empty, they won't even show up.
820Packages in errors may be followed by a
821.Sq \&!
822if they prevent junk from happening.
823.Pp
824Note that those numbers refer to pkgpaths known to
825.Nm .
826In general, those numbers will be slightly higher than the actual number
827of packages being built, since several paths may lead to the same package.
828.Pp
829.Nm
830uses some heuristics to try to maximise the queue as soon as possible.
831There are also provisions for a feedback-directed build, where information from
832previous builds can be used to try to build long-running jobs first.
833.Pp
834Similarly, fetches will use the continue option of
835.Xr ftp 1 ,
836since distfiles are checksummed after the fetch anyways.
837.Ss THE SQUIGGLE HEURISTICS
838However, on machines with lots of cores, the basic scheduling heuristics
839yields a tail of very small jobs, where
840.Nm
841will mostly wait on
842.Xr pkg_add 1
843to solve dependencies.
844Starting with
845.Ox 5.5 ,
846a new mechanism (squiggles) was introduced to counter-balance this effect:
847big machines devote some of their cores to
848.Sq squiggles ,
849jobs that walk the queue in reverse, thus building smallest ports first.
850As a result, small ports are built as a trickle alongside the largest ports,
851thus offsetting the negative effect of the exponential queue for a large part.
852.Pp
853Note that
854.Sq squiggles
855can be a non-integral value, usually lower than 1, in which case they
856represent the fraction of cores that should be affected to squiggles,
857as decided randomly at the start of each build.
8580.7 or 0.8 might be a good choice for dual core machines.
859.Ss DPB PROPERTIES
860The
861.Xr bsd.port.mk 5
862variable
863.Ev DPB_PROPERTIES
864may hold several annotations that only
865.Nm
866will look at.
867These properties are as follows:
868.Bl -tag -width pkgpathlong
869.It Ar lonesome
870Large port that stresses the memory limits of the machine, should be built
871alone.
872Prevents
873.Nm
874from scheduling anything else on the same host after it starts building.
875.\".It Ar memoryhog
876.It Ar noconfigurejunk
877Port that looks for unneeded dependencies during its configure phase
878(typically, optional tools like doxygen to rebuild documentation).
879Similar to
880.Ar nojunk
881but less expensive, since the configure phase is most often limited in scope.
882.It Ar nojunk
883Port that hardcodes includes in its Makefile mechanisms.
884Prevents
885.Ar junk
886from running while port is building.
887.It Ar parallel
888Port that can be built in parallel, uses
889.Ev MAKE_JOBS
890and several build slots.
891.It Ar parallel2
892Very large port that should be built in parallel, uses
893.Ev MAKE_JOBS
894and lots of build slots.
895.It Ar tag:kde3
896kde3 port that conflicts with kde4 ports.
897Prevent scheduling ports with
898.Ar tag:kde4
899on the same host.
900.It Ar tag:kde4
901kde4 port that conflicts with kde3 ports.
902Prevent scheduling ports with
903.Ar tag:kde3
904on the same host.
905.El
906.Sh THE SECURITY MODEL OF DPB
907When
908.Nm
909is run as root, it uses a privilege drop model instead of the
910dangerous privilege elevation model of
911.Xr doas 1 .
912When run as root, by default,
913.Ar _pbuild
914is used as the build and log user, and
915.Ar _pfetch
916is used as the fetch user.
917.Bl -bullet
918.It
919Start
920.Nm
921as root.
922.It
923.Nm
924will drop privileges for every operation except
925.Xr pkg_add 1 ,
926.Xr pkg_delete 1
927and the
928.Ar STARTUP
929script.
930.It
931For cluster builds,
932provide an
933.Xr ssh 1
934connection to distant hosts from root as root.
935.It
936.Ar build_user
937is used to build stuff locally or distantly (can be per-host), using:
938.Li chroot -u build_user /build_root
939(with
940.Pa /build_root
941=
942.Pa /
943if there is no actual chroot needed).
944It must have read access to ${DISTDIR} and ${PORTSDIR}, and write
945access to ${WRKOBJDIR}, ${PACKAGE_REPOSITORY}, and ${PLIST_REPOSITORY}.
946It does not require network access.
947.It
948.Ar LOG_USER
949is used to open all log files.
950.Ar LOG_USER
951only needs to exist locally.
952It needs write access to the log directories, including
953${DISTDIR}/build-stats.
954It does not need network access.
955.It
956.Ar FETCH_USER
957is used to fetch distfiles and handle corresponding log info.
958It needs write access to ${DISTDIR}, and network access.
959Thus,
960.Xr ftp 1
961does not happen as root.
962.It
963.Ar _dpb
964is used as a fail-safe for any other activities that do not require any rights.
965.It
966.Nm
967creates local directories as root, then gives them to the appropriate user.
968.El
969.Sh LOCKS AND ERRORS
970.Nm
971still uses the normal ports tree mechanism while building, which includes
972.Ev LOCKDIR .
973When starting up
974.Nm
975will normally detect stale locks from old dpb runs, and remove them.
976If this does not happen, builds will stay stuck in their initial stage,
977that is:
978.Ar show-prepare-results , patch , build
979depending on the port.
980A telltale message
981.Sq Awaiting lock ...
982can be found in the corresponding logfile
983.Pa paths/pkgpath.log
984.Pp
985In addition, when building a package,
986.Nm
987produces a lockfile in the locks directory, whose name is deduced from
988the basic pkgpath with slashes replaced by dots.
989This lockfile is filled with such info as the build start time or the host,
990or the needed dependencies for this pkgpath.
991.Pp
992The lockfile will also contain the name of a parent pkgpath, for paths that
993were discovered as dependencies.
994This is particularly useful for bogus paths, where it would be hard to
995know where the path came from otherwise.
996.Pp
997At the end of a successful build, these lockfiles are removed.
998The lock will stay around in case of errors.
999.Po
1000raw
1001value from
1002.Xr wait 2
1003.Pc ,
1004and the name of the next task in the build pipeline (with todo=<nothing>
1005in case of failure during clean-up).
1006Normal list of tasks is:
1007.Ar depends prepare fetch patch configure build fake package clean .
1008.Pp
1009At the end of each job,
1010.Nm
1011rechecks the locks directory for existing lockfiles.
1012If some locks have vanished,
1013it will put the corresponding paths back in the queue and attempt
1014another build.
1015.Pp
1016This eases manual repairs: if a package does not build, the user can look
1017at the log, go to the port directory, fix the problem, and then remove the lock.
1018.Nm
1019will pick up the ball and keep building without interruption.
1020.Pp
1021It is perfectly safe to run several
1022.Nm
1023in parallel on the same machine.
1024This is not optimal, since each
1025.Nm
1026ignores the others, and only uses the lock info to avoid the other's
1027current work, but it can be handy: in an emergency, one can start a second
1028.Nm
1029to obtain a specific package right now, in parallel with the original
1030.Nm .
1031.Pp
1032Note that
1033.Nm
1034is very careful not to run two builds from the same pkgpath at the
1035same time, even on different machines:
1036in some cases, MULTI_PACKAGES and FLAVOR combinations may lead to the
1037same package being built simultaneously, and since the package repository
1038is shared, this can easily lead to trouble.
1039.Pp
1040Handling of shared log files and history is also done very carefully by
1041systematically appending to files or using atomic mv operations.
1042.Pp
1043For obvious reasons, this won't work as well with masters running on distinct
1044machines sharing their logs through NFS.
1045.Ss BUILD CYCLES
1046There are some various interdependencies in package builds that can be hard
1047to trace in case something goes wrong.
1048Refer to
1049.Pa summary.log
1050to fix those specific issues.
1051.Sh AFFINITY
1052.Nm
1053now maintains a list of pkgpath-per-host that are currently building in the
1054.Pa affinity
1055directory of its log directory, along with building-in-memory status.
1056.Pp
1057That information is only wiped out when a given build finishes successfully.
1058.Pp
1059Otherwise
1060.Nm
1061will try to restart that build on the same host, which can be handy if you
1062interrupt
1063.Nm
1064while it is building a large port, or if you remove a lock after fixing a
1065problem.
1066.Sh TAGS FOR EXCLUSIVE BUILDS
1067Back when we had kde3 and kde4, they couldn't be built simultaneously,
1068and a single host had to be exclusively building kde3 or kde4 ports at
1069a given moment.
1070.Pp
1071Conflicting ports had been annotated with
1072.Ev DPB_PROPERTIES Ns = Ns Ar tag:kde3 ,
1073.Ev DPB_PROPERTIES Ns = Ns Ar tag:kde4
1074respectively.
1075.Pp
1076More generally, with
1077.Ev DPB_PROPERTIES Ns = Ns Ar tag:A ,
1078.Ev DPB_PROPERTIES Ns = Ns Ar tag:B ,
1079.Nm
1080will keep track of tags.
1081For instance, if host
1082.Ar X
1083is building ports tagged with
1084.Ar A ,
1085then any port with tag
1086.Ar B
1087will be prevented from building on
1088.Ar X
1089until the next
1090.Ar junk
1091phase.
1092.Pp
1093This heavily relies on the
1094.Ar junk
1095stage to clean-up hosts periodically,
1096and it can even forcibly provoke a
1097.Ar junk
1098stage even if junk=0.
1099.Pp
1100This
1101.Sq force-junk
1102stage is actually implemented as a pseudo path called
1103.Ar junk-proxy ,
1104which does only junk.
1105.Pp
1106In order for builds to proceed gracefully, machines should start
1107in a clean slate, without any of the problematic ports installed.
1108.Pp
1109As a special-case, failing ports with a tag will not
1110interfere with clean-up, so that hosts do not get locked down to
1111a specific tag.
1112This also means that their dependencies
1113may vanish before human intervention addresses the problem.
1114.Pp
1115This is supposed to be an exceptional hack, helpful while porters
1116figure out how to remove the deadlock.
1117.Sh EXTERNAL CONTROL
1118By default
1119.Po
1120see
1121.Ar CONTROL
1122.Pc ,
1123.Nm
1124will create a Unix socket at
1125.Pa %L/control-%h-%$ ,
1126only accessible by
1127.Ar LOG_USER ,
1128that can accept a few commands, e.g.,
1129usable as
1130.Li nc -U path
1131.Pp
1132Current commands are as follows:
1133.Bl -tag -offset aaaa -width addhost
1134.It Cm addhost Ar hostline
1135Add a new host
1136.It Cm addpath Ar fullpkgpath ...
1137Add fullpkgpath to scan
1138.It Cm bye
1139close the socket connection.
1140.It Cm dontclean Ar pkgpath ...
1141Add new pkgpath to list of paths that should not be cleaned after build
1142.It Cm help
1143Self explanatory
1144.It Cm info Ar cores
1145Debug info for cores (to be extended to other data)
1146.It Cm rescan
1147Force
1148.Nm
1149to rescan all ignored paths (for various errors, including bogus dependencies)
1150.It Cm stats
1151Show the current stats line
1152.It Cm status Ar fullpkgpath ...
1153Show the current status of fullpkgpath, whether it's built, installable,
1154ready to build, to build later, along with current dependencies if
1155applicable.
1156.It Cm stub Ar fullpkgpath ...
1157Stub out
1158.Ar fullpkgpath
1159and unlock it if needed.
1160.It Cm wipe Ar fullpkgpath ...
1161Wipe out an existing lock: clean up the corresponding
1162.Ar fullpkgpath
1163on the appropriate host, then remove all lock and affinity info pertaining
1164to the port.
1165.It Cm wipehost Ar hostname ...
1166Remove all information relevant to a given host from
1167.Nm ,
1168including running jobs, locks, and affinity information.
1169.El
1170.Sh SHUTTING DOWN GRACEFULLY
1171.Nm
1172periodically checks for a file named
1173.Pa stop
1174in its log directory.
1175If this file exists, then it won't start new jobs, and shutdown when
1176the current jobs are finished unless
1177.Fl q .
1178.Pp
1179.Nm
1180also checks for files named
1181.Pa stop-<hostname>
1182in its log directory.
1183If such a file exists, then it won't start new jobs on
1184the corresponding machine.
1185.Sh FILES
1186Apart from producing packages,
1187.Nm
1188may create temporary files as
1189.Pa ${FULLDISTDIR}/${DISTFILE}.part .
1190.Pp
1191In fetch mode
1192.Po
1193.Fl f
1194and
1195.Fl F
1196.Pc ,
1197.Nm
1198populates
1199.Pa ${DISTDIR}/by_cipher/sha256
1200with links.
1201It also uses
1202.Pa ${DISTDIR}/distinfo
1203and
1204.Pa ${DISTDIR}/history
1205as a
1206.Sq permanent log :
1207.Bl -tag -width distinfo
1208.It distinfo
1209cache of distfiles checksum.
1210Contains all
1211.Xr sha256 1
1212checksums of known files under
1213.Pa ${DISTDIR} .
1214Fetching uses this to avoid re-checksumming known files.
1215.It history
1216Log of old files under distinfo.
1217After successfully scanning a full ports tree
1218.Po
1219.Nm Fl a
1220.Pc ,
1221the fetch engine knows precisely which files are needed by the build
1222(and their checksums).
1223Anything that is
1224.Bl -bullet
1225.It
1226recorded in distinfo but unneeded
1227.It
1228recorded in distinfo but with the wrong checksum
1229.It
1230not recorded in distinfo, but not needed
1231.El
1232will be entered at the end of history as a line:
1233.Pp
1234.Li ts SHA256 (file) = value
1235.Pp
1236with
1237.Ar ts
1238a timestamp from Unix epoch.
1239.Pp
1240When cleaning up old files, with a tool such as
1241.Xr clean-old-distfiles 1 ,
1242it is vital to check both the checksum and
1243the file name: since mirroring stores permanent links under
1244.Pa by_cipher ,
1245files which are still needed will appear in history under their old
1246checksums, as an indication the link should be removed, but possibly not
1247the file itself.
1248.El
1249.Pp
1250If
1251.Pa ${DISTDIR}
1252ever becomes corrupted,
1253removing
1254.Pa ${DISTDIR}/distinfo
1255will force
1256.Nm
1257into checking all files again.
1258.Pp
1259All those files belong to the
1260.Ar FETCH_USER
1261if it is defined.
1262They should be readable for the
1263.Ar build_user .
1264.Pp
1265.Nm
1266also records rolling build statistics under
1267.Pa ${DISTDIR}/build-stats/${ARCH} ,
1268and uses them automatically in the absence of
1269.Fl b Ar logfile .
1270That file belongs to the
1271.Ar LOG_USER
1272if it is defined.
1273.Pp
1274If
1275.Fl s
1276is used, size information for successful builds will be recorded under
1277.Pa ${DISTDIR}/build-stats/${ARCH}-size
1278.Po
1279by default, location adjustable with
1280.Fl S Ar sizelog
1281.Pc .
1282This is then reused for the mfs threshold option.
1283That file also belongs to the
1284.Ar LOG_USER
1285if it is defined.
1286.Pp
1287.Nm
1288also maintains a list of pkgpath frequencies
1289.Pa ${DISTDIR}/build-stats/${ARCH}-dependencies ,
1290filled at end of LISTING if
1291.Fl a .
1292This list will be automatically reused when restarting a build:
1293a quick LISTING of the most important dependencies will happen
1294before the general LISTING,
1295in order to prime further LISTING steps with most common ports first.
1296.Pp
1297.Nm
1298will also create a large number of log files under
1299.Pa ${PORTSDIR}/logs/${ARCH} ,
1300which will belong
1301to
1302.Ar LOG_USER
1303if it is defined:
1304.Bl -tag -width engine.log
1305.It Pa affinity/
1306Affinity information.
1307One file per full pkgpath, with slash replaced by dots
1308like so:
1309.Pa affinity/lang.ghc,-main .
1310.It Pa affinity.log
1311On startup
1312.Nm
1313reads existing affinity information, and records it in that log,
1314together with its pid.
1315This log just exists to verify, along with
1316.Pa engine.log ,
1317whether correct affinity was heeded.
1318.It Pa awaiting-locks.log
1319This is purely for gathering performance statistics, about how much
1320lock contention happened around
1321.Xr pkg_add 1
1322and
1323.Xr pkg_delete 1
1324usage.
1325Plotting cumulated time may help in fine-tuning squiggles parameters.
1326.It Pa build.log
1327Actual build log.
1328Each line summarizes build of a single pkgpath, as:
1329.Sq pkgpath host time logsize (detailed timing)[!]
1330where time is the actual build time in seconds, host is the machine name
1331where this occurred, logsize is the corresponding log file size,
1332and a ! is appended in case the build didn't succeed.
1333.Pp
1334The detailed timing info gives a run-down of the build, with clean, fetch,
1335prepare, patch (actually extract+patch), configure, build, fake, package, clean
1336detailed timing info.
1337Note that the actual build time starts at
1338.Sq extract
1339and finishes at
1340.Sq package .
1341.It Pa built-packages.log
1342The actual list of fullpkgname.tgz as they get built.
1343.It Pa cpu-concurrency.log
1344Shows the actual concurrency achieved as a result of job starvation /
1345parallel handling.
1346Only gets a new line when the value changes: pid timestamp jobs
1347.It Pa debug.log
1348contains various information related to the main engine spinning (RTFS, haven't
1349figured that one yet) along with the more useful warning and die traces that
1350happen when something wrong occurs.
1351Especially useful for the warning messages that tend to be overwritten by
1352subsequent displays.
1353Will also contain error messages pertaining to failure at parsing existing
1354lock files.
1355.It Pa dist/<distfile>.log
1356Log of the
1357.Xr ftp 1
1358process(es) that attempted to fetch the distfile.
1359.It Pa control-%h-%$
1360Default name for the external control socket.
1361.It Pa dump.log
1362A long log file generated at the end of build that yields any information
1363pertinent to ports still in the
1364.Sq to build
1365and the
1366.Sq built
1367queues.
1368See also
1369.Pa summary.log
1370for an expurged version of same.
1371.It Pa engine.log
1372Build engine log.
1373Each line corresponds to a state change for a pkgpath and starts with the pid
1374of
1375.Nm ,
1376plus a timestamp of the log entry.
1377.Bl -tag -width BB:
1378.It ^
1379pkgpath temporarily put aside, because a job is running in the same directory.
1380.It !
1381pkgpath ignored, either directly, or indirectly because a dependency was
1382ignored.
1383End of the line states reason why ignored.
1384.It A
1385affinity mismatch: path considered for build, but not the right host,
1386followed by the affinity information.
1387.It B
1388pkgpath built / distfile found.
1389.It C
1390forcible clean-up before building a port with a kde tag.
1391.It E
1392error in build or fetch.
1393.It F
1394distfile queued for download.
1395.It H
1396package still not found due to nfs on this run.
1397.It I
1398pkgpath can be installed.
1399.It J
1400job to build pkgpath started.
1401Also records the host used for the build.
1402.It K
1403kde mismatch, no build until host has been cleaned up.
1404.It L
1405job did not start, existing lock detected.
1406.It N
1407job did not finish.
1408The host may have gone down.
1409.It P
1410built package is no longer required for anything.
1411.It Q
1412pkgpath queued as buildable whenever a slot is free.
1413.It T
1414pkgpath to build / distfile to download.
1415.It V
1416pkgpath put back in the buildable queue, after job that was running in
1417the same directory returned.
1418.It W
1419only happens when the external control
1420.Cm wipe
1421command is used: pkgpath will be cleaned up, next log entry will be
1422.Sq N
1423since the job did not finish and is ready to restart.
1424.It X
1425only happens when rescanning after an error.
1426The engine temporarily locks paths that are incomplete (detained).
1427These will be kept in a separate list for later examination until the
1428end of the new scan.
1429.It x
1430only happens when rescanning after an error.
1431Releases a path for building after the new scan is finished.
1432.It Y
1433affinity mismatch, but job will start on the wrong host anyways, as the queue
1434contains no other buildable path.
1435.El
1436.Pp
1437The engine is no longer run after each package build event
1438because of performance considerations, so the
1439.Sq Q
1440and
1441.Sq I
1442changes may be delayed by a few
1443.Sq B .
1444.It Pa equiv.log
1445Lists of equivalent pkgpaths for the build, when default flavors and default subpackages have been resolved.
1446.It Pa fetch/bad.log
1447List of URLs that did not lead to a correct distfile, either because
1448they were not responding, or because of incorrect checksums.
1449.It Pa fetch/good.log
1450List of URLs that fetched correctly, along with timing statistics.
1451.It Pa fetch/manually.log
1452List of pkgpaths that require manual intervention, in human-readable form.
1453.It Pa <hostname>.sig.log
1454Complete library signature of the host.
1455.It Pa init.<hostname>.log
1456Captured output of the initialization job for each host.
1457.It Pa junk.log
1458Option
1459.Fl J
1460counts the number of dependencies directly added to decide when to run
1461.Nm pkg_delete Fl a .
1462This file sums up how many ports were built, and how many ports had
1463dependencies each time
1464.Nm
1465decides to junk.
1466.It Pa locks/
1467Directory where locks are created.
1468There are three types of locks:
1469.Bl -bullet
1470.It
1471pkgpath locks for building, where the slash in a pkgpath is replaced
1472with a dot like so:
1473.Pa locks/devel.make
1474to flatten the structure.
1475.It
1476distfile locks for fetching, using the distfile name without the path like so:
1477.Pa locks/distfile.dist .
1478.It
1479host locks for dependency handling and junking, like so:
1480.Pa locks/host:hostname .
1481.El
1482.It Pa packages/pkgname.log
1483one file or symlink per pkgname.
1484.It Pa paths/some/path.log
1485one file or symlink per pkgpath.
1486.It Pa performance.log
1487Some parts of
1488.Nm
1489are computationally intensive, such as the engine runs to determine
1490new stuff that can be built, and the actual display reports.
1491.Pp
1492Both those activities are rate-limited, so that
1493.Nm
1494doesn't run its engine at each new package build,
1495and doesn't update its display every time there is a phase change.
1496.Pp
1497Lines tagged with
1498.Sq ENG
1499correspond to the engine;
1500lines tagged with
1501.Sq REP
1502correspond to the display reports.
1503.Pp
1504Lines ending with a dash
1505.Sq -
1506correspond to new activity that didn't trigger
1507a computation.
1508.Pp
1509Other lines will feature a plus
1510.Sq +
1511for normal runs, or an exclamation point
1512.Sq !
1513for forced runs, followed by two numbers:
1514the next timestamp at which we'll be allowed to run, and
1515a measure of how much time it took to run this pass.
1516.Pp
1517That information is mostly relevant while
1518.Nm
1519is building lots of small packages very quickly.
1520.It Pa signature.log
1521Discrepancies between hosts that prevent them from starting up.
1522.It Pa size.log
1523Size of work directory at the end of each build, built only with
1524.Fl s .
1525.It Pa stats.log
1526Simple log of the B=... line summaries.
1527Mostly useful for making plots and tweaking performance.
1528.It Pa stop
1529Not a logfile at all, but a file created by the user to stop
1530.Nm
1531creating new jobs.
1532.It Pa stop-<hostname>
1533Not a logfile at all, but created by the user to stop hostname creating
1534new jobs.
1535.It Pa summary.log
1536A summary file generated at end of build that lists packages not built
1537or not installable, along with a reason for it.
1538This summarizes packages not built because of existing locks, because of
1539errors, but also because they depend on something that was not built.
1540.Pp
1541In that last case,
1542.Pa summary.log
1543contains a chain of dependencies leading to the problematic package, or
1544in case of build cycles, stopping at the first loop.
1545.It Pa term-report.log
1546Saves all terminal output, so that it can be replayed at hi speed with
1547.Xr dpb-replay 1 .
1548.It Pa vars.log
1549Logs the directories that were walked in the ports tree for dependency
1550information, including the path to a dependency that triggered this
1551particular step.
1552.El
1553.Sh DIAGNOSTICS
1554.Bl -tag -offset aaaa -width truc
1555.It Waiting for hosts to finish STARTUP...
1556Displayed on the console while
1557.Nm
1558is setting up hosts, getting essential data from the ports tree,
1559running a
1560.Ar STARTUP
1561script, collecting base library signatures.
1562.It stuck on <lockfilename>
1563Display on the console when
1564.Nm
1565detects a "frozen" port has happened outside of
1566.Nm Ns 's
1567purview, namely because the ports tree itself has that specific
1568port locked without
1569.Nm Ns 's
1570knowledge.
1571See
1572.Xr bsd.port.mk 5 ,
1573.Xr portlock 1 .
1574.It (Junk lock obtained for <host> at <time>)
1575.It (Junk lock released for <host> at <time>)
1576Printed in a
1577.Pa paths/pkgpath.log
1578file when attempting to get a
1579.Sq junk lock .
1580On a given host, all dependency operations are serialized.
1581The dependency computation itself is handled by the main
1582.Nm
1583process, which needs to know exactly which dependencies are used
1584at a given point, so that
1585.Ar junk
1586can clean up the host correctly.
1587In particular,
1588.Ar junk
1589will not clean up dependencies already scheduled for installation.
1590Ports that do not obtain the lock on first try are put to sleep.
1591.It Received IO
1592Printed in a
1593.Pa paths/pkgpath.log
1594file when woken up before trying attempting to obtain a
1595.Ar junk
1596lock again...
1597.It Woken up <fullpkgpath>
1598Printed in a
1599.Pa paths/pkgpath.log
1600when waking another task by sending it SIGIO,
1601so that it may attempt to obtain the junk lock again.
1602.It (Junk lock failure for <host> at <time>)
1603All ports sleeping for a
1604.Ar junk
1605lock are woken at the same time, so only one of them will obtain the lock,
1606and the others will fail and be put to sleep again.
1607.It Short-cut: depends already handled by <fullpkgpath>
1608Printed in a
1609.Pa paths/pkgpath.log
1610when a port wakes up after others that ran
1611.Xr pkg_add 1 .
1612As
1613.Nm
1614maintains dependencies for a given host globally, it coalesces depends lists
1615together.
1616.It Don't run junk because nojunk in <fullpkgpath>
1617Printed in a
1618.Pa paths/pkgpath.log
1619while evaluating whether to run
1620.Ar junk .
1621Normally,
1622.Ar junk
1623happens at regular intervals, but ports marked
1624.Sq nojunk
1625will delay that.
1626.Nm
1627still keeps track of attempted junks.
1628.It Still tainted: <bool>
1629A host may have a tag (kde3/kde4) that prevents building differently tagged
1630ports.
1631This will be cleansed by
1632.Ar junk
1633eventually.
1634This prints in
1635.Ar path/pkgpath.log
1636to indicate whether this particular
1637.Ar junk
1638will keep the host tainted with a tag or not.
1639.It Forced junk, retainting: <tag>
1640Printed at end of
1641.Ar prepare-results ,
1642when an eventual junk was run even though some ports still hold a tag.
1643.It Can't run junk because of lock on <fullpkgpath>
1644.Ar junk
1645can't happen because
1646.Ar fullpkgpath
1647is locked and is marked
1648.Sq nojunk .
1649.It Avoided depends for <dependencies>
1650As dependencies are handled globally per-host, some ports can avoid
1651.Xr pkg_add 1
1652altogether because another port already installed the correct dependencies.
1653.It SPINNING ON MAIN
1654Printed in
1655.Ar debug.log ,
1656this is an actual bug: the engine said it can build, there are cores available,
1657but
1658.Nm
1659can't start a new build job.
1660.It SPINNING ON FETCH
1661Printed in
1662.Ar debug.log ,
1663this is an actual bug: the engine said it can fetch, there are fetching
1664cores available, but
1665.Nm
1666can't start a new fetch job.
1667.It KILLED: <job> stuck at <somewhere>
1668Printed in
1669.Ar path/pkgpath.log
1670when a port exceeds its timeout.
1671.It !: <path> tried and didn't get it
1672Printed in
1673.Ar engine.log
1674Scanning the port didn't give us useful information.
1675See
1676.Ar vars.log
1677for gory details.
1678.El
1679.Sh BUGS AND LIMITATIONS
1680.Nm
1681performs best with lots of paths to build.
1682When just used to build a few ports, there's a high risk of starvation
1683as there are bottlenecks in parts of the tree.
1684.Pp
1685Fetch jobs don't deal with checksum changes yet:
1686if a fetch fails because of a wrong checksum, if you update the distinfo
1687file and remove the lock,
1688.Nm
1689won't pick it up.
1690.Pp
1691Note that
1692.Nm
1693does not manage installed packages in any intelligent way, it will just
1694call
1695.Xr pkg_add 1
1696during its depend stage to install its dependencies.
1697With
1698.Fl u ,
1699it will call pkg_add -r.
1700With
1701.Fl U ,
1702it will call pkg_add -r -D installed,
1703but there is nothing else going on.
1704This is especially true when using
1705.Fl R ,
1706ensure the machine is clean of possibly older packages first, or run
1707.Nm
1708with
1709.Fl U .
1710.Pp
1711In particular
1712.Fl R
1713and
1714.Fl J
1715together may lead to strange issues.
1716.Pp
1717On heterogeneous networks, calibration of build info and choice of speed
1718factors is not perfect, and somewhat a dark art.
1719Using distinct speed factors on a build log that comes from a single
1720machine works fine, but using the build info coming from several machines
1721does not work all that well.
1722.Pp
1723.Nm
1724should check
1725.Pa /usr/include
1726and
1727.Pa /usr/X11R6/include
1728for consistency, but it doesn't.
1729.Pp
1730When a host fails consistency check, there is not yet a way to re-add it
1731after fixing the problem.
1732You have to stop
1733.Nm ,
1734cleanup and restart.
1735.Pp
1736The default limits in
1737.Pa login.conf
1738are too small for bulk builds on any kind of parallel machines.
1739Bump number of processes, file descriptors, and memory.
1740.Pp
1741Even though
1742.Nm
1743tries really hard to check heterogeneous networks for sanity (checking
1744shared libraries and .la files), it is still dependent on the user to
1745make sure all the hosts build ports the same way.
1746.Pp
1747Make sure your NFS setup is consistent.
1748The ports dir itself should be exported or synchronized.
1749Distfiles, the package repository,  and the plist repository should be exported,
1750but WRKOBJDIR should not be on NFS unless you have absolutely no choice,
1751or if you exhibit deep masochistic tendencies.
1752Pay particular attention to discrepancies in
1753.Pa /etc/mk.conf .
1754.Pp
1755Also,
1756.Nm
1757connects to external hosts through
1758.Xr ssh 1 ,
1759relying on
1760.Xr ssh_config 5
1761for any special cases.
1762.Pp
1763When fetching distfiles,
1764.Nm
1765may freeze and spin in a tight loop while the last distfiles are being fetched.
1766This is definitely a bug, which has been around for quite some time, which
1767is a bit difficult to reproduce, and hasn't been fixed yet.
1768So if
1769.Nm
1770stops updating its display right around the end of fetch, you've hit the bug.
1771Just kill
1772.Nm
1773and restart it.
1774.Sh SEE ALSO
1775.Xr clean-old-distfiles 1 ,
1776.Xr dpb-replay 1 ,
1777.Xr proot 1 ,
1778.Xr pkgpath 7 ,
1779.Xr bulk 8
1780.Sh HISTORY
1781The original
1782.Nm dpb
1783command was written by Nikolay Sturm.
1784This version is a complete rewrite from scratch using all the stuff
1785we learnt over the years to make it better.
1786.Sh AUTHORS
1787.An Marc Espie Aq Mt espie@openbsd.org
1788