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