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