pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/bulk - Replaced spaces with tabs in the "build --he...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/31753f7cdd21
branches:  trunk
changeset: 502540:31753f7cdd21
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Nov 05 23:22:05 2005 +0000

description:
- 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.

diffstat:

 mk/bulk/build              |  77 +++++++++++++++++++++++----------------------
 mk/bulk/build.conf-example |   6 ++-
 mk/bulk/post-build-conf    |  53 +++++++++++++++++++++++++++++++
 3 files changed, 97 insertions(+), 39 deletions(-)

diffs (230 lines):

diff -r 591fa490d9dd -r 31753f7cdd21 mk/bulk/build
--- a/mk/bulk/build     Sat Nov 05 21:52:33 2005 +0000
+++ b/mk/bulk/build     Sat Nov 05 23:22:05 2005 +0000
@@ -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@localhost>
@@ -44,36 +44,36 @@
 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 @@
        ${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 -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 @@
 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 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 @@
 #
 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 -r 591fa490d9dd -r 31753f7cdd21 mk/bulk/build.conf-example
--- a/mk/bulk/build.conf-example        Sat Nov 05 21:52:33 2005 +0000
+++ b/mk/bulk/build.conf-example        Sat Nov 05 23:22:05 2005 +0000
@@ -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 @@
 # 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 -r 591fa490d9dd -r 31753f7cdd21 mk/bulk/post-build-conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/bulk/post-build-conf   Sat Nov 05 23:22:05 2005 +0000
@@ -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
+}



Home | Main Index | Thread Index | Old Index