diff options
author | rillig <rillig@pkgsrc.org> | 2005-11-05 15:41:53 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2005-11-05 15:41:53 +0000 |
commit | 46f3dfebd58584423b128db272c9f48a27fc6ae9 (patch) | |
tree | 2adea9294a1c0d35691e3778920dae8b87a0cbb0 /mk | |
parent | f2845c6f4811c8914f0e6d843e97847af77cd379 (diff) | |
download | pkgsrc-46f3dfebd58584423b128db272c9f48a27fc6ae9.tar.gz |
- Added a function post_filter_cmd() that can be overridden in bulk.conf.
The default function prepends the well-known "date, progress, pkgdir" to
each line.
- Check that the environment variable USR_PKGSRC is given and is an
absolute pathname.
- Introduced variables for the various directories. Their names all end in
_dir, and they contain absolute pathnames. Changed all instances of
${USR_PKGSRC}/pkgtools/pkglint to ${pkglint_dir}. Likewise for the other
directories.
- Added more error checking. The bulk build is terminated if the
pkg_install package cannot be updated or the prerequisite packages
cannot be installed.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bulk/build | 87 |
1 files changed, 54 insertions, 33 deletions
diff --git a/mk/bulk/build b/mk/bulk/build index 81bfa5c5bf4..3c306745518 100644 --- a/mk/bulk/build +++ b/mk/bulk/build @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: build,v 1.62 2005/11/05 14:33:17 rillig Exp $ +# $NetBSD: build,v 1.63 2005/11/05 15:41:53 rillig Exp $ # # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org> @@ -85,6 +85,16 @@ die() { 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 @@ -172,6 +182,16 @@ else die "Cannot find config file ${BULK_BUILD_CONF}, aborting." 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 @@ -192,31 +212,28 @@ unset CDPATH # ensure cd does not print new cwd to stdout, which unset DISPLAY # allow sane failure for gimp, xlispstat # Check that the pkg_tools are up to date -( - cd ${USR_PKGSRC}/pkgtools/pkglint \ - && ${BMAKE} fetch >/dev/null 2>&1 -) || ( - echo "Updating pkgtools" \ - && cd ${USR_PKGSRC}/pkgtools/pkg_install \ - && ${BMAKE} clean \ - && ${BMAKE} install \ - && ${BMAKE} clean -) - -cd ${USR_PKGSRC} - +( 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" else # make veryveryclean :) - sh mk/bulk/pre-build \ - || die "Error during bulk-build preparations, aborting." + ( cd "${pkgsrc_dir}" \ + && /bin/sh mk/bulk/pre-build + ) || die "Error during bulk-build preparations, aborting." fi fail=no -if [ -d pkgtools/pkglint ]; then - cd pkgtools/pkglint +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 @@ -238,7 +255,7 @@ if [ -d pkgtools/pkglint ]; then 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 ${USR_PKGSRC}." + "Please update your pkgsrc tree in ${pkgsrc_dir}." fi echo "+----------------------------------------+" @@ -294,9 +311,9 @@ if [ $fail = "yes" -o \ fi # get the list of packages which should always be installed during the build -cd ${USR_PKGSRC}/pkgtools/pkglint -BULK_PREREQ=`${BMAKE} show-var VARNAME=BULK_PREREQ` -cd ${USR_PKGSRC} +{ 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 @@ -305,21 +322,24 @@ for pkgdir in $BULK_PREREQ do echo $pkgdir # make sure its installed _and_ packaged - cd ${USR_PKGSRC}/$pkgdir && ${BMAKE} bulk-install + ( cd "${pkgsrc_dir}/${pkgdir}" \ + && ${BMAKE} bulk-install + ) || die "Could not install prerequisite packages." done # Create the bulk cache files -cd ${USR_PKGSRC} if [ "x$restart" != "xyes" ]; then - (cd ${USR_PKGSRC} && ${BMAKE} bulk-cache $makeargs) \ - || die "Cache creation failed. Aborting build." + ( cd "${pkgsrc_dir}" \ + && ${BMAKE} bulk-cache $makeargs + ) || die "Could not create the bulk build cache." fi +cd "${pkgsrc_dir}" || die "The pkgsrc directory does not exist." + echo "Starting actual build using the order specified in $ORDERFILE..." -cd ${USR_PKGSRC} # make sure we have something to grep in in the build loop -touch $BUILDLOG +touch "${BUILDLOG}" # set the nice level for bulk builds #case "${NICE_LEVEL}" in @@ -343,9 +363,10 @@ do if [ $? -ne 0 ]; then built=`wc -l $BUILDLOG | ${AWK} '{print $1}'` percent=`echo $built $tot | ${AWK} '{printf("%4.1f%%",$1*100/$2);}'` - (cd $pkgdir && ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes $target \ - $makeargs </dev/null | \ - ${SED} "s;^;`date '+%Y/%m/%d %H:%M:%S'` $built/${tot}=$percent $pkgdir @ ${MACHINE_ARCH}> ;g") + ( cd "${pkgsrc_dir}/${pkgdir}" \ + && ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes $target \ + $makeargs </dev/null | post_filter_cmd + ) || true echo "$pkgdir" >> $BUILDLOG fi done @@ -394,11 +415,11 @@ echo "Re-installing prerequisite packages specified with BULK_PREREQ..." for pkgdir in $BULK_PREREQ do echo $pkgdir - ( cd ${USR_PKGSRC}/$pkgdir && ${BMAKE} bulk-install ) + ( cd "${pkgsrc_dir}/${pkgdir}" && ${BMAKE} bulk-install ) done # Perl was wiped, reinstall it! -( cd lang/perl5 && ${BMAKE} bulk-install ) +( cd "${perl5_dir}" && ${BMAKE} bulk-install ) BUILDDATE=`date +%Y-%m-%d` mkdir -p ${FTP} ${PERL5} mk/bulk/post-build > ${FTP}/pkgsrc-results-${BUILDDATE}.txt |