1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00
Commit Graph

397 Commits

Author SHA1 Message Date
Kris Kennaway
6d04ba603f Add a mechanism for reporting client machine error conditions back to the
server.  Error conditions are flagged by other processes by creating
a named dotfile in ${scratchdir}.  If these files are found, report the
error status instead of the number of running jobs.  Currently report "ERR"
for all error conditions; I will probably change this to a per-condition
message.

Currently only "squid not running" and "disk space low" conditions are
reported.
2006-02-15 07:48:53 +00:00
Kris Kennaway
744179e319 Trim some unused cruft
If the package copy fails, bail out immediately instead of later on when
we try to pkg_add it.  Also trap signals and bail out.

Both conditions will cause a retry of the package build.
2006-02-15 07:45:53 +00:00
Kris Kennaway
56aabd9e31 Save the output of portbuild run on the client to a temporary log file.
If portbuild bailed out unexpectedly, mail the log to ${mailto}.

Add some XXX comments about improving robustness of this script.

Sleep for 2 minutes before retrying builds, to avoid spamming ${mailto}
with a high rate of failure logs.  In future we might be smarter about
attempting to automatically correct common failure modes.
2006-02-15 07:44:47 +00:00
Kris Kennaway
d270e5ec99 Add some sanity checking of the build environment:
* Test whether squid is running.  If not, try to kick off
  the rc script in the background in case it can be restarted
  cleanly.

* Test for at least 100MB of free space on the scratch partition.

If either condition fails, set an exception flag and bail out.  This
will be reported back to the server via reportload.
2006-02-15 07:42:30 +00:00
Kris Kennaway
bb3de95c29 * Don't try to pkg_delete packages that are not installed (the usual
cause is because it was specified in the list twice)

* Don't panic when the list of packages to delete becomes empty

* When unexpected filesystem changes are detected, bail immediately
  instead of proceeding and hiding the error in the middle of
  the log
2006-02-15 07:39:48 +00:00
Kris Kennaway
4787e51b8b Add support for 6-exp builds (FreeBSD 6.x is our new reference platform) 2006-02-15 07:34:02 +00:00
Kris Kennaway
17394c78b7 * Switch back to using pkg_delete -f; we are not yet ready to deal
with all the errors from broken pkg_delete scripts

* As threatened in previous commit, move the pristine mtree spec
  generation to phase 1, and avoid having to delete and re-add the
  FETCH_DEPENDS.  We still have to keep them installed until after
  'make extract' though
2006-02-13 20:47:04 +00:00
Kris Kennaway
89b70a6115 * In kill_procs(), pass in the directory and mountpoint as separate
arguments (cosmetic)

* Detect if a chroot was used to run a jailed build, and first attempt
  to gracefully shut it down by killing everything within using pgrep(1)
  This has a much higher chance of succeeding that relying on fstat to
  identify processes that might interfere with our attempts to clean up
  mountpoints, which is fragile (libkvm-dependent), and inherently
  unreliable at best.
2006-02-11 10:05:01 +00:00
Kris Kennaway
50a3a73c61 Support for building ports in a jail instead of a chroot. If use_jail=1
in portbuild.conf (or per-machine .conf), then construct a 127.0.0.0/8
IP address based on the build directory ID (i.e. unique for each
build instance).  This is bound to the lo0 interface for the duration
of the 'phase 2' build.

We cannot build 'phase 1' in a jail since 'make fetch' doesn't always
work through a proxy (e.g. squid sometimes mangles files fetched through
FTP, I think by performing CR/LF translation in FTP ASCII mode).

Pass in the HTTP_PROXY variable to the jail, if set.  This allows FTP/HTTP
access from within the jail if the proxy is suitably configured (some ports
legitimately need to fetch additional files during the build, e.g. if they
have a BUILD_DEPENDS=...:configure target that needs to fetch additional
distfiles).

Not all ports can be built in jails (most notably the linux_base ports
since they want to mount/umount linprocfs), so we will need to come up
with a way to deal with this.

Some ports require SYSV IPC, so security.jail.sysvipc_allowed=1 might be
required.  Some other ports attempt to perform DNS lookups, ping, or
outbound TCP connections during the build.

When it works, this provides better compartmentalization of package builds,
e.g. easier termination of builds without the possibility of daemonized
processes staying active; no possibility of accidental interference
between jails, etc.  It also allows for admin monitoring using jls(1).
2006-02-11 10:01:37 +00:00
Kris Kennaway
624d76fbca * Use ${mailto} portbuild.conf variable instead of hard-coded list [1]
* Remove old logs and possible compressed logs before attempting the build

Requested by:   lofi [1]
Submitted by:   linimon [1]
No more accidental portbuild spam:      kris and krion [1]
2006-02-11 09:49:53 +00:00
Kris Kennaway
4094b5762c Use ${mailto} portbuild.conf variable instead of hard-coded list
Requested by:	lofi
Submitted by:	linimon
No more accidental portbuild spam:	kris and krion
2006-02-11 09:48:53 +00:00
Kris Kennaway
b8d81fba50 Checkpoint a major round of changes:
* Only keep distfiles if the port passes 'make fetch', so we don't
  accidentally keep files with invalid checksums

* Use cleanup() instead of directly exiting in some error conditions

* When cleanup() is called indicating an unexpected error (possibly
  leaving the filesystem in an inconsistent state), mark the chroot
  as dirty so it will not be reused by another build

* Remove packages in dependency order instead of with pkg_delete -f in
  possibly incorrect order.  This paves the way for focusing on errors
  generated by pkg_delete (e.g. @dirrm that should be @dirrmtry) in the
  future. [1]

* Detect when packages were left behind because they were still in use
  by other packages, indicating an incorrect or incomplete port
  dependency list

* Partial support for ccache builds (not yet complete)

* Support non-standard LOCALBASE/X11BASE settings

* Delete FETCH_DEPENDS after the 'make fetch' stage.  We have to add
  them again before 'make extract' since, due to a lack of a 'fetch
  cookie', 'make extract' actually *always* runs 'make fetch' again,
  even when distfiles have already been fetched.  We need to delete
  them in order to:

* Record an mtree spec of the 'pristine' filesystem state, for later
  comparison.
  # XXX Perhaps this can be done in stage 1 before the
  # 'make fetch', removing the need to delete-and-readd.

* Also record an mtree spec of the filesystem state prior to the
  build phase.  Compare this to the state of the filesystem
  immediately before running the install phase, to detect files
  that were inappropriately installed during the build phase.
  Doing so is a fatal error.

* Prior to installing, try to run a 'regression-test' port makefile
  target, if it exists.  This allows ports to hook their internal
  regression suites into the package build.  This needs further
  infrastructure support, e.g. a default NOP target in bsd.port.mk.
  For now this is run with 'make -k', so regression failures will
  not yet actually cause package build failures.

* Separate the 'make install' from 'make package' phases rather than
  let the latter implicitly do the install.

* After the newly packaged port has been deleted, compare the state
  of the filesystem to the state before 'make install'.

* After removing BUILD and RUN dependencies, compare the filesystem
  state to the pristine state before the start of the build.  This
  also detects package dependencies that did not clean themselves up
  properly when deinstalling.  It also detects dependencies that were
  'missing' from the port INDEX: these were not pkg_added into place,
  so the package build had to compile them from scratch (a big waste
  of time and effort), so this is now also a fatal error.

PR:		ports/85746 (inspired by) [1]
Submitted by:	Boris B. Samorodov <bsam@ipt.ru> [1]
2006-02-11 09:38:18 +00:00
Kris Kennaway
84c66c52a2 Flip from noclean to clean 2006-02-03 20:13:23 +00:00
Kris Kennaway
35fb7ca9ce Don't bother chowning the client /var/portbuild/, it just takes too long
and this doesn't happen in practise unless you screwed up manually.
2006-02-03 20:10:34 +00:00
Kris Kennaway
e0db90a164 Use clean-chroot with clean=2 to remove the chroot instead of duplicating
some of the code
2006-02-03 20:09:35 +00:00
Kris Kennaway
e3e716a021 Flip "noclean" to "clean" 2006-02-03 20:08:56 +00:00
Kris Kennaway
b762d9e066 Instead of passing in a "noclean" boolean, pass in a "clean" level:
0 = don't clean chroot
  1 = sanitize commonly-modified directories
  2 = remove entire chroot
2006-02-03 20:08:18 +00:00
Kris Kennaway
a65bd63641 Also look for chroots that are marked 'dirty' (previous build left chroot
in unclean state) and run clean-chroot on them to remove them.
2006-02-03 20:07:13 +00:00
Kris Kennaway
a9f9b51a89 Don't try to remove the lock file now that we use lockf to manage it
Noticed by:	 linimon
2006-02-03 20:06:04 +00:00
Kris Kennaway
e242e2904e Correctly set SRCBASE; the version inherited from buildenv is wrong for
the client chroots.
2006-01-27 22:42:00 +00:00
Kris Kennaway
d59fe16ef4 Don't try to rsync docs, we no longer need to distribute them 2006-01-27 22:40:51 +00:00
Kris Kennaway
2c15d2d1d6 Update the list of quickports 2006-01-27 22:40:33 +00:00
Kris Kennaway
f708dd4383 Don't bother mounting doc tree, it's not needed by any ports
Use LOCALBASE/X11BASE values from buildenv

xorg uses the stock BSD.x11-4.dist now.
2006-01-22 04:56:37 +00:00
Kris Kennaway
560f97f20b Remove -nodoccvs option, it turns out mounting the doc tree is not
required by any ports
2006-01-22 04:55:28 +00:00
Kris Kennaway
d715faf967 Also clean up linprocfs mounts 2006-01-22 04:55:03 +00:00
Kris Kennaway
c4f994d99b Pull in buildenv for LOCALBASE/X11BASE locations
Don't bother cleaning up doc mounts, they are not needed.
2006-01-22 04:54:49 +00:00
Kris Kennaway
b713f62e3b Use LOCALBASE and X11BASE from buildenv 2006-01-22 04:54:24 +00:00
Kris Kennaway
9b356bb99d Allow for the possibility of overriding LOCALBASE and X11BASE 2006-01-22 04:53:59 +00:00
Kris Kennaway
15ac5c6724 Exit with the correct error code when a make target fails
PR:             ports/64930
Submitted by:   Damir Kiramov <damirycha@damirycha.net.ru>
2006-01-15 04:18:14 +00:00
Kris Kennaway
c7d2049938 Back out last commit, it was the wrong file 2006-01-15 04:17:48 +00:00
Kris Kennaway
f83ac9920c Exit with the correct error code when a make target fails
PR:		ports/64930
Submitted by:	Damir Kiramov <damirycha@damirycha.net.ru>
2006-01-15 02:35:47 +00:00
Kris Kennaway
4a1dd67a59 This script may be run on a client machine to force it to flush its squid
cache.  This is useful if the client is holding a bad or stale cached
copy of a package that is causing problems for package builds.
2005-12-11 04:41:38 +00:00
Kris Kennaway
dc26cbf0be Bump the file size limit to 300MB now that openoffice distfiles exceed
256MB.  Clarify a comment.
2005-12-11 04:40:27 +00:00
Kris Kennaway
4e0a14315c Shuffle the order of a cd 2005-12-11 04:36:47 +00:00
Kris Kennaway
57164dfa7a Remove 0-sized entries to avoid misbehaviour 2005-12-11 04:36:23 +00:00
Kris Kennaway
2f084309ba Don't use a lockfile, the script will be called with lockf -t0 instead to
avoid problems with stale lockfiles after a reboot.
2005-12-11 04:35:44 +00:00
Kris Kennaway
1ace35e972 Don't use a lockfile, the script will be called with lockf -t0 instead
to avoid problems with stale lockfiles after reboots.
2005-12-11 04:35:04 +00:00
Kris Kennaway
ba996790a4 Update the list of quickports 2005-12-11 04:34:20 +00:00
Kris Kennaway
d06e2470ca Don't set -nocopy when -norsync is set, otherwise the setupnode script
doesn't completely prep the client.
2005-12-11 04:33:55 +00:00
Kris Kennaway
29d910959f Don't use a lock file, the script will be called with lockf -t 0 instead.
This avoids problems from stale lockfiles after reboots.
2005-12-11 04:32:29 +00:00
Kris Kennaway
70ca5470b7 Mount the md image async since this gives much better performance 2005-12-11 04:31:08 +00:00
Kris Kennaway
391855dc68 Remove, don't comment out, unused variables 2005-10-11 04:02:49 +00:00
Kris Kennaway
f03134ec0a Remove unused variables. Don't bother protecting against negative
queue lengths since that doesn't arise.
2005-10-11 04:02:05 +00:00
Kris Kennaway
29028363d7 Update lockf to lockf -k in example usage 2005-10-11 03:56:42 +00:00
Kris Kennaway
bd58a06a02 Update the lockf command to add -k in example usage 2005-10-11 03:56:20 +00:00
Kris Kennaway
94cda32b84 When -norsync is set, don't bother to run md5 over the bindist.tar
and copy it to the client.  This has two benefits:

1) Avoids spamming the master with dozens of md5 processes when
   dosetupnode is spawned for all client machines at ocne

2) Avoids silly copy attempts on disconnected nodes for which the file
   is copied to itself
2005-10-11 03:55:27 +00:00
Kris Kennaway
ac6980959a Change lockf to lockf -k in a commented-out command, just in case it's
ever uncommented.
2005-10-11 03:53:39 +00:00
Kris Kennaway
b63664dd37 Add support for use_md_swap 2005-10-11 03:53:02 +00:00
Kris Kennaway
0faac9ad5f Add support for use_md_swap. When this variable is set in a
portbuild.conf, builds will each be done in a separate swap-backed md.
This dramatically improves build performance since

* Every transaction is not written to disk, so disk bandwidth is not
  a bottleneck

* Multiple builds do not contend with each other for the same set of
  filesystem locks and other per-device resources

The size of the md devices is controlled by the md_size variable.  '2g'
seems to be a good size.

Currently we mdconfig -u each device after each port build, since
otherwise dirty blocks accumulate and the md eventually uses a full
amount of backing store (2g in the above example).  This is a problem
if there is unsufficient swap backing to accomodate them all.

XXX This should be made configurable to avoid the performance penalty on
systems that do have enough swap backing
2005-10-11 03:52:37 +00:00
Kris Kennaway
f873829934 No need to hold the queue lock while polling client load 2005-10-11 03:48:11 +00:00