public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Andreas Naumann' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Andreas Naumann <anaumann@emlix.com>
Subject: [PATCH v2 1/3] test: Add test to check correct multiarch dependency propagation
Date: Tue, 18 Nov 2025 15:35:21 +0100	[thread overview]
Message-ID: <20251118143523.2326879-2-anaumann@emlix.com> (raw)
In-Reply-To: <20251118143523.2326879-1-anaumann@emlix.com>

Create two transitive dependency chains with simple dpkg-raw packages as
follows:
image -> all package -> any package
imager -> all package as -native -> any package as -native

Assert that
- the all package is always build for the host architecture
- the dependent any package in the cross chain is built for target arch only
- the dependent any package in the native chain is built for host arch only
by detecting any undesired host/target architecture combination in the
override_dh_auto_configure function and exiting with an error.

Signed-off-by: Andreas Naumann <anaumann@emlix.com>
---
 .../recipes-app/test-all-depnocross/files/rules     | 11 +++++++++++
 .../test-all-depnocross/test-all-depnocross.bb      | 11 +++++++++++
 .../recipes-app/test-all-deponlycross/files/rules   | 11 +++++++++++
 .../test-all-deponlycross/test-all-deponlycross.bb  | 11 +++++++++++
 meta-test/recipes-app/test-any-nocross/files/rules  | 11 +++++++++++
 .../test-any-nocross/test-any-nocross.bb            | 11 +++++++++++
 .../recipes-app/test-any-onlycross/files/rules      | 11 +++++++++++
 .../test-any-onlycross/test-any-onlycross.bb        | 13 +++++++++++++
 testsuite/citest.py                                 | 11 +++++++++++
 9 files changed, 101 insertions(+)
 create mode 100644 meta-test/recipes-app/test-all-depnocross/files/rules
 create mode 100644 meta-test/recipes-app/test-all-depnocross/test-all-depnocross.bb
 create mode 100644 meta-test/recipes-app/test-all-deponlycross/files/rules
 create mode 100644 meta-test/recipes-app/test-all-deponlycross/test-all-deponlycross.bb
 create mode 100644 meta-test/recipes-app/test-any-nocross/files/rules
 create mode 100644 meta-test/recipes-app/test-any-nocross/test-any-nocross.bb
 create mode 100644 meta-test/recipes-app/test-any-onlycross/files/rules
 create mode 100644 meta-test/recipes-app/test-any-onlycross/test-any-onlycross.bb

diff --git a/meta-test/recipes-app/test-all-depnocross/files/rules b/meta-test/recipes-app/test-all-depnocross/files/rules
new file mode 100644
index 00000000..6640cf23
--- /dev/null
+++ b/meta-test/recipes-app/test-all-depnocross/files/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+%:
+	dh \$@
+
+# Detect cross-compilation and fail if so
+override_dh_auto_configure:
+	@if [ "$(DEB_BUILD_ARCH)" != "$(DEB_HOST_ARCH)" ]; then \
+		echo "Cross-compilation detected! This is an \"all\" package."; \
+		exit 1; \
+	fi
+	dh_auto_configure
diff --git a/meta-test/recipes-app/test-all-depnocross/test-all-depnocross.bb b/meta-test/recipes-app/test-all-depnocross/test-all-depnocross.bb
new file mode 100644
index 00000000..86ae3847
--- /dev/null
+++ b/meta-test/recipes-app/test-all-depnocross/test-all-depnocross.bb
@@ -0,0 +1,11 @@
+# Test package using dpkg-raw
+
+SRC_URI = "file://rules"
+
+inherit dpkg-raw
+
+DEPENDS = "test-any-nocross"
+
+do_install() {
+	bbnote "Test \"all\" package which depends on an any package."
+}
diff --git a/meta-test/recipes-app/test-all-deponlycross/files/rules b/meta-test/recipes-app/test-all-deponlycross/files/rules
new file mode 100644
index 00000000..6640cf23
--- /dev/null
+++ b/meta-test/recipes-app/test-all-deponlycross/files/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+%:
+	dh \$@
+
+# Detect cross-compilation and fail if so
+override_dh_auto_configure:
+	@if [ "$(DEB_BUILD_ARCH)" != "$(DEB_HOST_ARCH)" ]; then \
+		echo "Cross-compilation detected! This is an \"all\" package."; \
+		exit 1; \
+	fi
+	dh_auto_configure
diff --git a/meta-test/recipes-app/test-all-deponlycross/test-all-deponlycross.bb b/meta-test/recipes-app/test-all-deponlycross/test-all-deponlycross.bb
new file mode 100644
index 00000000..6af762b9
--- /dev/null
+++ b/meta-test/recipes-app/test-all-deponlycross/test-all-deponlycross.bb
@@ -0,0 +1,11 @@
+# Test all package using dpkg-raw
+
+SRC_URI = "file://rules"
+
+inherit dpkg-raw
+
+DEPENDS = "test-any-onlycross"
+
+do_install() {
+	bbnote "Test \"all\" package which depends on an any package."
+}
diff --git a/meta-test/recipes-app/test-any-nocross/files/rules b/meta-test/recipes-app/test-any-nocross/files/rules
new file mode 100644
index 00000000..74d905b6
--- /dev/null
+++ b/meta-test/recipes-app/test-any-nocross/files/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+%:
+	dh \$@
+
+# Detect cross-compilation and fail if so
+override_dh_auto_configure:
+	@if [ "$(DEB_BUILD_ARCH)" != "$(DEB_HOST_ARCH)" ]; then \
+		echo "Cross-compilation detected!"; \
+		exit 1; \
+	fi
+	dh_auto_configure
diff --git a/meta-test/recipes-app/test-any-nocross/test-any-nocross.bb b/meta-test/recipes-app/test-any-nocross/test-any-nocross.bb
new file mode 100644
index 00000000..6d0321ae
--- /dev/null
+++ b/meta-test/recipes-app/test-any-nocross/test-any-nocross.bb
@@ -0,0 +1,11 @@
+# Test package using dpkg-raw, which breaks when trying to cross
+# compile
+
+SRC_URI = "file://rules"
+
+inherit dpkg-raw
+DPKG_ARCH = "any"
+
+do_install() {
+	bbnote "Test \"any\" package which fails crosscompile."
+}
diff --git a/meta-test/recipes-app/test-any-onlycross/files/rules b/meta-test/recipes-app/test-any-onlycross/files/rules
new file mode 100644
index 00000000..02031f1a
--- /dev/null
+++ b/meta-test/recipes-app/test-any-onlycross/files/rules
@@ -0,0 +1,11 @@
+#!/usr/bin/make -f
+%:
+	dh \$@
+
+# Detect native compilation and fail if so
+override_dh_auto_configure:
+	if [ "$(DEB_BUILD_ARCH)" = "$(DEB_HOST_ARCH)" ]; then \
+		echo "Native compilation detected!"; \
+		exit 1; \
+	fi
+	dh_auto_configure
diff --git a/meta-test/recipes-app/test-any-onlycross/test-any-onlycross.bb b/meta-test/recipes-app/test-any-onlycross/test-any-onlycross.bb
new file mode 100644
index 00000000..5b2eace6
--- /dev/null
+++ b/meta-test/recipes-app/test-any-onlycross/test-any-onlycross.bb
@@ -0,0 +1,13 @@
+# Test package using dpkg-raw, which breaks when trying to cross
+# compile
+
+#MAINTAINER = "Your name here <you@domain.com>"
+
+SRC_URI = "file://rules"
+
+inherit dpkg-raw
+DPKG_ARCH = "any"
+
+do_install() {
+	bbnote "Test \"any\" package which fails native compile."
+}
diff --git a/testsuite/citest.py b/testsuite/citest.py
index f944ee4a..6f8e03cf 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -255,6 +255,17 @@ class CrossTest(CIBaseTest):
         self.init()
         self.perform_build_test(targets)
 
+    def test_cross_dependencies(self):
+        targets = [
+            'mc:qemuarm64-bookworm:isar-image-ci',
+        ]
+
+        lines = [f"IMAGER_BUILD_DEPS:append = ' test-all-depnocross-native'",
+                 f"IMAGE_INSTALL:append = ' test-all-deponlycross'",
+        ]
+
+        self.init()
+        self.perform_build_test(targets, lines=lines)
 
 class KernelTests(CIBaseTest):
     """
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251118143523.2326879-2-anaumann%40emlix.com.

  reply	other threads:[~2025-11-18 14:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 14:35 [PATCH v2 0/3] test and fix transitive multiarch dependencies 'Andreas Naumann' via isar-users
2025-11-18 14:35 ` 'Andreas Naumann' via isar-users [this message]
2025-11-18 14:35 ` [PATCH v2 2/3] rootfs: Do not recursively build unneeded packages 'Andreas Naumann' via isar-users
2025-11-18 14:35 ` [PATCH v2 3/3] multiarch: Replace divertion of deploy task for "all" packages 'Andreas Naumann' via isar-users
2025-11-27  8:34 ` [PATCH v2 0/3] test and fix transitive multiarch dependencies Zhihang Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251118143523.2326879-2-anaumann@emlix.com \
    --to=isar-users@googlegroups.com \
    --cc=anaumann@emlix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox