pkgsrc/mk/bulk/pre-build
dmcmahill c93e1e611d move the code which determines the BROKENFILE and BUILDLOG file names out
of the top level build script and into the {pre,post}-build scripts.  This
ensures that either of those scripts may be run directly and not rely on
a variable being set by the top level script.

Thanks to Hubert Feyrer for pointing out the problem in a private email.

These changes do not require any user changes to the build.conf file and
should be transparent to the user.
2000-12-31 17:38:32 +00:00

111 lines
2.6 KiB
Bash

#!/bin/sh
# $NetBSD: pre-build,v 1.9 2000/12/31 17:38:32 dmcmahill Exp $
#
# Clean up system to be ready for bulk pkg build
#
# (c) 2000 Hubert Feyrer, All Rights Reserved.
#
#set -v # Debug
# Pull in USR_PKGSRC, CVS_USER:
if [ -f "$BULK_BUILD_CONF" ]; then
. $BULK_BUILD_CONF
else
. `dirname $0`/build.conf
fi
PRUNEDISTFILES=${PRUNEDISTFILES:-"yes"}
# extract the name of the files used for the build log and broken build log.
# these have defaults set by bsd.bulk-pkg.mk and may be overridden in /etc/mk.conf
BROKENF=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=BROKENFILE )`;
if [ "$BROKENF" = "" ]; then
echo "Had problems determining the name of the .broken.files"
exit 1
fi
BLDLOG=`( cd $USR_PKGSRC/pkgtools/pkglint ; make show-var VARNAME=BUILDLOG )`;
if [ "$BLDLOG" = "" ]; then
echo "Had problems determining the name of the .make.files"
exit 1
fi
#
# Install cvs package and do a cvs update here
#
if [ "$CVS_USER" != "" ]; then
if [ ! -f /usr/bin/cvs ]; then
echo Installing required cvs pkgs for CVS update
( cd ${USR_PKGSRC}/devel/cvs ; make bulk-install )
fi
if [ ! -f /usr/bin/ssh ]; then
echo Installing required ssh pkgs for CVS update
( cd ${USR_PKGSRC}/security/ssh ; make bulk-install )
fi
echo Performing CVS update - this will take some time
su - ${CVS_USER} -c 'stty sane ; cd '${USR_PKGSRC}' ; cvs -q update -Pd'
echo CVS update done.
fi
#
# Remove old/broken distfiles and binary packages
#
if [ $PRUNEDISTFILES = "yes" -o $PRUNEDISTFILES = "YES" ]; then
echo Removing old/broken distfiles and binary packages
( cd ${USR_PKGSRC}/pkgtools/pkglint ; make bulk-install )
lintpkgsrc -r -P${USR_PKGSRC}
echo done.
else
echo "Skipping distfile pruning."
fi
#
# Clean out everything and it's mother
#
echo Removing all installed packages
mount -o async -u /usr
if [ -d /var/db/pkg ]; then
cd /var/db/pkg
for pkg in *
do
echo pkg_delete -rR $pkg
pkg_delete -rR $pkg
done
for pkg in *
do
echo pkg_delete -rR $pkg
pkg_delete -rR -f $pkg
done
# We've tried our best to get rid of the pkgs, now do it the hard way
# If it wasn't for stuff in $X11BASE, I wouldn't have hard feelings
# about this!
rm -fr *
fi
# General cleanout - easy!
cd /usr/pkg
rm -fr *
rm -fr .??*
# Stuff known to be broken
rm -fr /usr/X11R6/share/gimp
rm -fr /usr/X11R6/share/gnome
rm -fr /usr/X11R6/share/kde
rm -fr /usr/X11R6/share/netscape
rm -fr /var/tmp/inst*
rm -fr /usr/X11R6/lib/libgimp* # gimp doesn't build with old libs around
rm -fr /nonexistant # broken useradd on pop3d
# Clean up state files
cd ${USR_PKGSRC}
rm -f $BROKENF */*/$BROKENF
rm -f $BLDLOG */*/$BLDLOG
rm -f .start*
mount -o noasync -u /usr
touch .start.${arch}