[1/1] native: fix unexpanded SSTATE_PKGARCH for -native variants

Message ID 20260925071744.1727072-1-felix.moessbauer@siemens.com
State Priority Review
Headers show
Series [1/1] native: fix unexpanded SSTATE_PKGARCH for -native variants | expand

Commit Message

Felix Moessbauer Sept. 25, 2026, 7:17 a.m. UTC
sstate.bbclass (copied verbatim from Yocto) derives SSTATE_PKGARCH from
BUILD_ARCH in its anonymous python function. In Isar, BUILD_ARCH is not
defined at configuration level but only assigned later by the anonymous
function of crossvars.bbclass. As sstate is pulled in via INHERIT, its
anonymous function runs first, so BUILD_ARCH is still unset and
SSTATE_PKGARCH ends up undefined.

BitBake then leaves the literal ${SSTATE_PKGARCH} in SSTATE_PKGSPEC,
which propagates into the sstate artifact file names of all -native
variants:

  sstate:example-raw-native:amd64-isar:0.3:r0:${SSTATE_PKGARCH}:12:...

Overriding SSTATE_PKGARCH for class-native does not help: setVar() drops
all currently active overrides of the variable it sets, so the
assignment in sstate.bbclass wipes it again. Define BUILD_ARCH for
class-native instead, which is what crossvars.bbclass computes for that
variant anyway. -compat is not affected, as sstate.bbclass leaves
SSTATE_PKGARCH at its PACKAGE_ARCH default there.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/native.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass
index 7dad3bf9..4efa387a 100644
--- a/meta/classes-recipe/native.bbclass
+++ b/meta/classes-recipe/native.bbclass
@@ -8,3 +8,7 @@ 
 ################################################################################
 
 PACKAGE_ARCH:class-native = "${HOST_ARCH}"
+
+# Must match what crossvars.bbclass derives from PACKAGE_ARCH above, as
+# sstate.bbclass already reads BUILD_ARCH before crossvars.bbclass sets it.
+BUILD_ARCH:class-native = "${HOST_ARCH}"