← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Call dpkg-architecture with -a rather than setting DEB_HOST_ARCH

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This makes a slight difference if `gcc` isn't installed, which is possible since it's only a Recommends of `dpkg-dev`:

  $ DEB_HOST_ARCH=amd64 dpkg-architecture -ii386; echo $?
  dpkg-architecture: warning: cannot determine CC system type, falling back to default (native compilation)
  1
  $ DEB_HOST_ARCH=amd64 dpkg-architecture -iany-amd64; echo $?
  dpkg-architecture: warning: cannot determine CC system type, falling back to default (native compilation)
  0
  $ DEB_HOST_ARCH=i386 dpkg-architecture -iany-amd64; echo $?
  dpkg-architecture: warning: cannot determine CC system type, falling back to default (native compilation)
  1

  $ dpkg-architecture -aamd64 -ii386; echo $?
  1
  $ dpkg-architecture -aamd64 -iany-amd64; echo $?
  0
  $ dpkg-architecture -ai386 -iany-amd64; echo $?
  1
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:adjust-dpkg-architecture-calls into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 87e8c12..d36350a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+launchpad-buildd (229) UNRELEASED; urgency=medium
+
+  * Call dpkg-architecture with -a rather than setting DEB_HOST_ARCH, to
+    avoid a warning if gcc isn't installed.
+
+ -- Colin Watson <cjwatson@xxxxxxxxxx>  Thu, 26 Jan 2023 15:54:35 +0000
+
 launchpad-buildd (228) focal; urgency=medium
 
   * In CI jobs, chown the VCS tree to buildd:buildd after fetching it, since
diff --git a/lpbuildd/binarypackage.py b/lpbuildd/binarypackage.py
index 22af94c..0e257b1 100644
--- a/lpbuildd/binarypackage.py
+++ b/lpbuildd/binarypackage.py
@@ -74,10 +74,8 @@ class DpkgArchitectureCache:
 
     def match(self, arch, wildcard):
         if (arch, wildcard) not in self._matches:
-            command = ["dpkg-architecture", "-i%s" % wildcard]
-            env = dict(os.environ)
-            env["DEB_HOST_ARCH"] = arch
-            ret = (subprocess.call(command, env=env) == 0)
+            command = ["dpkg-architecture", "-a%s" % arch, "-i%s" % wildcard]
+            ret = (subprocess.call(command) == 0)
             self._matches[(arch, wildcard)] = ret
         return self._matches[(arch, wildcard)]