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 echo "FASTBULK START ${argv[1]}: `date`"
15 lockf "/tmp/track/locks/$pkgwild" /tmp/track/dobuild ${argv[1]} "$pkgwild"
16 if ( $status == 0 ) then
17 echo "FASTBULK SUCCESS ${argv[1]}: `date`"
20 echo "FASTBULK FAILURE ${argv[1]}: `date`"
25 # Get the package name and clean up any garbage that might
26 # interfere with the build.
28 set pkgname = "`bmake show-var VARNAME=PKGNAME`"
29 set logname = "$argv[1]"
30 set pkgwild = "$argv[2]"
33 # Check if already installed, prevent overwrite of
34 # previous run's logfile if it exists, by deleting
35 # the current run file. Else put in a simple logfile.
37 pkg_info -q -e $pkgname
38 if ( $status == 0 ) then
39 if ( -f /tmp/logs/good/$logname ) then
40 rm -f /tmp/logs/run/$logname
42 echo "(already installed from previous run)"
46 # Delete potential conflicts
48 pkg_delete -r "$pkgwild"
50 # If we already have a binary package just install
53 if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then
54 echo "(found in /usr/pkgsrc/packages)"
55 bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes
56 setenv PKG_PATH /usr/pkgsrc/packages/All
57 echo "pkg_add -f ${pkgname}"
62 # We need to build the package.
64 # Delete any conflicting installed packages or the one we want to build
65 # will refuse to build. The binary package files are left intact.
67 foreach i ( `bmake show-var VARNAME=CONFLICTS` )
68 echo "DELETING CONFLICTING PACKAGE: $i"
72 # If the dist file checksum fails and the dist file is over
73 # 4 hours old we re-download it.
77 set distfiles = "`bmake -V '${dollar}{DISTFILES}'`"
78 bmake checksum SKIP_LICENSE_CHECK=yes
79 if ( $status != 0 ) then
80 echo "Deleting distfiles ( $distfiles ) if over 4h old"
81 foreach dfile ( $distfiles )
82 find /usr/pkgsrc/distfiles -name "$dfile" -mtime +4h -delete
86 # To ensure a clean build deinstall anything that
87 # may cause our build repackage to fail.
89 # Clean after repackaging to keep the work topology footprint small.
91 # We create a binary package and then pkg_add it.
93 bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes
94 bmake repackage SKIP_LICENSE_CHECK=yes
95 if ( $status == 0 ) then
96 bmake clean SKIP_LICENSE_CHECK=yes
97 setenv PKG_PATH /usr/pkgsrc/packages/All
98 echo "pkg_add -f ${pkgname}"
103 # comment this bmake out if you want to keep the work dir
106 bmake clean SKIP_LICENSE_CHECK=yes