aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpbuilder-checkparams14
-rw-r--r--pbuilder-modules19
-rw-r--r--pbuilder.812
-rw-r--r--pbuilderrc7
-rw-r--r--pbuilderrc.511
-rwxr-xr-xt/test_pbuilder-modules2
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
diff --git a/pbuilder.8 b/pbuilder.8
index c8be5b1..7c3da1e 100644
--- a/pbuilder.8
+++ b/pbuilder.8
@@ -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.
diff --git a/pbuilderrc b/pbuilderrc
index b4ab567..08f1db0 100644
--- a/pbuilderrc
+++ b/pbuilderrc
@@ -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"