Control: severity -1 serious
Control: retitle -1 missing dependency on dpkg-dev
Control: tags -1 + patch
Justification: missing dependency

On Sun, Apr 25, 2021 at 02:11:30PM +0200, Marc Haber wrote:
> while debspawn recommends build-essential, it can be installed without
> dpkg-dev present. In this case, debspawn create fails with a python
> backtrace because it cannot find dpkg-architecture.

I confirm.

> This should either be a clearer error message ("dpkg-architecture
> missing, install dpkg-dev to allow operation") or dpkg-dev should be a
> Depends.

I disagree with the former here. Quite evidently, trying to use debspawn
without dpkg-dev is not a supported configuration. As such, a better
error message seems unnecessary to me. There is no reasonable way to use
dpkg-dev without dpkg-architecture and as such there should be the
dependency you suggest. It also happens to be easy trivial to fix and
such a fix is appropriate during freeze.

Let me also propose a different solution to the problem at hand.
Basically, the only thing that dpkg-architecture is being used for is
`dpkg-architecture -qDEB_HOST_ARCH`. Its output is used as a fallback
when no architecture is provided by the user. It is intended to serve
the architecture of the running system (even though that's not quite
what it does). A simpler way to do that is dpkg --print-architecture and
in doing so, the dpkg-dev dependency is avoided. I'm attaching a patch
to that end.

Either the patch or the dependency should be applied in time for
bullseye.

Helmut
--- debspawn-0.4.1.orig/debspawn/osbase.py
+++ debspawn-0.4.1/debspawn/osbase.py
@@ -56,9 +56,9 @@ class OSBase:
 
     def _make_name(self):
         if not self._arch:
-            out, _, ret = safe_run(['dpkg-architecture', '-qDEB_HOST_ARCH'])
+            out, _, ret = safe_run(['dpkg', '--print-architecture'])
             if ret != 0:
-                raise Exception('Running dpkg-architecture failed: {}'.format(out))
+                raise Exception('Running dpkg --print-architecture failed: {}'.format(out))
 
             self._arch = out.strip()
         if self._variant:
--- debspawn-0.4.1.orig/tests/conftest.py
+++ debspawn-0.4.1/tests/conftest.py
@@ -70,12 +70,12 @@ def build_arch():
     '''
     from debspawn.utils.command import safe_run
 
-    out, _, ret = safe_run(['dpkg-architecture', '-q', 'DEB_BUILD_ARCH'])
+    out, _, ret = safe_run(['dpkg', '--print-architecture'])
     assert ret == 0
 
     arch = out.strip()
     if not arch:
-        arch = 'amd64'  # assume arm64 as default
+        arch = 'amd64'  # assume amd64 as default
 
     return arch
 

Reply via email to