[PATCH] Make checkarchitecture even more testable

Matt Palmer mpalmer at hezmatt.org
Wed Dec 15 20:45:29 UTC 2010


Explicit exits and logging make for a sad panda.
---
 pbuilder-buildpackage       |    6 +++++-
 pbuilder-buildpackage-funcs |    5 +----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 4671c0d..5fb947c 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -55,7 +55,11 @@ extractbuildplace
 trap umountproc_cleanbuildplace_trap exit sighup sigpipe
 
 # check if this package should be built at all
-checkarchitecture "$PACKAGENAME" "$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)"
+HOST_ARCH="$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)"
+if ! checkarchitecture "$PACKAGENAME" "$HOST_ARCH"; then
+    log "E: $HOST_ARCH not in arch list or does not match any arch wildcards for this package"
+    exit 2
+fi
 
 loadhooks
 
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index 5ac393f..a757963 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -42,10 +42,7 @@ function checkarchitecture () {
         fi
     done
     if [ ! $VALID_ARCH ] && [ ! "$ARCHES" = "all" ]; then
-        local msg="E: $ARCH not in arch list or does not match any "
-        msg="$msg arch wildcards: $ARCHES"
-        log $msg
-        exit 2
+        return 1
     fi
 }
 
-- 
1.5.6.5


--qjNfmADvan18RZcF
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0009-Testsuite-for-checkarchitecture-and-adjustments-to.patch"



More information about the Pbuilder-maint mailing list