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