[PATCH] Switch all dpkg-architecture calls to include -f

Matt Palmer mpalmer at hezmatt.org
Thu Dec 16 07:43:34 UTC 2010


Would you believe that the *default* behaviour of dpkg-architecture is to
pick up existing environment variables and use them in favour of what's
either the "natural" value of the setting, or what you've EXPLICITLY SET ON
THE COMMAND LINE (with, for instance, the -a option).

Whilst this is undeniably insane, it's apparently intended behaviour, so
there's not a lot we can do about it other than passing -f every time we
call dpkg-architecture.  RAAAAAAAGE.
---
 examples/rebuild/getlist             |    2 +-
 pbuilder-buildpackage                |    2 +-
 pbuilder-buildpackage-funcs          |    2 +-
 pbuilder-satisfydepends-aptitude     |    2 +-
 pbuilder-satisfydepends-classic      |    2 +-
 pbuilder-satisfydepends-experimental |    2 +-
 pbuilder-satisfydepends-funcs        |    4 ++--
 pdebuild                             |    2 +-
 pdebuild-user-mode-linux             |    2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/examples/rebuild/getlist b/examples/rebuild/getlist
index caf9c5f..e5bb09e 100755
--- a/examples/rebuild/getlist
+++ b/examples/rebuild/getlist
@@ -2,7 +2,7 @@
 
 DIST=$1
 
-BUILD_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
+BUILD_ARCH=$(dpkg-architecture -f -qDEB_BUILD_ARCH)
 MIRROR=http://ftp.at.debian.org
 
 if [ -z $DIST ]; then
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 5fb947c..5352e3c 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -55,7 +55,7 @@ extractbuildplace
 trap umountproc_cleanbuildplace_trap exit sighup sigpipe
 
 # check if this package should be built at all
-HOST_ARCH="$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)"
+HOST_ARCH="$($CHROOTEXEC dpkg-architecture -f -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
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index 47d5da3..e9ae3a5 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -36,7 +36,7 @@ function checkarchitecture () {
     local ARCHES="$(cat $DSCFILE | grep Architecture | sed 's/^[^:]\+:\s*//')"
     local VALID_ARCH
     for d in $ARCHES; do
-        if dpkg-architecture -a$ARCH -i$d >/dev/null 2>&1 || [ "$d" = "all" ]; then
+        if dpkg-architecture -f -a$ARCH -i$d >/dev/null 2>&1 || [ "$d" = "all" ]; then
             VALID_ARCH="yes"
             break
         fi
diff --git a/pbuilder-satisfydepends-aptitude b/pbuilder-satisfydepends-aptitude
index 6dd3c91..ea460be 100755
--- a/pbuilder-satisfydepends-aptitude
+++ b/pbuilder-satisfydepends-aptitude
@@ -59,7 +59,7 @@ function filter_arch_deps() {
 
 function checkbuilddep_internal () {
 # Use this function to fulfill the dependency (almost)
-    local ARCH=$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)
+    local ARCH=$($CHROOTEXEC dpkg-architecture -f -qDEB_HOST_ARCH)
     local BUILD_DEP_DEB_DIR
     local BUILD_DEP_DEB_CONTROL
     local DEPENDS
diff --git a/pbuilder-satisfydepends-classic b/pbuilder-satisfydepends-classic
index e586a42..e33f37f 100755
--- a/pbuilder-satisfydepends-classic
+++ b/pbuilder-satisfydepends-classic
@@ -61,7 +61,7 @@ apt_sim() {
 
 # Use this function to fulfill the dependency (almost)
 checkbuilddep_internal() {
-    local ARCH=$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)
+    local ARCH=$($CHROOTEXEC dpkg-architecture -f -qDEB_HOST_ARCH)
     local INSTALLPKG
     local INSTALLPKGLIST
     local INSTALLPKGMULTI
diff --git a/pbuilder-satisfydepends-experimental b/pbuilder-satisfydepends-experimental
index b1de1c7..979ffea 100755
--- a/pbuilder-satisfydepends-experimental
+++ b/pbuilder-satisfydepends-experimental
@@ -29,7 +29,7 @@ set -e
 
 # Use this function to fulfill the dependency (almost)
 function checkbuilddep_internal () {
-    local ARCH=$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)
+    local ARCH=$($CHROOTEXEC dpkg-architecture -f -qDEB_HOST_ARCH)
     local INSTALLPKG
     local INSTALLPKGLIST
     local INSTALLPKGMULTI
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index 64436a0..e5792ec 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -131,11 +131,11 @@ checkbuilddep_archdeps() {
     for d in $DEP_ARCHES; do
         if echo "$d" | grep -q '!'; then
             d="$(echo $d | sed 's/!//')"
-            if dpkg-architecture -a$ARCH -i$d; then
+            if dpkg-architecture -f -a$ARCH -i$d; then
                 IGNORE_IT="yes"
             fi
         else
-            if dpkg-architecture -a$ARCH -i$d; then
+            if dpkg-architecture -f -a$ARCH -i$d; then
                 USE_IT="yes"
             fi
             INCLUDE="yes"
diff --git a/pdebuild b/pdebuild
index 28dff21..ce58cfb 100644
--- a/pdebuild
+++ b/pdebuild
@@ -31,7 +31,7 @@ fi;
 
 PKG_SOURCENAME=$(dpkg-parsechangelog|sed -n 's/^Source: //p')
 PKG_VERSION=$(dpkg-parsechangelog|sed -n 's/^Version: \(.*:\|\)//p')
-ARCHITECTURE="${ARCHITECTURE:-`dpkg-architecture -qDEB_HOST_ARCH`}"
+ARCHITECTURE="${ARCHITECTURE:-`dpkg-architecture -f -qDEB_HOST_ARCH`}"
 CHANGES="${PKG_SOURCENAME}_${PKG_VERSION}_${ARCHITECTURE}.changes"
 
 if [ -z "${PBUILDER_BUILD_LOGFILE}" ]; then
diff --git a/pdebuild-user-mode-linux b/pdebuild-user-mode-linux
index daab151..e922a31 100644
--- a/pdebuild-user-mode-linux
+++ b/pdebuild-user-mode-linux
@@ -33,7 +33,7 @@ export PBCURRENTCOMMANDLINEOPERATION="pdebuild"
 
 PKG_SOURCENAME=$(dpkg-parsechangelog|sed -n 's/^Source: //p')
 PKG_VERSION=$(dpkg-parsechangelog|sed -n 's/^Version: \(.*:\|\)//p')
-ARCHITECTURE=$(dpkg-architecture -qDEB_HOST_ARCH)
+ARCHITECTURE=$(dpkg-architecture -f -qDEB_HOST_ARCH)
 
 
 if [ "${USE_PDEBUILD_INTERNAL}" = 'yes' ]; then
-- 
1.5.6.5


--Km1U/tdNT/EmXiR1--





More information about the Pbuilder-maint mailing list