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