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