173 lines
4.1 KiB
Text
173 lines
4.1 KiB
Text
# $NetBSD: post-build-conf,v 1.9 2005/12/03 01:00:37 rillig Exp $
|
|
#
|
|
|
|
# This file is included after the build.conf file by the "build" and
|
|
# "pre-build" scripts. It provides functions for printing, checking and
|
|
# exporting the configuration variables.
|
|
|
|
# Note: All functions whose names start with "pbc_" are considered private
|
|
# to this file. The "pbc" prefix is an abbreviation for "post-build-conf".
|
|
|
|
# usage: pbc_showvar varname
|
|
pbc_showvar() {
|
|
eval "pbc_isset=\${$1+set}"
|
|
case $pbc_isset in
|
|
"set") eval "fnv_val=\${$1-}"
|
|
printf " %-25s = %s\\n" "$1" "${fnv_val}"
|
|
;;
|
|
*) printf " %-25s (undefined)\\n" "$1"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# usage: pbc_section title varname...
|
|
pbc_section() {
|
|
printf "%s\\n" "$1"
|
|
shift
|
|
for pbc_var in "$@"; do
|
|
pbc_showvar "${pbc_var}"
|
|
done
|
|
printf "\\n"
|
|
}
|
|
|
|
# usage: show_config_vars
|
|
show_config_vars() {
|
|
pbc_section "System information" \
|
|
osrev arch BULK_BUILD_CONF USR_PKGSRC MAKECONF
|
|
pbc_section "Getting distfiles" \
|
|
PRUNEDISTFILES ftp_proxy http_proxy
|
|
pbc_section "Building the packages" \
|
|
PKGLIST NICE_LEVEL
|
|
pbc_section "Generating the report" \
|
|
ADMIN ADMINSIG FTPHOST FTP
|
|
pbc_section "Uploading binary packages" \
|
|
UPDATE_VULNERABILITY_LIST PRUNEPACKAGES MKSUMS SIGN_AS \
|
|
RSYNC_DST RSYNC_OPTS
|
|
}
|
|
|
|
# usage: export_config_vars
|
|
export_config_vars() {
|
|
export osrev arch BULK_BUILD_CONF USR_PKGSRC
|
|
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
|
|
case ${MAKECONF+set} in
|
|
"set") export MAKECONF;;
|
|
esac
|
|
}
|
|
|
|
# usage: pbc_die error-message
|
|
pbc_die() {
|
|
exec 1>&2
|
|
printf "error: %s\\n" "$@"
|
|
printf " Please check your bulk build configuration file:\\n"
|
|
case ${BULK_BUILD_CONF+set} in
|
|
"set") printf " %s\\n" "${BULK_BUILD_CONF}"
|
|
esac
|
|
exit 1
|
|
}
|
|
|
|
# usage: pbc_checkyesno varname
|
|
pbc_checkyesno() {
|
|
eval "pbc_val=\${$1-}"
|
|
case $pbc_val in
|
|
[Yy][Ee][Ss]|[Nn][Oo]) ;;
|
|
*) pbc_die "$1 must be set to one of YES, yes, NO, no.";;
|
|
esac
|
|
}
|
|
|
|
# usage: pbc_checkexistingfile varname
|
|
pbc_checkexistingfile() {
|
|
eval "pbc_val=\${$1-}"
|
|
|
|
case $pbc_val in
|
|
/*) ;;
|
|
*) pbc_die "$1 must be an absolute pathname.";;
|
|
esac
|
|
|
|
test -f "${pbc_val}" \
|
|
|| pbc_die "$1 must be the name of an existing file."
|
|
}
|
|
|
|
# usage: pbc_checkexistingdir varname
|
|
pbc_checkexistingdir() {
|
|
eval "pbc_val=\${$1-}"
|
|
|
|
case $pbc_val in
|
|
/*) ;;
|
|
*) pbc_die "$1 must be an absolute pathname.";;
|
|
esac
|
|
|
|
test -d "${pbc_val}" \
|
|
|| pbc_die "$1 must be the name of an existing directory."
|
|
}
|
|
|
|
# usage: pbc_checknonempty varname
|
|
pbc_checknonempty() {
|
|
eval "pbc_isset=\${$1+set}"
|
|
eval "pbc_val=\${$1-}"
|
|
|
|
case $pbc_isset in
|
|
"set") case $pbc_val in
|
|
"") pbc_die "$1 must be non-empty.";;
|
|
esac;;
|
|
*) pbc_die "$1 must be defined and non-empty.";;
|
|
esac
|
|
}
|
|
|
|
# usage: pbc_checkdefined varname
|
|
pbc_checkdefined() {
|
|
eval "pbc_val=\${$1+set}"
|
|
|
|
case $pbc_val in
|
|
"set") ;;
|
|
*) pbc_die "$1 must be defined.";;
|
|
esac
|
|
}
|
|
|
|
# usage: check_config_vars
|
|
check_config_vars() {
|
|
# section "System information"
|
|
pbc_checknonempty osrev
|
|
pbc_checknonempty arch
|
|
pbc_checkexistingfile BULK_BUILD_CONF
|
|
pbc_checkexistingdir USR_PKGSRC
|
|
case ${MAKECONF+set} in
|
|
"set") pbc_checkexistingfile MAKECONF;;
|
|
esac
|
|
|
|
# LEGACY: remove after 2006Q1
|
|
case ${CVS_USER-""}${CVS_FLAGS+set} in
|
|
?*) pbc_die "CVS_USER and CVS_FLAGS must not be set." \
|
|
"See http://mail-index.netbsd.org/pkgsrc-bulk/2005/11/20/0013.html" \
|
|
"and http://mail-index.netbsd.org/pkgsrc-bulk/2005/11/24/0003.html";;
|
|
esac
|
|
|
|
# section "Getting distfiles"
|
|
case ${PRUNEDISTFILES+set} in
|
|
"set") pbc_checkyesno PRUNEDISTFILES
|
|
esac
|
|
# no checks for ftp_proxy
|
|
# no checks for http_proxy
|
|
|
|
# section "Building the packages"
|
|
# no checks for PKGLIST
|
|
# no checks for NICE_LEVEL
|
|
|
|
# section "Generating the report"
|
|
# no checks for ADMIN
|
|
# no checks for ADMINSIG
|
|
# no checks for FTPHOST
|
|
# no checks for FTP
|
|
|
|
# section "Uploading binary packages"
|
|
pbc_checkyesno UPDATE_VULNERABILITY_LIST
|
|
case ${PRUNEPACKAGES+set} in
|
|
"set") pbc_checkyesno PRUNEPACKAGES
|
|
esac
|
|
pbc_checkyesno MKSUMS
|
|
# no checks for SIGN_AS
|
|
# no checks for RSYNC_DST
|
|
# no checks for RSYNC_OPTS
|
|
}
|