summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2005-11-05 23:22:05 +0000
committerrillig <rillig@pkgsrc.org>2005-11-05 23:22:05 +0000
commita4f54593973d02307c0b50855c4d5cc251acabe0 (patch)
tree88d157b28b2323176b251fdf8815f73aa7d9319a
parente8cad06cf9c32e5eb2922dee3a5de2386c1e946b (diff)
downloadpkgsrc-a4f54593973d02307c0b50855c4d5cc251acabe0.tar.gz
- 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.
-rw-r--r--mk/bulk/build77
-rw-r--r--mk/bulk/build.conf-example6
-rw-r--r--mk/bulk/post-build-conf53
3 files changed, 97 insertions, 39 deletions
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 <hubertf@NetBSD.org>
@@ -44,36 +44,36 @@ Runs a bulk pkgsrc build.
The following options are supported:
-c | --config <file>
- 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.
#
@@ -160,27 +167,22 @@ 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.
#
@@ -218,6 +210,13 @@ unset CDPATH # ensure cd does not print new cwd to stdout, which
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.
#
( cd "${pkglint_dir}" \
@@ -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
+}