Bug#1090054: dh_qmldeps: multiple issues with architecture handling
Package: pkg-kde-tools
Filename: /usr/bin/dh_qmldeps
Version: 0.18.10
Tags: patch
Hi Sandro,
here goes my promised patch for improving the architecture handling in
dh_qmldeps. Let me know if you have any questions.
Helmut
diff --minimal -Nru pkg-kde-tools-0.18.10/debian/changelog pkg-kde-tools-0.18.10+nmu1/debian/changelog
--- pkg-kde-tools-0.18.10/debian/changelog 2024-12-11 00:12:23.000000000 +0100
+++ pkg-kde-tools-0.18.10+nmu1/debian/changelog 2024-12-15 19:29:55.000000000 +0100
@@ -1,3 +1,13 @@
+pkg-kde-tools (0.18.10+nmu1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Improve architecture handling in dh_qmldeps:
+ + Fix build vs host confusion.
+ + Speed up architecture detection using environment
+ + Correctly match architecture patterns
+
+ -- Helmut Grohne <helmut@subdivi.de> Sun, 15 Dec 2024 19:29:55 +0100
+
pkg-kde-tools (0.18.10) unstable; urgency=medium
* dh_qmldeps:
diff --minimal -Nru pkg-kde-tools-0.18.10/dh_qmldeps pkg-kde-tools-0.18.10+nmu1/dh_qmldeps
--- pkg-kde-tools-0.18.10/dh_qmldeps 2024-12-11 00:11:54.000000000 +0100
+++ pkg-kde-tools-0.18.10+nmu1/dh_qmldeps 2024-12-15 19:29:55.000000000 +0100
@@ -17,6 +17,8 @@
sys.path.insert(0, str(parent_path))
PKGKDE_GETQMLDEPENDS = parent_path/"pkgkde-getqmldepends"
+from debian.debian_support import DpkgArchTable
+
from pythonlib import qmldeps
logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: %(message)s')
@@ -65,7 +67,12 @@
arch_any = "-a" in getqmldepends_glob_args
arch_all = "-i" in getqmldepends_glob_args
-target_arch = subprocess.check_output(["dpkg-architecture", "-qDEB_TARGET_ARCH"]).strip().decode()
+try:
+ host_arch = os.environ["DEB_HOST_ARCH"]
+except KeyError:
+ host_arch = subprocess.check_output(["dpkg-architecture", "-qDEB_HOST_ARCH"]).strip().decode()
+
+archtable = DpkgArchTable.load_arch_table()
if not arch_any and not arch_all:
arch_any = True
@@ -79,13 +86,8 @@
skip = False
elif arch_all and "all" in archs:
skip = False
- elif arch_any:
- if "any" in archs:
- skip = False
- elif target_arch in archs:
- skip = False
- elif archs != ["all"] and not target_arch:
- log.warning(f"{pkg_name}: SKIP - set DEB_TARGET_ARCH environment variable.")
+ elif arch_any and any(archtable.matches_architecture(host_arch, arch) for arch in archs):
+ skip = False
if skip:
continue
Reply to: