public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v3] base: Fix HOST_ARCH for native builds
@ 2023-10-01  9:09 Jan Kiszka
  2023-10-03 16:11 ` Uladzimir Bely
  2023-10-05  5:48 ` Uladzimir Bely
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Kiszka @ 2023-10-01  9:09 UTC (permalink / raw)
  To: isar-users; +Cc: Uladzimir Bely, Moessbauer, Felix (T CED SES-DE)

From: Jan Kiszka <jan.kiszka@siemens.com>

HOST_ARCH must be DISTRO_ARCH when we are not cross-building. Otherwise,
recipes that set PACKAGE_ARCH to it will fail in native builds.

To avoid recursions, we have to rework the ISAR_CROSS_COMPILE setting in
imagetypes.bbclass to an anonymous python function.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

This looks better now.

Maybe we can even kill BUILD_HOST_ARCH, now that HOST_ARCH is fixed.

 meta/classes/base.bbclass       | 6 ++++--
 meta/classes/imagetypes.bbclass | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 88004120..f315a9d5 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -49,13 +49,15 @@ def oe_import(d):
 # We need the oe module name space early (before INHERITs get added)
 OE_IMPORTED := "${@oe_import(d)}"
 
-def get_deb_host_arch():
+def get_deb_host_arch(d):
     import subprocess
+    if d.getVar("ISAR_CROSS_COMPILE") != "1":
+        return d.getVar("DISTRO_ARCH")
     host_arch = subprocess.check_output(
         ["dpkg", "--print-architecture"]
     ).decode('utf-8').strip()
     return host_arch
-HOST_ARCH ??= "${@get_deb_host_arch()}"
+HOST_ARCH ??= "${@get_deb_host_arch(d)}"
 HOST_DISTRO ??= "${DISTRO}"
 
 die() {
diff --git a/meta/classes/imagetypes.bbclass b/meta/classes/imagetypes.bbclass
index a3be0a1d..205377b1 100644
--- a/meta/classes/imagetypes.bbclass
+++ b/meta/classes/imagetypes.bbclass
@@ -65,8 +65,10 @@ UBIFS_IMG ?= "${PP_DEPLOY}/${IMAGE_FULLNAME}.ubifs"
 
 # glibc bug 23960 https://sourceware.org/bugzilla/show_bug.cgi?id=23960
 # should not use QEMU on armhf target with mkfs.ubifs < v2.1.3
-THIS_ISAR_CROSS_COMPILE := "${ISAR_CROSS_COMPILE}"
-ISAR_CROSS_COMPILE:armhf = "${@bb.utils.contains('IMAGE_BASETYPES', 'ubifs', '1', '${THIS_ISAR_CROSS_COMPILE}', d)}"
+python() {
+    if d.getVar('DISTRO_ARCH') == 'armhf' and bb.utils.contains('IMAGE_BASETYPES', 'ubifs', True, False, d):
+        d.setVar('ISAR_CROSS_COMPILE', '1')
+}
 
 IMAGE_CMD:ubifs() {
     ${SUDO_CHROOT} /usr/sbin/mkfs.ubifs ${MKUBIFS_ARGS} \
-- 
2.35.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-05 10:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-01  9:09 [PATCH v3] base: Fix HOST_ARCH for native builds Jan Kiszka
2023-10-03 16:11 ` Uladzimir Bely
2023-10-05  5:48 ` Uladzimir Bely
2023-10-05  6:56   ` Jan Kiszka
2023-10-05  8:18     ` Uladzimir Bely
2023-10-05  8:36     ` Jan Kiszka
2023-10-05  9:37       ` Jan Kiszka
2023-10-05 10:17         ` Uladzimir Bely
2023-10-05 10:39           ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox