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