fastbulk - Adjustments to fix various issues (2)
[dragonfly.git] / test / fastbulk / dobuild
CommitLineData
b050e616
MD
1#!/bin/csh
2#
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
6# Nothing to do if the package already exists. Remove the run log
7# to prevent fastbulk from replacing the log from a previous run
8#
9set pkgname = "`bmake show-var VARNAME=PKGNAME`"
10set logname = $argv[1]
1b3b024a
MD
11unsetenv PKG_PATH
12
13# Check if already installed, prevent overwrite of
14# previous run's logfile if it exists, else put in
15# a simple logfile.
16#
17pkg_info -q -e $pkgname
18if ( $status == 0 ) then
19 if ( -f /tmp/logs/good/$logname ) then
20 rm -f /tmp/logs/run/$logname
21 endif
22 echo "(already installed from previous run)"
b050e616
MD
23 exit 0
24endif
25
1b3b024a
MD
26if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then
27 echo "(found in /usr/pkgsrc/packages)"
28 bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes
29 setenv PKG_PATH /usr/pkgsrc/packages/All
30 echo "pkg_add -f ${pkgname}"
31 pkg_add -f ${pkgname}
32 exit $status
33endif
34
b050e616
MD
35# We have to remove any conflicting packages or the one we
36# are trying to build will refuse to build. Note that we
37# leave the related packages intact.
38#
39foreach i ( `bmake show-var VARNAME=CONFLICTS` )
40 echo "DELETING CONFLICTING PACKAGE: $i"
41 pkg_delete -r "$i"
42end
43
44# To ensure a clean build deinstall anything that
45# may cause our build repackage to fail.
46#
47# Clean after repackaging (if it succeeded) to keep the
48# work topology footprint small. The work topology is
49# left intact for failed builds.
50#
51bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes
52bmake repackage clean SKIP_LICENSE_CHECK=yes
1b3b024a
MD
53if ( $status == 0 ) then
54 setenv PKG_PATH /usr/pkgsrc/packages/All
55 echo "pkg_add -f ${pkgname}"
56 pkg_add -f ${pkgname}
57 exit $status
58endif
59exit 1