← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad-buildd:fix-adjust-dpkg-architecture-calls into launchpad-buildd:master

 

Colin Watson has proposed merging ~cjwatson/launchpad-buildd:fix-adjust-dpkg-architecture-calls into launchpad-buildd:master.

Commit message:
Explicitly unset DEB_HOST_ARCH when calling dpkg-architecture

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/436463

For example, `DEB_HOST_ARCH=amd64 dpkg-architecture -ai386 -iany-i386` doesn't do what we want.  This wouldn't have been a problem in production, but it caused test failures in some package builds due to `DEB_HOST_ARCH` being exported by some of the package building machinery.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:fix-adjust-dpkg-architecture-calls into launchpad-buildd:master.
diff --git a/lpbuildd/binarypackage.py b/lpbuildd/binarypackage.py
index 0e257b1..44b1c6c 100644
--- a/lpbuildd/binarypackage.py
+++ b/lpbuildd/binarypackage.py
@@ -75,7 +75,9 @@ class DpkgArchitectureCache:
     def match(self, arch, wildcard):
         if (arch, wildcard) not in self._matches:
             command = ["dpkg-architecture", "-a%s" % arch, "-i%s" % wildcard]
-            ret = (subprocess.call(command) == 0)
+            env = dict(os.environ)
+            env.pop("DEB_HOST_ARCH", None)
+            ret = (subprocess.call(command, env=env) == 0)
             self._matches[(arch, wildcard)] = ret
         return self._matches[(arch, wildcard)]