diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-11-15 10:38:39 +0000 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2015-11-15 11:15:21 +0000 |
commit | bcae9f4ab8743c9d6886944108fe133816cb486d (patch) | |
tree | 73702cee8af3070d7c046d31c99ff3d8dfe9b6cd | |
parent | e2420f46582fb7761d04ed86c2201dd79a857e51 (diff) | |
download | pbuilder-bcae9f4ab8743c9d6886944108fe133816cb486d.tar pbuilder-bcae9f4ab8743c9d6886944108fe133816cb486d.tar.gz |
make the output level configurable through LOGLEVEL (--loglevel)
valid values are D/I/W/E
Closes: #490184
-rwxr-xr-x | pbuilder-checkparams | 14 | ||||
-rw-r--r-- | pbuilder-modules | 19 | ||||
-rw-r--r-- | pbuilder.8 | 12 | ||||
-rw-r--r-- | pbuilderrc | 7 | ||||
-rw-r--r-- | pbuilderrc.5 | 11 | ||||
-rwxr-xr-x | t/test_pbuilder-modules | 2 |
6 files changed, 60 insertions, 5 deletions
diff --git a/pbuilder-checkparams b/pbuilder-checkparams index 51aafab..74666ca 100755 --- a/pbuilder-checkparams +++ b/pbuilder-checkparams @@ -132,6 +132,10 @@ while [ -n "$1" ]; do REMOVEPACKAGES="$2"; shift; shift; ;; + --loglevel) + LOGLEVEL="$2" + shift; shift; + ;; --configfile) if [ ! -f "$2" ]; then log.e "Config file $2 does not exist" @@ -295,6 +299,16 @@ if [ -z "${CHROOTEXEC}" ]; then CHROOTEXEC="chroot $BUILDPLACE " fi +# sanity check of LOGLEVEL +case "$LOGLEVEL" in + D|I|W|E) ;; + *) # use log() instead of log.e() to override the buggy LOGLEVEL + log "E: A non-valid LOGLEVEL has been specified: '${LOGLEVEL}'." + log "E: Valid values are D, I, W, E" + exit 1 + ;; +esac + # handle 'experimental' specially. -- required for raw pbuilder (create/update) only. if [ "$DISTRIBUTION" = "experimental" ]; then DISTRIBUTION="sid" diff --git a/pbuilder-modules b/pbuilder-modules index 9b5819d..2a5a1fe 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -117,15 +117,24 @@ function log() { } log.e() { - log "E: $*" + case "$LOGLEVEL" in + D|I|W|E) log "E: $*" ;; + esac } - log.w() { - log "W: $*" + case "$LOGLEVEL" in + D|I|W) log "W: $*" ;; + esac } - log.i() { - log "I: $*" + case "$LOGLEVEL" in + D|I) log "I: $*" ;; + esac +} +log.d() { + case "$LOGLEVEL" in + D) log "D: $*" ;; + esac } # test whether a directory is empty @@ -356,6 +356,18 @@ The messages generated during execution will be written to the specified file, and the standard output. .TP +.BI "\-\-loglevel " "I" +Specify how much output you want from pbuilder, valid values are +.BR E +(errors only), +.BR W +(errors and warnings), +.BR I +(errors, warnings and informational) and +.BR D +(everything including some debug messages). + +.TP .BI "\-\-binary\-arch" Specify to build architecture specific targets instead of all targets. @@ -1,6 +1,13 @@ # pbuilder defaults; edit /etc/pbuilderrc to override these and see # pbuilderrc.5 for documentation +# Set how much output you want from pbuilder, valid values are +# E => errors only +# W => errors and warnings +# I => errors, warnings and informational +# D => all of the above and debug messages +LOGLEVEL=I + BASETGZ=/var/cache/pbuilder/base.tgz #EXTRAPACKAGES="" #export DEBIAN_BUILDARCH=athlon diff --git a/pbuilderrc.5 b/pbuilderrc.5 index 3d461b8..888d160 100644 --- a/pbuilderrc.5 +++ b/pbuilderrc.5 @@ -269,6 +269,17 @@ hooks are not executed. For details, see .B "pbuilder(8)" .TP +.BI "LOGLEVEL=" "I" +Specify how much output you want from pbuilder, valid values are +.BR E +(errors only), +.BR W +(errors and warnings), +.BR I +(errors, warnings and informational) and +.BR D +(everything including some debug messages). +.TP .BI "MIRRORSITE=" "http://www.jp.debian.org/debian" Specify the mirror site which contains the main Debian distribution. diff --git a/t/test_pbuilder-modules b/t/test_pbuilder-modules index 70504b0..dcc868b 100755 --- a/t/test_pbuilder-modules +++ b/t/test_pbuilder-modules @@ -1,6 +1,7 @@ #!/bin/bash TD="$(dirname "$0")" +LOGLEVEL=I if [ -n "$PBUILDER_CHECKOUT" ]; then . "$TD/testlib.sh" . "$PBUILDER_CHECKOUT/pbuilder-modules" @@ -21,6 +22,7 @@ expect_stderr "W: warning E: error" test_information function test_log() { + log.d "debug" # this should not be printed in LOGLEVEL=I (the default) log.i "info" log.w "warn" log.e "error" |