d2b3a2b5e3
- if something fails while extracting the DEPENDS for a particular package, mark that package as broken and drop the DEPENDS info for it. This allows the build to continue and properly marks the package as broken. - if something fails while extracting the PKGNAME, also mark the pkg as broken. - be more careful about seeing if directories exist before cd'ing to them. Lack of such a test has caused problems elsewhere, so hopefully this will make the system more robust.
161 lines
5 KiB
Bash
161 lines
5 KiB
Bash
#!/bin/sh
|
|
# $NetBSD: build,v 1.13 2001/10/14 20:34:53 dmcmahill Exp $
|
|
|
|
#
|
|
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
# must display the following acknowledgement:
|
|
# This product includes software developed by Hubert Feyrer for
|
|
# the NetBSD Project.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
|
|
#
|
|
# Do builk build
|
|
#
|
|
|
|
echo Bulk build started: `date`
|
|
echo ""
|
|
|
|
# Pull in ADMIN etc.:
|
|
if [ -f "$BULK_BUILD_CONF" ]; then
|
|
. $BULK_BUILD_CONF
|
|
else
|
|
conf=`dirname $0`/build.conf
|
|
if [ -f "$conf" ]; then
|
|
. $conf
|
|
else
|
|
echo "$0: Cannot find config file $conf, aborting."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ "$http_proxy" != "" ]; then
|
|
echo "Using HTTP proxy $http_proxy"
|
|
export http_proxy
|
|
fi
|
|
if [ "$ftp_proxy" != "" ]; then
|
|
echo "Using FTP proxy $ftp_proxy"
|
|
export ftp_proxy
|
|
fi
|
|
echo ""
|
|
|
|
unset DISPLAY # allow sane failure for gimp, xlispstat
|
|
|
|
cd ${USR_PKGSRC}
|
|
|
|
if [ "$1" = "restart" ]; then
|
|
echo Restarting - skipping pre-build script
|
|
else
|
|
sh mk/bulk/pre-build # make veryveryclean :)
|
|
fi
|
|
|
|
if [ -d pkgtools/pkglint ]; then
|
|
cd pkgtools/pkglint
|
|
DEPENDSTREEFILE=`make show-var VARNAME=DEPENDSTREEFILE`
|
|
DEPENDSFILE=`make show-var VARNAME=DEPENDSFILE`
|
|
SUPPORTSFILE=`make show-var VARNAME=SUPPORTSFILE`
|
|
INDEXFILE=`make show-var VARNAME=INDEXFILE`
|
|
ORDERFILE=`make show-var VARNAME=ORDERFILE`
|
|
BROKENFILE=`make show-var VARNAME=BROKENFILE`
|
|
else
|
|
echo "The pkgtools/pkglint directory does not exist. Please update"
|
|
echo "your pkgsrc tree in ${USR_PKGSRC}"
|
|
exit 1
|
|
fi
|
|
cd ${USR_PKGSRC}
|
|
|
|
# get the list of packages which should always be installed during the build
|
|
cd ${USR_PKGSRC}/pkgtools/pkglint
|
|
BULK_PREREQ=`make show-var VARNAME=BULK_PREREQ`
|
|
cd ${USR_PKGSRC}
|
|
|
|
# install prerequisite packages. Note: we do this _before_ the depends tree
|
|
# because some packages like xpkgwedge only become DEPENDS if its installed
|
|
echo "Installing prerequisite packages specified with BULK_PREREQ..."
|
|
for pkgdir in $BULK_PREREQ
|
|
do
|
|
echo $pkgdir
|
|
# make sure its installed _and_ packaged
|
|
cd ${USR_PKGSRC}/$pkgdir && make bulk-install && make bulk-package && make clean
|
|
done
|
|
|
|
# Figure out optimal build order.
|
|
cd ${USR_PKGSRC}
|
|
if [ "$1" != "restart" ]; then
|
|
echo "Building dependency tree (this may take a while)..."
|
|
sh mk/bulk/printdepends $BROKENFILE > $DEPENDSTREEFILE
|
|
|
|
echo "Sorting build order..."
|
|
tsort $DEPENDSTREEFILE > $ORDERFILE
|
|
|
|
echo "Generating up and down dependency files..."
|
|
./mk/bulk/tflat -u $DEPENDSTREEFILE > $SUPPORTSFILE
|
|
./mk/bulk/tflat -d $DEPENDSTREEFILE > $DEPENDSFILE
|
|
|
|
echo "Generating package name <=> package directory cross reference file (this may take a while)..."
|
|
sh mk/bulk/printindex $BROKENFILE > $INDEXFILE
|
|
|
|
fi
|
|
|
|
echo "Starting actual build using the order specified in $ORDERFILE..."
|
|
cd ${USR_PKGSRC}
|
|
nice -n 20 make \
|
|
USE_BULK_CACHE=yes \
|
|
SPECIFIC_PKGS=1 \
|
|
GROUP_SPECIFIC_PKGS="`cat $ORDERFILE | tr '\012' ' '`" \
|
|
bulk-package | sed 's/^/'`uname -p`'> /g'
|
|
|
|
echo "Build finished. Removing all installed packages left over from build..."
|
|
|
|
for pkgname in `pkg_info -e \*`
|
|
do
|
|
if `pkg_info -qe $pkgname`; then
|
|
pkgdir=`grep " $pkgname " $INDEXFILE | awk '{print $1}'`
|
|
case "${BULK_PREREQ}" in
|
|
*$pkgdir* )
|
|
echo "Keeping BULK_PREREQ: $pkgname ($pkgdir)" ;
|
|
;;
|
|
* )
|
|
echo pkg_delete -r $pkgname
|
|
pkg_delete -r $pkgname
|
|
if `pkg_info -qe $pkgname` ; then
|
|
echo "$pkgname ($pkgdir) did not deinstall nicely. Forcing the deinstall"
|
|
pkg_delete -f $pkgname || true
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|
|
done
|
|
|
|
echo "Post processing bulk build results..."
|
|
|
|
#rm $DEPENDSTREEFILE $DEPENDSFILE $SUPPORTSFILE $INDEXFILE $ORDERFILE
|
|
|
|
# Perl was wiped, reinstall it!
|
|
( cd lang/perl5 && make bulk-install )
|
|
perl mk/bulk/post-build | mail -s "pkgsrc/`uname -p` bulk build results `date +%F`" $ADMIN
|
|
|
|
# Done!
|
|
echo ""
|
|
echo Bulk build ended: `date`
|