2006-12-15 13:46:23 +01:00
|
|
|
#!/bin/sh
|
2009-07-09 14:46:49 +02:00
|
|
|
# $NetBSD: build,v 1.106 2009/07/09 12:46:49 he Exp $
|
2001-10-12 21:28:02 +02:00
|
|
|
|
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>
|
2001-10-12 21:28:02 +02:00
|
|
|
# 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
|
|
|
#
|
2001-10-12 21:28:02 +02:00
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
##
|
|
|
|
## Globals
|
|
|
|
##
|
|
|
|
scriptdir=`dirname "$0"`
|
|
|
|
scriptdir=`cd "${scriptdir}" && pwd`
|
|
|
|
|
2001-10-12 21:28:02 +02:00
|
|
|
#
|
2006-11-27 01:05:22 +01:00
|
|
|
# Default values for command line options.
|
2000-09-16 00:05:46 +02:00
|
|
|
#
|
2006-11-27 01:05:22 +01:00
|
|
|
resume=no
|
|
|
|
mirror_only=no
|
|
|
|
target=bulk-package
|
|
|
|
makeargs=""
|
|
|
|
noemail=no
|
|
|
|
post_only=no
|
2007-06-15 17:52:22 +02:00
|
|
|
prepare_only=no
|
2000-09-16 00:05:46 +02:00
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
##
|
|
|
|
## Functions
|
|
|
|
##
|
|
|
|
|
|
|
|
usage () {
|
2005-11-05 22:38:34 +01:00
|
|
|
cat <<EOF
|
|
|
|
usage: $0 [options]
|
|
|
|
$0 -h | --help
|
|
|
|
|
|
|
|
Runs a bulk pkgsrc build.
|
|
|
|
|
|
|
|
The following options are supported:
|
|
|
|
|
|
|
|
-c | --config <file>
|
2005-11-06 00:22:05 +01:00
|
|
|
Load the following configuration file instead of the default
|
2005-11-05 22:38:34 +01:00
|
|
|
one.
|
|
|
|
|
|
|
|
-e | --no-email
|
2006-01-21 12:29:31 +01:00
|
|
|
Don't send email when the bulk build is finished.
|
2005-11-05 22:38:34 +01:00
|
|
|
|
|
|
|
-h | --help
|
2005-11-06 00:22:05 +01:00
|
|
|
Displays this message.
|
2005-11-05 22:38:34 +01:00
|
|
|
|
|
|
|
-m | --mirror_only
|
2005-11-06 00:22:05 +01:00
|
|
|
Downloads all distfiles needed for the build but does not run
|
2005-11-05 22:38:34 +01:00
|
|
|
the build. IMPORTANT: Note that this will still run all the
|
2005-11-06 00:22:05 +01:00
|
|
|
pre-build stuff which involves removing all of your installed
|
|
|
|
packages.
|
2005-11-05 22:38:34 +01:00
|
|
|
|
2005-11-06 00:22:05 +01:00
|
|
|
The only difference between this option and a regular bulk build
|
2005-11-05 22:38:34 +01:00
|
|
|
is that the packages are not actually built.
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
-p | --post-build
|
|
|
|
Run the post-build processing and generate the report only.
|
|
|
|
|
2007-06-15 17:52:22 +02:00
|
|
|
--prepare
|
|
|
|
Only generate the package database that will be used when bulk
|
|
|
|
building the packages.
|
|
|
|
|
2006-02-11 22:44:16 +01:00
|
|
|
-r | --resume
|
|
|
|
Resume a previously interrupted bulk build.
|
2005-11-05 22:38:34 +01:00
|
|
|
|
2006-02-11 22:44:16 +01:00
|
|
|
The --resume option may be combined with the --mirror_only
|
2005-11-06 00:22:05 +01:00
|
|
|
option.
|
2005-11-05 22:38:34 +01:00
|
|
|
|
|
|
|
-s | --specific-pkgs
|
2005-11-06 00:22:05 +01:00
|
|
|
Sets SPECIFIC_PKGS=1 when building packages. This option is
|
|
|
|
used for building a subset of pkgsrc.
|
2005-11-05 22:38:34 +01:00
|
|
|
|
|
|
|
EOF
|
2004-04-09 13:06:35 +02:00
|
|
|
}
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
# print out error message and exit 1
|
|
|
|
die () {
|
2005-11-05 15:33:17 +01:00
|
|
|
echo "$0: error:" 1>&2
|
|
|
|
for i in "$@"; do
|
|
|
|
echo " $i" 1>&2
|
|
|
|
done
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2005-11-05 16:41:53 +01:00
|
|
|
# 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() {
|
2006-11-19 04:06:26 +01:00
|
|
|
${SED} "s;^;`date '+%Y/%m/%d %H:%M:%S'` ${percent} ${pkgdir} @ ${MACHINE_ARCH}> ;g"
|
2005-11-05 16:41:53 +01:00
|
|
|
}
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
# perform post-processing of the bulk-build results
|
|
|
|
do_post_build () {
|
|
|
|
echo "build> Post processing bulk build results..."
|
2001-10-20 02:30:22 +02:00
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
# Re-install BULK_PREREQ as we may need functionality (e.g. SMTP) provided by
|
|
|
|
# them for post-build to run.
|
|
|
|
echo "build> Re-installing prerequisite packages specified with BULK_PREREQ..."
|
|
|
|
for pkgdir in $BULK_PREREQ lang/perl5; do
|
|
|
|
echo "build> Installing prerequisite package $pkgdir"
|
|
|
|
( cd "${pkgsrc_dir}/${pkgdir}" \
|
|
|
|
&& ${BMAKE} bulk-install
|
|
|
|
) || die "Failed to install prerequisite packages."
|
|
|
|
done
|
2005-11-20 12:18:45 +01:00
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
#
|
|
|
|
# Generate the post-build report.
|
|
|
|
#
|
|
|
|
echo "build> Generating the bulk build report..."
|
|
|
|
|
|
|
|
bulk_build_id=`cat "${BULK_BUILD_ID_FILE}"` \
|
|
|
|
|| die "Could not read the bulk build ID from ${BULK_BUILD_ID_FILE}."
|
|
|
|
|
|
|
|
report_dir="${REPORTS_DIR}/${bulk_build_id}"
|
|
|
|
${MKDIR} "${report_dir}"
|
|
|
|
( cd "${pkgsrc_dir}" \
|
|
|
|
&& ${PERL5} mk/bulk/post-build \
|
|
|
|
> "${report_dir}/${REPORT_TXT_FILE}"
|
|
|
|
) || die "Could not write the results file."
|
|
|
|
}
|
|
|
|
|
|
|
|
# Notify the ADMIN of the finished build.
|
|
|
|
do_email () {
|
|
|
|
case $noemail in
|
|
|
|
no) cat "${report_dir}/${REPORT_TXT_FILE}" \
|
|
|
|
| ${MAIL_CMD} -s "pkgsrc ${OPSYS} ${OS_VERSION}/${MACHINE_ARCH} bulk build results ${bulk_build_id}" "$ADMIN"
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# output final note that we're done
|
|
|
|
do_done () {
|
|
|
|
echo ""
|
|
|
|
echo "build> Bulk build ended: `date`"
|
|
|
|
}
|
|
|
|
|
|
|
|
# set all commonly used variables, prepare files etc.
|
|
|
|
do_common_setup () {
|
|
|
|
|
|
|
|
#
|
|
|
|
# Choose an appropriate value for BMAKE depending on the operating
|
|
|
|
# system.
|
|
|
|
#
|
|
|
|
opsys=`uname -s`
|
|
|
|
case "$opsys" in
|
|
|
|
NetBSD) BMAKE=make ;;
|
|
|
|
*) BMAKE=bmake ;;
|
|
|
|
esac
|
|
|
|
export BMAKE
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set resource limits as high as possible
|
|
|
|
#
|
2007-01-18 10:04:53 +01:00
|
|
|
ulimit -S -s `ulimit -H -s` # XXX: why do we need unlimited stack?
|
|
|
|
ulimit -S -d `ulimit -H -d` # some processes grow rather large
|
|
|
|
ulimit -S -t `ulimit -H -t` # pkgsrc bulk builds need _much_ time
|
2006-11-27 01:05:22 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Find the configuration file.
|
|
|
|
#
|
|
|
|
BULK_BUILD_CONF="${BULK_BUILD_CONF-${scriptdir}/build.conf}"
|
|
|
|
case $BULK_BUILD_CONF in
|
|
|
|
/*) ;;
|
|
|
|
*) BULK_BUILD_CONF="${PWD}/${BULK_BUILD_CONF}"
|
|
|
|
esac
|
|
|
|
|
|
|
|
#
|
|
|
|
# Load the variables from the configuration file.
|
|
|
|
#
|
|
|
|
{ test -f "${BULK_BUILD_CONF}" \
|
|
|
|
&& . "${BULK_BUILD_CONF}" \
|
|
|
|
&& . "${scriptdir}/post-build-conf" \
|
|
|
|
&& check_config_vars \
|
|
|
|
&& export_config_vars
|
|
|
|
} || die "Cannot load config file ${BULK_BUILD_CONF}, aborting."
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set the paths to commonly used directories.
|
|
|
|
#
|
|
|
|
pkgsrc_dir="${USR_PKGSRC}"
|
2008-01-04 16:49:07 +01:00
|
|
|
lintpkgsrc_dir="${USR_PKGSRC}/pkgtools/lintpkgsrc"
|
2006-11-27 01:05:22 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Set up variables specific for the bulk build.
|
|
|
|
#
|
|
|
|
BATCH="1"
|
|
|
|
DEPENDS_TARGET="bulk-install"
|
|
|
|
export BATCH DEPENDS_TARGET
|
|
|
|
|
|
|
|
#
|
|
|
|
# Unset some environment variables that could disturbe the build.
|
|
|
|
#
|
|
|
|
unset CDPATH || true # ensure cd does not print new cwd to stdout, which
|
|
|
|
# confuses the printindex script.
|
|
|
|
unset DISPLAY || true # allow sane failure for gimp, xlispstat
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check that the package tools are up to date.
|
|
|
|
check_tools () {
|
|
|
|
echo "build> Checking if the pkgtools are up-to-date"
|
2008-01-04 16:49:07 +01:00
|
|
|
( cd "${lintpkgsrc_dir}" \
|
2006-11-27 01:05:22 +01:00
|
|
|
&& ${BMAKE} fetch >/dev/null 2>&1
|
|
|
|
) || {
|
|
|
|
echo "build> Updating pkgtools"
|
|
|
|
( cd "${pkgsrc_dir}/pkgtools/pkg_install" \
|
|
|
|
&& ${BMAKE} clean \
|
2008-06-08 23:04:30 +02:00
|
|
|
&& ${BMAKE} update
|
2006-11-27 01:05:22 +01:00
|
|
|
) || die "Could not update the package tools."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Run the pre-build script if necessary.
|
|
|
|
run_pre_build () {
|
|
|
|
case $resume in
|
|
|
|
yes) echo "build> Resuming -- skipping pre-build script";;
|
|
|
|
*) # make veryveryclean :)
|
|
|
|
( cd "${pkgsrc_dir}" \
|
|
|
|
&& /bin/sh mk/bulk/pre-build
|
|
|
|
) || die "Error during bulk-build preparations, aborting.";;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# Load pkgsrc variables that affect the build process.
|
|
|
|
load_vars () {
|
|
|
|
echo "+----------------------------------------+"
|
|
|
|
echo "| Some variables used in the bulk build: |"
|
|
|
|
echo "+----------------------------------------+"
|
2007-02-21 15:25:20 +01:00
|
|
|
|
|
|
|
vars=" OPSYS OS_VERSION MACHINE_ARCH
|
|
|
|
BULK_PREREQ
|
|
|
|
BULKFILESDIR
|
|
|
|
BULK_DBFILE DEPENDSFILE INDEXFILE ORDERFILE STARTFILE
|
|
|
|
SUPPORTSFILE BULK_BUILD_ID_FILE BUILDLOG BROKENFILE
|
|
|
|
BROKENWRKLOG
|
2009-07-09 14:46:49 +02:00
|
|
|
PREFIX
|
2008-06-13 23:52:16 +02:00
|
|
|
AWK GREP MAIL_CMD MKDIR PAX PERL5 SED
|
2007-02-21 15:25:20 +01:00
|
|
|
PKG_DELETE PKG_INFO PKGBASE"
|
|
|
|
|
2008-06-13 23:52:16 +02:00
|
|
|
values=`cd "$lintpkgsrc_dir" && $BMAKE show-vars VARNAMES="$vars" USE_TOOLS="awk grep mail mkdir pax perl sed"`
|
2007-02-21 15:25:20 +01:00
|
|
|
|
|
|
|
for v in $vars; do
|
|
|
|
eval "read $v" || die "Could not read value for $v"
|
|
|
|
eval "value=\$$v"
|
|
|
|
if [ "$v" != "BULK_PREREQ" ] && [ ! "$value" ]; then
|
|
|
|
die "$v must not be empty."
|
|
|
|
fi
|
|
|
|
printf "%-15s = %s\\n" "$v" "$value"
|
|
|
|
done <<EOF
|
|
|
|
$values
|
|
|
|
EOF
|
2006-11-27 01:05:22 +01:00
|
|
|
echo "------------------------------------------"
|
2008-01-04 16:49:07 +01:00
|
|
|
[ "$PKGBASE" = "lintpkgsrc" ] \
|
2007-03-08 00:32:49 +01:00
|
|
|
|| die "Error reading the variables." \
|
|
|
|
"Try running $0 with another shell."
|
2006-11-27 01:05:22 +01:00
|
|
|
|
|
|
|
# Get the location of commonly used files
|
|
|
|
main_buildlog="${BULKFILESDIR}/${BUILDLOG}"
|
|
|
|
}
|
2006-01-21 12:29:31 +01:00
|
|
|
|
2005-11-05 17:36:16 +01:00
|
|
|
# Install prerequisite packages.
|
|
|
|
#
|
|
|
|
# Note: we do this _before_ the depends tree because some packages like
|
|
|
|
# xpkgwedge only become DEPENDS if they are installed.
|
2006-11-27 01:05:22 +01:00
|
|
|
install_prereqs () {
|
|
|
|
echo "build> Installing prerequisite packages specified with BULK_PREREQ..."
|
|
|
|
for pkgdir in $BULK_PREREQ; do
|
|
|
|
echo "build> Installing prerequisite package $pkgdir"
|
|
|
|
( cd "${pkgsrc_dir}/${pkgdir}" \
|
|
|
|
&& ${BMAKE} bulk-install
|
|
|
|
) || die "Could not install prerequisite packages."
|
|
|
|
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
|
|
|
|
2005-11-05 17:36:16 +01:00
|
|
|
# Everything is prepared. We can start building the real packages now.
|
|
|
|
#
|
2001-10-20 02:30:22 +02:00
|
|
|
# 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
|
2006-02-11 22:44:16 +01:00
|
|
|
# started it again with the '-resume' option. This prevents us
|
2001-10-20 02:30:22 +02:00
|
|
|
# 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!
|
2006-11-27 01:05:22 +01:00
|
|
|
do_real_bulk_build () {
|
|
|
|
|
|
|
|
cd "${pkgsrc_dir}" || die "The pkgsrc directory does not exist."
|
|
|
|
|
|
|
|
echo "build> Starting actual build using the order specified in $ORDERFILE..."
|
|
|
|
|
|
|
|
# make sure we have something to grep in in the build loop
|
|
|
|
touch "${main_buildlog}" || die "Cannot write to ${main_buildlog}."
|
|
|
|
|
|
|
|
tot=`${AWK} 'END { print NR }' "${ORDERFILE}"`
|
|
|
|
for pkgdir in `cat "${ORDERFILE}"`
|
|
|
|
do
|
|
|
|
if ${GREP} -q "^${pkgdir}\$" "${main_buildlog}"; then
|
|
|
|
: "skip this package"
|
|
|
|
else
|
|
|
|
percent=`${AWK} -v tot="${tot}" '
|
|
|
|
END {
|
|
|
|
printf("%d/%d=%4.1f%%", NR, tot, NR*100/tot);
|
|
|
|
}' "${main_buildlog}"`
|
|
|
|
( cd "${pkgsrc_dir}/${pkgdir}" \
|
|
|
|
&& ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes "${target}" \
|
|
|
|
$makeargs </dev/null | post_filter_cmd
|
|
|
|
) || true
|
|
|
|
echo "$pkgdir" >> "${main_buildlog}"
|
2009-07-09 14:46:49 +02:00
|
|
|
check_pkg_dirs
|
2006-11-27 01:05:22 +01:00
|
|
|
fi
|
|
|
|
done
|
2001-10-20 02:30:22 +02:00
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
echo "build> Build finished."
|
|
|
|
}
|
2005-11-05 17:36:16 +01:00
|
|
|
|
2009-07-09 14:46:49 +02:00
|
|
|
check_pkg_dirs () {
|
|
|
|
for d in bin etc include info lib libexec man sbin share; do
|
|
|
|
if [ -f $PREFIX/$d ]; then
|
|
|
|
echo "Removing file, should be dir: $PREFIX/$d" >&2
|
|
|
|
rm -f $PREFIX/$d
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
# clean up installed packages left over
|
|
|
|
do_bulk_cleanup () {
|
|
|
|
|
|
|
|
echo "build> Removing all installed packages left over from build..."
|
|
|
|
for pkgname in `${PKG_INFO} -e \*`
|
|
|
|
do
|
|
|
|
if ${PKG_INFO} -qe "${pkgname}"; then
|
|
|
|
pkgdir=`${AWK} '$2 == "'"$pkgname"'" { print $1; }' "$INDEXFILE"`
|
|
|
|
case "${BULK_PREREQ}" in
|
|
|
|
*"${pkgdir}"* )
|
|
|
|
echo "build> Keeping BULK_PREREQ: $pkgname ($pkgdir)" ;
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo "build> ${PKG_DELETE} -r ${pkgname}"
|
|
|
|
${PKG_DELETE} -r "${pkgname}"
|
|
|
|
if ${PKG_INFO} -qe "${pkgname}"; then
|
|
|
|
echo "build> $pkgname ($pkgdir) did not deinstall nicely. Forcing the deinstall"
|
|
|
|
${PKG_DELETE} -f "${pkgname}" || true
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# start the full bulk-build
|
|
|
|
do_bulk_build () {
|
|
|
|
echo "build> Bulk build started: `date`"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# this function from post-build-conf
|
|
|
|
show_config_vars
|
|
|
|
|
|
|
|
check_tools
|
|
|
|
run_pre_build
|
|
|
|
load_vars
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create the directory for the log files if necessary
|
|
|
|
#
|
|
|
|
if [ "${BULKFILESDIR}" != "${pkgsrc_dir}" ]; then
|
|
|
|
${MKDIR} "${BULKFILESDIR}"
|
2001-10-20 02:30:22 +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
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
#
|
|
|
|
# Save the bulk build ID in a file, as it most often contains a time
|
|
|
|
# stamp.
|
|
|
|
#
|
|
|
|
case $resume in
|
|
|
|
no) echo "${REPORT_BASEDIR}" > "${BULK_BUILD_ID_FILE}" \
|
|
|
|
|| die "Could not save the bulk build ID in ${BULK_BUILD_ID_FILE}.";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
install_prereqs
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create the bulk cache files.
|
|
|
|
#
|
|
|
|
if [ "x$resume" != "xyes" ]; then
|
|
|
|
( cd "${pkgsrc_dir}" \
|
|
|
|
&& env PKGLIST="${PKGLIST-}" ${BMAKE} bulk-cache $makeargs
|
|
|
|
) || die "Could not create the bulk build cache."
|
|
|
|
else
|
|
|
|
if [ ! -f "${ORDERFILE}" ]; then
|
|
|
|
die "The ${ORDERFILE} does not exist." \
|
|
|
|
"(You cannot resume a bulk build that has not yet started.)"
|
|
|
|
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
|
|
|
fi
|
2006-11-27 01:05:22 +01:00
|
|
|
|
2007-06-15 17:52:22 +02:00
|
|
|
# XXX: This looks like a hack, and indeed, the functions in this file
|
|
|
|
# should be reorganized to better reflect the phases of the bulk build.
|
|
|
|
if [ $prepare_only = yes ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
do_real_bulk_build
|
|
|
|
do_bulk_cleanup
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
## main
|
|
|
|
##
|
|
|
|
|
|
|
|
#
|
|
|
|
# Parse the command line.
|
|
|
|
#
|
|
|
|
while test $# -gt 0; do
|
|
|
|
case $1 in
|
|
|
|
-c|--config)
|
|
|
|
shift
|
|
|
|
BULK_BUILD_CONF=$1; shift
|
|
|
|
;;
|
|
|
|
-e|--no-email)
|
|
|
|
noemail=yes
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-m|--mirror_only)
|
|
|
|
mirror_only=yes
|
|
|
|
target=mirror-distfiles
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-p|--post-build)
|
|
|
|
post_only=yes
|
|
|
|
shift
|
|
|
|
;;
|
2007-06-15 17:52:22 +02:00
|
|
|
--prepare)
|
|
|
|
prepare_only=yes
|
|
|
|
shift
|
|
|
|
;;
|
2006-11-27 01:05:22 +01:00
|
|
|
-r|--resume|--restart|restart)
|
|
|
|
resume=yes
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-s|--specific-pkgs)
|
|
|
|
makeargs="$makeargs SPECIFIC_PKGS=1"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unknown option: $1" 1>&2
|
|
|
|
usage 1>&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
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
|
|
|
done
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
do_common_setup
|
|
|
|
|
|
|
|
if [ "x$post_only" = "xyes" ]; then
|
2007-02-23 04:43:53 +01:00
|
|
|
load_vars
|
2006-11-27 01:05:22 +01:00
|
|
|
do_post_build
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
do_bulk_build
|
|
|
|
|
2004-04-09 13:06:35 +02:00
|
|
|
# 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
|
2005-11-28 22:18:20 +01:00
|
|
|
echo "build> Bulk mirror of distfiles completed: `date`"
|
2004-04-09 13:06:35 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2006-11-27 01:05:22 +01:00
|
|
|
do_post_build
|
|
|
|
do_email
|
|
|
|
do_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
|
|
|
|