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