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