pkgsrc/mk/bulk/build

433 lines
13 KiB
Text
Raw Normal View History

2000-09-16 00:05:46 +02:00
#!/bin/sh
# $NetBSD: build,v 1.63 2005/11/05 15:41:53 rillig Exp $
2000-09-16 00:05:46 +02:00
#
2004-02-25 10:20:59 +01:00
# 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.
2000-09-16 00:05:46 +02:00
#
#
# Do bulk build
2000-09-16 00:05:46 +02:00
#
usage() {
echo "Usage:"
echo " $0 [-m | --mirror_only] [-r | --restart | restart]"
echo " [-s | --specific-pkgs] [-c|--config <fname>]"
echo " $0 -h|--help"
echo ""
echo "Runs a bulk pkgsrc build."
echo ""
echo "The following options are supported:"
echo ""
echo " -h|--help Displays this message."
echo ""
echo " -m|--mirror_only Downloads all distfiles need for the"
echo " build but does not run the build."
echo " IMPORTANT: Note that this will still"
echo " run all the pre-build stuff which involves"
echo " removing all of your installed packages."
echo ""
echo " The only difference between this option"
echo " and a regular bulk build is that the packages"
echo " are not actually built."
echo ""
echo " -r|--restart|restart Restart a previously interrupted bulk build."
echo " last form of this option is for backwards"
echo " compatibility and may be removed in future"
echo " versions of this script."
echo ""
echo " The --restart option may be combined with the"
echo " --mirror_only option."
echo ""
echo " -s|--specific-pkgs Sets SPECIFIC_PKGS=1 when building packages."
echo " This option is used for building a subset of"
echo " pkgsrc."
echo ""
echo " -e|--no-email Don't send email when the bulk build is"
echo " finished, it will put the results into a file"
echo " (FTP/pkgsrc-results.txt)."
echo ""
echo " -c|--config <file> Load the following configuration file instead"
echo " of the default one."
echo ""
}
die() {
echo "$0: error:" 1>&2
for i in "$@"; do
echo " $i" 1>&2
done
exit 1
}
# This function can be overridden in the build.conf file to change the
# output format of the bulk build. It is used in a pipe, so if you want
# the original output, just define post_filter_cmd() { cat; }.
#
# For more sophisticated output, you may use all the variables that this
# example function uses.
post_filter_cmd() {
${SED} "s;^;`date '+%Y/%m/%d %H:%M:%S'` ${built}/${tot}=${percent} ${pkgdir} @ ${MACHINE_ARCH}> ;g"
}
restart=no
mirror_only=no
target=bulk-package
makeargs=""
noemail=no
while [ ${#} -ge 1 ] ; do
case $1 in
--help|-h )
usage
exit 0
;;
--mirror_only|-m )
mirror_only=yes
target=mirror-distfiles
shift
;;
--restart|-r|restart )
restart=yes
shift
;;
--specific-pkgs|-s )
makeargs="$makeargs SPECIFIC_PKGS=1"
shift
;;
--no-email|-e )
noemail=yes
shift
;;
--config|-c )
shift
BULK_BUILD_CONF=$1; shift
;;
-* )
echo "unknown option: $1" 1>&2
usage 1>&2
exit 1
;;
* )
break
;;
esac
done
if [ $# -ne 0 ]; then
usage
exit 1
fi
opsys=`uname -s`
case "$opsys" in
NetBSD) BMAKE=make ;;
*) BMAKE=bmake ;;
esac
export BMAKE
2004-09-22 18:42:29 +02:00
# Set resource limits as high as possible
ulimit -S -s `ulimit -H -s`
ulimit -S -d `ulimit -H -d`
echo "Bulk build started: `date`"
2000-09-16 00:05:46 +02:00
echo ""
# Pull in ADMIN etc.:
: ${BULK_BUILD_CONF:=`dirname $0`/build.conf}
case $BULK_BUILD_CONF in
/*) ;;
*) BULK_BUILD_CONF="`pwd`/${BULK_BUILD_CONF}"
esac
export BULK_BUILD_CONF
if [ -f "${BULK_BUILD_CONF}" ]; then
. "${BULK_BUILD_CONF}"
2000-09-16 00:05:46 +02:00
else
die "Cannot find config file ${BULK_BUILD_CONF}, aborting."
2000-09-16 00:05:46 +02:00
fi
# Check if a valid pkgsrc root directory is given.
case ${USR_PKGSRC-""} in
/*) ;;
*) die "USR_PKGSRC must be set to an absolute pathname.";;
esac
pkgsrc_dir="${USR_PKGSRC}"
perl5_dir="${USR_PKGSRC}/lang/perl5"
pkg_install_dir="${USR_PKGSRC}/pkgtools/pkg_install"
pkglint_dir="${USR_PKGSRC}/pkgtools/pkglint"
# set up variables specifically for the bulk build
BATCH=1
DEPENDS_TARGET=bulk-install
export BATCH DEPENDS_TARGET
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 CDPATH # ensure cd does not print new cwd to stdout, which
# confuses the printindex script.
2000-09-16 00:05:46 +02:00
unset DISPLAY # allow sane failure for gimp, xlispstat
# Check that the pkg_tools are up to date
( cd "${pkglint_dir}" \
&& ${BMAKE} fetch >/dev/null 2>&1
) || {
echo "Updating pkgtools"
( cd "${pkg_install_dir}" \
&& ${BMAKE} clean \
&& ${BMAKE} install \
&& ${BMAKE} clean
) || die "Could not update the package tools."
}
if [ "x$restart" = "xyes" ]; then
echo "Restarting - skipping pre-build script"
2000-09-16 00:05:46 +02:00
else
# make veryveryclean :)
( cd "${pkgsrc_dir}" \
&& /bin/sh mk/bulk/pre-build
) || die "Error during bulk-build preparations, aborting."
2000-09-16 00:05:46 +02:00
fi
fail=no
if cd "${pkglint_dir}"; then
BULK_DBFILE=`${BMAKE} show-var VARNAME=BULK_DBFILE` || fail=yes
DEPENDSTREEFILE=`${BMAKE} show-var VARNAME=DEPENDSTREEFILE` || fail=yes
DEPENDSFILE=`${BMAKE} show-var VARNAME=DEPENDSFILE` || fail=yes
SUPPORTSFILE=`${BMAKE} show-var VARNAME=SUPPORTSFILE` || fail=yes
INDEXFILE=`${BMAKE} show-var VARNAME=INDEXFILE` || fail=yes
ORDERFILE=`${BMAKE} show-var VARNAME=ORDERFILE` || fail=yes
BROKENFILE=`${BMAKE} show-var VARNAME=BROKENFILE` || fail=yes
BROKENWRKLOG=`${BMAKE} show-var VARNAME=BROKENWRKLOG ` || fail=yes
BUILDLOG=`${BMAKE} show-var VARNAME=BUILDLOG` || fail=yes
STARTFILE=`${BMAKE} show-var VARNAME=STARTFILE` || fail=yes
AWK=`${BMAKE} show-var VARNAME=AWK USE_TOOLS=awk` || fail=yes
GREP=`${BMAKE} show-var VARNAME=GREP USE_TOOLS=grep` || fail=yes
SED=`${BMAKE} show-var VARNAME=SED USE_TOOLS=sed` || fail=yes
MAIL_CMD=`${BMAKE} show-var VARNAME=MAIL_CMD USE_TOOLS=mail` || fail=yes
PERL5=`${BMAKE} show-var VARNAME=PERL5 USE_TOOLS=perl` || fail=yes
MACHINE_ARCH=`${BMAKE} show-var VARNAME=MACHINE_ARCH` || fail=yes
OPSYS=`${BMAKE} show-var VARNAME=OPSYS` || fail=yes
OS_VERSION=`${BMAKE} show-var VARNAME=OS_VERSION` || fail=yes
PKG_TOOLS_BIN=`${BMAKE} show-var VARNAME=PKG_TOOLS_BIN` || fail=yes
else
die "The pkgtools/pkglint directory does not exist." \
"Please update your pkgsrc tree in ${pkgsrc_dir}."
fi
echo "+----------------------------------------+"
echo "| Some variables used in the bulk build: |"
echo "+----------------------------------------+"
echo "BULK_DBFILE = $BULK_DBFILE"
echo "DEPENDSTREEFILE = $DEPENDSTREEFILE"
echo "DEPENDSFILE = $DEPENDSFILE"
echo "SUPPORTSFILE = $SUPPORTSFILE"
echo "INDEXFILE = $INDEXFILE"
echo "ORDERFILE = $ORDERFILE"
echo "BROKENFILE = $BROKENFILE"
echo "BROKENWRKLOG = $BROKENWRKLOG"
echo "BUILDLOG = $BUILDLOG"
echo "STARTFILE = $STARTFILE"
echo "AWK = $AWK"
echo "GREP = $GREP"
echo "SED = $SED"
echo "MAIL_CMD = $MAIL_CMD"
echo "PERL5 = $PERL5"
echo "MACHINE_ARCH = $MACHINE_ARCH"
echo "OPSYS = $OPSYS"
echo "OS_VERSION = $OS_VERSION"
echo "PKG_TOOLS_BIN = $PKG_TOOLS_BIN"
echo "------------------------------------------"
# make sure we have values for these very important
# variables
if [ $fail = "yes" -o \
-z "$BULK_DBFILE" -o \
-z "$DEPENDSTREEFILE" -o \
-z "$DEPENDSFILE" -o \
-z "$SUPPORTSFILE" -o \
-z "$INDEXFILE" -o \
-z "$ORDERFILE" -o \
-z "$BROKENFILE" -o \
-z "$BROKENWRKLOG" -o \
-z "$BUILDLOG" -o \
-z "$STARTFILE" -o \
-z "$AWK" -o \
-z "$GREP" -o \
-z "$SED" -o \
-z "$MAIL_CMD" -o \
-z "$PERL5" -o \
-z "$MACHINE_ARCH" -o \
-z "$OPSYS" -o \
-z "$PKG_TOOLS_BIN" -o \
-z "$OS_VERSION" \
]; then
die "Failed to extract certain key variables." \
"Please examine the above list and correct the problem."
fi
# get the list of packages which should always be installed during the build
{ cd "${pkglint_dir}" \
&& BULK_PREREQ=`${BMAKE} show-var VARNAME=BULK_PREREQ`
} || die "Could not get the value of BULK_PREREQ."
# 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 "${pkgsrc_dir}/${pkgdir}" \
&& ${BMAKE} bulk-install
) || die "Could not install prerequisite packages."
done
# Create the bulk cache files
if [ "x$restart" != "xyes" ]; then
( cd "${pkgsrc_dir}" \
&& ${BMAKE} bulk-cache $makeargs
) || die "Could not create the bulk build cache."
2000-09-16 00:05:46 +02:00
fi
This commit incorporates several speed improvements which have been tested over several bulk builds on an alpha: - At the start of a bulk build, 4 files are created to allow fast lookup of various dependency tree things. These files are .index == maps package name (foo-2.3) to directory (bar/foo) .dependstree == contains the complete pkgsrc dependency tree in a tsort(1) compatible format. .depends == contains 1 line per package and lists all the build depends for the package. .supports == contains 1 line per package and lists all packages which depend on this package. - When a package fails to build, the list of all packages which depend upon it is read from .supports. Each of those packages is immediately marked as broken. This prevents us from trying to build those packages which can have significant overhead if lots of other depends are installed before the system notices the broken one. In addition, the post-build postprocessing will now indicate that a package is 'truely broken' (ie, bad PLIST, failed compilation) vs. a package which is broken because it depends on a failed package. This assists in determining where to focus our efforts in fixing broken packages. - In the old approach, all packages are removed after each one is built. The purpose was to a) conserve disk space, b) verify that all required dependencies are in fact listed, and c) prevent conflicts. The problem was that often times several packages in a row have similar depends. For example we might want to build several perl packages in a row. In the old approach, we would install perl, build the pkg, deinstall perl and continue with the next one. In the new approach, when it is decided that a pkg is out of date and should be rebuilt, the .depends file is used to obtain a list of pkgs we require. Then and pkgs which are no longer needed are removed. This helps to minimize the total number of pkg_add/pkg_delete's in a bulk build. - Since the order of the build is controlled by the depends tree, all depends for a given package will have been built by the time the pkg in question needs them. If any of the depends failed to build, then the pkg which needs the failed one will have been marked as broken. Given this, the complete depends list for a pkg is read from .depends and the depends installed via pkg_add rather than relying on recursive make calls to install the depends. - while here, fix a few minor bugs x - don't leave .make log files around when the build succeeds x - make sure we refer to the correct report file in the email x - use '.order' for the build order file instead of '.l' x - use 'grep -c' instead of 'grep | wc -l'
2001-02-01 09:47:29 +01:00
cd "${pkgsrc_dir}" || die "The pkgsrc directory does not exist."
This commit incorporates several speed improvements which have been tested over several bulk builds on an alpha: - At the start of a bulk build, 4 files are created to allow fast lookup of various dependency tree things. These files are .index == maps package name (foo-2.3) to directory (bar/foo) .dependstree == contains the complete pkgsrc dependency tree in a tsort(1) compatible format. .depends == contains 1 line per package and lists all the build depends for the package. .supports == contains 1 line per package and lists all packages which depend on this package. - When a package fails to build, the list of all packages which depend upon it is read from .supports. Each of those packages is immediately marked as broken. This prevents us from trying to build those packages which can have significant overhead if lots of other depends are installed before the system notices the broken one. In addition, the post-build postprocessing will now indicate that a package is 'truely broken' (ie, bad PLIST, failed compilation) vs. a package which is broken because it depends on a failed package. This assists in determining where to focus our efforts in fixing broken packages. - In the old approach, all packages are removed after each one is built. The purpose was to a) conserve disk space, b) verify that all required dependencies are in fact listed, and c) prevent conflicts. The problem was that often times several packages in a row have similar depends. For example we might want to build several perl packages in a row. In the old approach, we would install perl, build the pkg, deinstall perl and continue with the next one. In the new approach, when it is decided that a pkg is out of date and should be rebuilt, the .depends file is used to obtain a list of pkgs we require. Then and pkgs which are no longer needed are removed. This helps to minimize the total number of pkg_add/pkg_delete's in a bulk build. - Since the order of the build is controlled by the depends tree, all depends for a given package will have been built by the time the pkg in question needs them. If any of the depends failed to build, then the pkg which needs the failed one will have been marked as broken. Given this, the complete depends list for a pkg is read from .depends and the depends installed via pkg_add rather than relying on recursive make calls to install the depends. - while here, fix a few minor bugs x - don't leave .make log files around when the build succeeds x - make sure we refer to the correct report file in the email x - use '.order' for the build order file instead of '.l' x - use 'grep -c' instead of 'grep | wc -l'
2001-02-01 09:47:29 +01:00
echo "Starting actual build using the order specified in $ORDERFILE..."
# make sure we have something to grep in in the build loop
touch "${BUILDLOG}"
# set the nice level for bulk builds
#case "${NICE_LEVEL}" in
#"") NICE_LEVEL="nice -n 20" ;;
#esac
# Loop over every package in the correct order. Before building
# each one, check to see if we've already processed this package
# before. This could happen if the build got interrupted and we
# started it again with the 'restart' option. This prevents us
# from having to do a potentially very large number of make's to
# get back to where we let off. After we build each package, add
# it to the top level buildlog
# (usually '.make' or '.make.${MACHINE}'). As a side benefit, this
# can make a progress-meter very simple to add!
tot=`wc -l $ORDERFILE | ${AWK} '{print $1}'`
for pkgdir in `cat $ORDERFILE`
do
${GREP} -q "^${pkgdir}\$" $BUILDLOG
if [ $? -ne 0 ]; then
built=`wc -l $BUILDLOG | ${AWK} '{print $1}'`
percent=`echo $built $tot | ${AWK} '{printf("%4.1f%%",$1*100/$2);}'`
( cd "${pkgsrc_dir}/${pkgdir}" \
&& ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes $target \
$makeargs </dev/null | post_filter_cmd
) || true
echo "$pkgdir" >> $BUILDLOG
fi
done
This commit incorporates several speed improvements which have been tested over several bulk builds on an alpha: - At the start of a bulk build, 4 files are created to allow fast lookup of various dependency tree things. These files are .index == maps package name (foo-2.3) to directory (bar/foo) .dependstree == contains the complete pkgsrc dependency tree in a tsort(1) compatible format. .depends == contains 1 line per package and lists all the build depends for the package. .supports == contains 1 line per package and lists all packages which depend on this package. - When a package fails to build, the list of all packages which depend upon it is read from .supports. Each of those packages is immediately marked as broken. This prevents us from trying to build those packages which can have significant overhead if lots of other depends are installed before the system notices the broken one. In addition, the post-build postprocessing will now indicate that a package is 'truely broken' (ie, bad PLIST, failed compilation) vs. a package which is broken because it depends on a failed package. This assists in determining where to focus our efforts in fixing broken packages. - In the old approach, all packages are removed after each one is built. The purpose was to a) conserve disk space, b) verify that all required dependencies are in fact listed, and c) prevent conflicts. The problem was that often times several packages in a row have similar depends. For example we might want to build several perl packages in a row. In the old approach, we would install perl, build the pkg, deinstall perl and continue with the next one. In the new approach, when it is decided that a pkg is out of date and should be rebuilt, the .depends file is used to obtain a list of pkgs we require. Then and pkgs which are no longer needed are removed. This helps to minimize the total number of pkg_add/pkg_delete's in a bulk build. - Since the order of the build is controlled by the depends tree, all depends for a given package will have been built by the time the pkg in question needs them. If any of the depends failed to build, then the pkg which needs the failed one will have been marked as broken. Given this, the complete depends list for a pkg is read from .depends and the depends installed via pkg_add rather than relying on recursive make calls to install the depends. - while here, fix a few minor bugs x - don't leave .make log files around when the build succeeds x - make sure we refer to the correct report file in the email x - use '.order' for the build order file instead of '.l' x - use 'grep -c' instead of 'grep | wc -l'
2001-02-01 09:47:29 +01:00
echo "Build finished. Removing all installed packages left over from build..."
for pkgname in `${PKG_TOOLS_BIN}/pkg_info -e \*`
This commit incorporates several speed improvements which have been tested over several bulk builds on an alpha: - At the start of a bulk build, 4 files are created to allow fast lookup of various dependency tree things. These files are .index == maps package name (foo-2.3) to directory (bar/foo) .dependstree == contains the complete pkgsrc dependency tree in a tsort(1) compatible format. .depends == contains 1 line per package and lists all the build depends for the package. .supports == contains 1 line per package and lists all packages which depend on this package. - When a package fails to build, the list of all packages which depend upon it is read from .supports. Each of those packages is immediately marked as broken. This prevents us from trying to build those packages which can have significant overhead if lots of other depends are installed before the system notices the broken one. In addition, the post-build postprocessing will now indicate that a package is 'truely broken' (ie, bad PLIST, failed compilation) vs. a package which is broken because it depends on a failed package. This assists in determining where to focus our efforts in fixing broken packages. - In the old approach, all packages are removed after each one is built. The purpose was to a) conserve disk space, b) verify that all required dependencies are in fact listed, and c) prevent conflicts. The problem was that often times several packages in a row have similar depends. For example we might want to build several perl packages in a row. In the old approach, we would install perl, build the pkg, deinstall perl and continue with the next one. In the new approach, when it is decided that a pkg is out of date and should be rebuilt, the .depends file is used to obtain a list of pkgs we require. Then and pkgs which are no longer needed are removed. This helps to minimize the total number of pkg_add/pkg_delete's in a bulk build. - Since the order of the build is controlled by the depends tree, all depends for a given package will have been built by the time the pkg in question needs them. If any of the depends failed to build, then the pkg which needs the failed one will have been marked as broken. Given this, the complete depends list for a pkg is read from .depends and the depends installed via pkg_add rather than relying on recursive make calls to install the depends. - while here, fix a few minor bugs x - don't leave .make log files around when the build succeeds x - make sure we refer to the correct report file in the email x - use '.order' for the build order file instead of '.l' x - use 'grep -c' instead of 'grep | wc -l'
2001-02-01 09:47:29 +01:00
do
${PKG_TOOLS_BIN}/pkg_info -qe $pkgname
if [ $? -eq 0 ]; then
pkgdir=`${AWK} "/ $pkgname /"'{print $1}{}' $INDEXFILE`
case "${BULK_PREREQ}" in
*$pkgdir* )
echo "Keeping BULK_PREREQ: $pkgname ($pkgdir)" ;
;;
* )
echo ${PKG_TOOLS_BIN}/pkg_delete -r $pkgname
${PKG_TOOLS_BIN}/pkg_delete -r $pkgname
${PKG_TOOLS_BIN}/pkg_info -qe $pkgname
if [ $? -eq 0 ]; then
echo "$pkgname ($pkgdir) did not deinstall nicely. Forcing the deinstall"
${PKG_TOOLS_BIN}/pkg_delete -f $pkgname || true
fi
;;
esac
This commit incorporates several speed improvements which have been tested over several bulk builds on an alpha: - At the start of a bulk build, 4 files are created to allow fast lookup of various dependency tree things. These files are .index == maps package name (foo-2.3) to directory (bar/foo) .dependstree == contains the complete pkgsrc dependency tree in a tsort(1) compatible format. .depends == contains 1 line per package and lists all the build depends for the package. .supports == contains 1 line per package and lists all packages which depend on this package. - When a package fails to build, the list of all packages which depend upon it is read from .supports. Each of those packages is immediately marked as broken. This prevents us from trying to build those packages which can have significant overhead if lots of other depends are installed before the system notices the broken one. In addition, the post-build postprocessing will now indicate that a package is 'truely broken' (ie, bad PLIST, failed compilation) vs. a package which is broken because it depends on a failed package. This assists in determining where to focus our efforts in fixing broken packages. - In the old approach, all packages are removed after each one is built. The purpose was to a) conserve disk space, b) verify that all required dependencies are in fact listed, and c) prevent conflicts. The problem was that often times several packages in a row have similar depends. For example we might want to build several perl packages in a row. In the old approach, we would install perl, build the pkg, deinstall perl and continue with the next one. In the new approach, when it is decided that a pkg is out of date and should be rebuilt, the .depends file is used to obtain a list of pkgs we require. Then and pkgs which are no longer needed are removed. This helps to minimize the total number of pkg_add/pkg_delete's in a bulk build. - Since the order of the build is controlled by the depends tree, all depends for a given package will have been built by the time the pkg in question needs them. If any of the depends failed to build, then the pkg which needs the failed one will have been marked as broken. Given this, the complete depends list for a pkg is read from .depends and the depends installed via pkg_add rather than relying on recursive make calls to install the depends. - while here, fix a few minor bugs x - don't leave .make log files around when the build succeeds x - make sure we refer to the correct report file in the email x - use '.order' for the build order file instead of '.l' x - use 'grep -c' instead of 'grep | wc -l'
2001-02-01 09:47:29 +01:00
fi
done
# for now, just quit if we were only mirroring distfiles. At somepoint we
# should teach the post-build script to generate a nice report about how many
# distfiles were downloaded, how many had bad checksums, failed master sites,
# network speed, etc.
if [ "x$mirror_only" = "xyes" ]; then
echo "Bulk mirror of distfiles completed: `date`"
exit 0
fi
This commit incorporates several speed improvements which have been tested over several bulk builds on an alpha: - At the start of a bulk build, 4 files are created to allow fast lookup of various dependency tree things. These files are .index == maps package name (foo-2.3) to directory (bar/foo) .dependstree == contains the complete pkgsrc dependency tree in a tsort(1) compatible format. .depends == contains 1 line per package and lists all the build depends for the package. .supports == contains 1 line per package and lists all packages which depend on this package. - When a package fails to build, the list of all packages which depend upon it is read from .supports. Each of those packages is immediately marked as broken. This prevents us from trying to build those packages which can have significant overhead if lots of other depends are installed before the system notices the broken one. In addition, the post-build postprocessing will now indicate that a package is 'truely broken' (ie, bad PLIST, failed compilation) vs. a package which is broken because it depends on a failed package. This assists in determining where to focus our efforts in fixing broken packages. - In the old approach, all packages are removed after each one is built. The purpose was to a) conserve disk space, b) verify that all required dependencies are in fact listed, and c) prevent conflicts. The problem was that often times several packages in a row have similar depends. For example we might want to build several perl packages in a row. In the old approach, we would install perl, build the pkg, deinstall perl and continue with the next one. In the new approach, when it is decided that a pkg is out of date and should be rebuilt, the .depends file is used to obtain a list of pkgs we require. Then and pkgs which are no longer needed are removed. This helps to minimize the total number of pkg_add/pkg_delete's in a bulk build. - Since the order of the build is controlled by the depends tree, all depends for a given package will have been built by the time the pkg in question needs them. If any of the depends failed to build, then the pkg which needs the failed one will have been marked as broken. Given this, the complete depends list for a pkg is read from .depends and the depends installed via pkg_add rather than relying on recursive make calls to install the depends. - while here, fix a few minor bugs x - don't leave .make log files around when the build succeeds x - make sure we refer to the correct report file in the email x - use '.order' for the build order file instead of '.l' x - use 'grep -c' instead of 'grep | wc -l'
2001-02-01 09:47:29 +01:00
echo "Post processing bulk build results..."
#rm $DEPENDSTREEFILE $DEPENDSFILE $SUPPORTSFILE $INDEXFILE $ORDERFILE
2000-09-16 00:05:46 +02:00
# Re-install BULK_PREREQ as we may need functionality (e.g. SMTP) provided by
# them for post-build to run.
echo "Re-installing prerequisite packages specified with BULK_PREREQ..."
for pkgdir in $BULK_PREREQ
do
echo $pkgdir
( cd "${pkgsrc_dir}/${pkgdir}" && ${BMAKE} bulk-install )
done
2000-09-16 00:05:46 +02:00
# Perl was wiped, reinstall it!
( cd "${perl5_dir}" && ${BMAKE} bulk-install )
BUILDDATE=`date +%Y-%m-%d`
mkdir -p ${FTP}
${PERL5} mk/bulk/post-build > ${FTP}/pkgsrc-results-${BUILDDATE}.txt
if [ "$noemail" = "no" ]; then
${MAIL_CMD} -s "pkgsrc ${OPSYS} ${OS_VERSION}/${MACHINE_ARCH} bulk build results $BUILDDATE" $ADMIN < ${FTP}/pkgsrc-results-${BUILDDATE}.txt
fi
2000-09-16 00:05:46 +02:00
# Done!
echo ""
echo "Bulk build ended: `date`"