[PATCH] Apply arch-wildcard-part2.patch

Matt Palmer mpalmer at hezmatt.org
Wed Dec 15 20:06:21 UTC 2010


By Andres Mejia <mcitadel at gmail.com>, taken from
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=363193#159
---
 pbuilder-buildpackage       |    3 +++
 pbuilder-buildpackage-funcs |   19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index b8e2446..8b42b6d 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -31,6 +31,9 @@ if [ ! -f "$PACKAGENAME" ]; then
     exit 1;
 fi;
 
+# check if this package should be built at all
+checkarchitecture "$PACKAGENAME"
+
 if [ -n "$BUILDUSERNAME" -a -n "$BUILDUSERID" ]; then
     SUTOUSER="env LOGNAME=$BUILDUSERNAME su -p $BUILDUSERNAME"
     DEBBUILDOPTS="${DEBBUILDOPTS:+$DEBBUILDOPTS }-rfakeroot"
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index 0c19dc7..fedbfc4 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -30,6 +30,25 @@ function copydsc () {
     done
 }
 
+function checkarchitecture () {
+    local DSCFILE="$1"
+    local ARCHES="$(cat $DSCFILE | grep Architecture | sed 's/^[^:]\+:\s*//')"
+    local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
+    local VALID_ARCH
+    for d in $ARCHES; do
+        if dpkg-architecture -a$ARCH -i$d; then
+            VALID_ARCH="yes"
+            break
+        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
+    fi
+}
+
 function checkbuilddep () {
     # call satisfydepends
     local BUILDOPT="--binary-all"
-- 
1.5.6.5


--qjNfmADvan18RZcF
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0007-Check-correct-architecture-for-checkarchitecture-an.patch"



More information about the Pbuilder-maint mailing list