3 # This is run from the chroot via fastbulk, which has CDd
4 # into a particular pkgsrc directory and wants us to build it.
5 # The script is run as /tmp/track/dobuild
7 # We do not want to interfere with builds of other versions
8 # of the same package, use a temporary lock file to prevent a
11 if ( $#argv == 1 ) then
12 set pkgwild = "`bmake show-var VARNAME=PKGWILDCARD`.lck"
13 mkdir -p /tmp/track/locks
14 lockf "/tmp/track/locks/$pkgwild" /tmp/track/dobuild $argv[1] locked
18 # Get the package name and clean up any garbage that might
19 # interfere with the build.
21 set pkgname = "`bmake show-var VARNAME=PKGNAME`"
22 set logname = $argv[1]
25 # Check if already installed, prevent overwrite of
26 # previous run's logfile if it exists, by deleting
27 # the current run file. Else put in a simple logfile.
29 pkg_info -q -e $pkgname
30 if ( $status == 0 ) then
31 if ( -f /tmp/logs/good/$logname ) then
32 rm -f /tmp/logs/run/$logname
34 echo "(already installed from previous run)"
38 # If we already have a binary package just install
41 if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then
42 echo "(found in /usr/pkgsrc/packages)"
43 bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes
44 setenv PKG_PATH /usr/pkgsrc/packages/All
45 echo "pkg_add -f ${pkgname}"
50 # We need to build the package.
52 # Delete any conflicting installed packages or the one we want to build
53 # will refuse to build. The binary package files are left intact.
55 foreach i ( `bmake show-var VARNAME=CONFLICTS` )
56 echo "DELETING CONFLICTING PACKAGE: $i"
60 # To ensure a clean build deinstall anything that
61 # may cause our build repackage to fail.
63 # Clean after repackaging to keep the work topology footprint small.
65 # We create a binary package and then pkg_add it.
67 bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes
68 bmake repackage SKIP_LICENSE_CHECK=yes
69 if ( $status == 0 ) then
70 bmake clean SKIP_LICENSE_CHECK=yes
71 setenv PKG_PATH /usr/pkgsrc/packages/All
72 echo "pkg_add -f ${pkgname}"
77 # comment this bmake out if you want to keep the work dir
80 bmake clean SKIP_LICENSE_CHECK=yes