From a4f54593973d02307c0b50855c4d5cc251acabe0 Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 5 Nov 2005 23:22:05 +0000 Subject: - Replaced spaces with tabs in the "build --help" message. - Added file post-build-conf, which provides functions to print and export the config variables from build.conf. - All config variables are shown at the start of a bulk build. - Added a configuration variable MAKECONF with the obvious meaning. --- mk/bulk/build | 77 +++++++++++++++++++++++----------------------- mk/bulk/build.conf-example | 6 +++- mk/bulk/post-build-conf | 53 +++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 39 deletions(-) create mode 100644 mk/bulk/post-build-conf (limited to 'mk/bulk') diff --git a/mk/bulk/build b/mk/bulk/build index 5f6617745c1..cdf69315b44 100644 --- a/mk/bulk/build +++ b/mk/bulk/build @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: build,v 1.67 2005/11/05 21:52:33 rillig Exp $ +# $NetBSD: build,v 1.68 2005/11/05 23:22:05 rillig Exp $ # # Copyright (c) 1999, 2000 Hubert Feyrer @@ -44,36 +44,36 @@ Runs a bulk pkgsrc build. The following options are supported: -c | --config - Load the following configuration file instead of the default + Load the following configuration file instead of the default one. -e | --no-email - Don't send email when the bulk build is finished, it will put - the results into a file (FTP/pkgsrc-results.txt). + Don't send email when the bulk build is finished, it will put + the results into a file (FTP/pkgsrc-results.txt). -h | --help - Displays this message. + Displays this message. -m | --mirror_only - Downloads all distfiles needed for the build but does not run + Downloads all distfiles needed for the build but does not run the build. IMPORTANT: Note that this will still run all the - pre-build stuff which involves removing all of your installed - packages. + pre-build stuff which involves removing all of your installed + packages. - The only difference between this option and a regular bulk build + The only difference between this option and a regular bulk build is that the packages are not actually built. -r | --restart | --resume | restart - Restart a previously interrupted bulk build. The last form of - this option is for backwards compatibility and may be removed in + Restart a previously interrupted bulk build. The last form of + this option is for backwards compatibility and may be removed in future versions of this script. - The --restart option may be combined with the --mirror_only - option. + The --restart option may be combined with the --mirror_only + option. -s | --specific-pkgs - Sets SPECIFIC_PKGS=1 when building packages. This option is - used for building a subset of pkgsrc. + Sets SPECIFIC_PKGS=1 when building packages. This option is + used for building a subset of pkgsrc. EOF } @@ -96,6 +96,13 @@ post_filter_cmd() { ${SED} "s;^;`date '+%Y/%m/%d %H:%M:%S'` ${built}/${tot}=${percent} ${pkgdir} @ ${MACHINE_ARCH}> ;g" } + +# +# Find out where we are +# +scriptdir=`dirname "$0"` +scriptdir=`cd "${scriptdir}" && pwd` + # # Default values for command line options. # @@ -159,28 +166,23 @@ export BMAKE ulimit -S -s `ulimit -H -s` ulimit -S -d `ulimit -H -d` -# -# It starts ... -# -echo "Bulk build started: `date`" -echo "" - # # Find the configuration file. # -: ${BULK_BUILD_CONF:=`dirname $0`/build.conf} +BULK_BUILD_CONF="${BULK_BUILD_CONF-${scriptdir}/build.conf}" case $BULK_BUILD_CONF in /*) ;; -*) BULK_BUILD_CONF="`pwd`/${BULK_BUILD_CONF}" +*) BULK_BUILD_CONF="${PWD}/${BULK_BUILD_CONF}" esac -export BULK_BUILD_CONF # # Load the variables from the configuration file. # { test -f "${BULK_BUILD_CONF}" \ - && . "${BULK_BUILD_CONF}" -} || die "Cannot find config file ${BULK_BUILD_CONF}, aborting." + && . "${BULK_BUILD_CONF}" \ + && . "${scriptdir}/post-build-conf" \ + && export_config_vars +} || die "Cannot load config file ${BULK_BUILD_CONF}, aborting." # # Check if a valid pkgsrc root directory is given. @@ -200,16 +202,6 @@ 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 some environment variables that could disturbe the build. # @@ -217,6 +209,13 @@ unset CDPATH # ensure cd does not print new cwd to stdout, which # confuses the printindex script. unset DISPLAY # allow sane failure for gimp, xlispstat +# +# It starts ... +# +echo "Bulk build started: `date`" +echo "" +show_config_vars + # # Check that the package tools are up to date. # @@ -435,8 +434,10 @@ done # BUILDDATE=`date +%Y-%m-%d` mkdir -p "${FTP}" -${PERL5} mk/bulk/post-build \ -> ${FTP}/pkgsrc-results-${BUILDDATE}.txt +( cd "${pkgsrc_dir}" \ + && ${PERL5} ${pkgsrc_dir} mk/bulk/post-build \ + > ${FTP}/pkgsrc-results-${BUILDDATE}.txt +) || die "Could not write the results file." # # Notify the ADMIN of the finished build. diff --git a/mk/bulk/build.conf-example b/mk/bulk/build.conf-example index 8e9ed9c37bb..e3c310e4915 100644 --- a/mk/bulk/build.conf-example +++ b/mk/bulk/build.conf-example @@ -1,4 +1,4 @@ -# $NetBSD: build.conf-example,v 1.29 2005/11/05 20:54:38 rillig Exp $ +# $NetBSD: build.conf-example,v 1.30 2005/11/05 23:22:05 rillig Exp $ # # This is an example configuration file for pkgsrc bulk builds. # Actually it's a shell script that is sourced in by the pre-build, @@ -18,6 +18,10 @@ arch=`uname -m` # Where our pkgsrc is located USR_PKGSRC="/usr/pkgsrc" +# An absolute pathname to your mk.conf file. +# The file must be outside ${PREFIX}, or it will be overwritten. +#MAKECONF="$HOME/etc/mk.conf" + # # Keeping pkgsrc up-to-date diff --git a/mk/bulk/post-build-conf b/mk/bulk/post-build-conf new file mode 100644 index 00000000000..bfad01f6cbf --- /dev/null +++ b/mk/bulk/post-build-conf @@ -0,0 +1,53 @@ +# $NetBSD: post-build-conf,v 1.1 2005/11/05 23:22:05 rillig Exp $ +# + +# This file is included after the build.conf file by the "build" and +# "pre-build" scripts. It provides two functions for printing and +# exporting the configuration variables. + +# usage: show_variable varname +show_variable() { + eval "fnv_isset=\${$1+set}" + case $fnv_isset in + "set") eval "fnv_val=\${$1-}" + printf " %-25s = %s\\n" "$1" "${fnv_val}" + ;; + *) printf " %-25s (undefined)\\n" "$1" + ;; + esac +} + +# usage: section title varname... +section() { + printf "%s\\n" "$1" + shift + for i in "$@"; do + show_variable "$i" + done + printf "\\n" +} + +# usage: show_config_vars +show_config_vars() { + section "System information" \ + osrev arch BULK_BUILD_CONF USR_PKGSRC MAKECONF + section "Keeping pkgsrc up-to-date" \ + CVS_USER CVS_FLAGS + section "Getting distfiles" \ + PRUNEDISTFILES ftp_proxy http_proxy + section "Building packages" \ + PKGLIST NICE_LEVEL ADMIN ADMINSIG + section "Uploading binary packages" \ + UPDATE_VULNERABILITY_LIST PRUNEPACKAGES MKSUMS SIGN_AS \ + RSYNC_DST RSYNC_OPTS FTPHOST FTP +} + +# usage: export_config_vars +export_config_vars() { + export osrev arch BULK_BUILD_CONF USR_PKGSRC MAKECONF + export CVS_USER CVS_FLAGS + export PRUNEDISTFILES ftp_proxy http_proxy + export PKGLIST NICE_LEVEL ADMIN ADMINSIG + export UPDATE_VULNERABILITY_LIST PRUNEPACKAGES MKSUMS SIGN_AS + export RSYNC_DST RSYNC_OPTS FTPHOST FTP +} -- cgit v1.2.3