[PATCH] customizations: defer IMAGE variable expansion in CUSTOMIZATION_VARS

3 views
Skip to first unread message

Cedric Hombourger

unread,
Nov 6, 2025, 10:15:17 AM (yesterday) Nov 6
to isar-...@googlegroups.com, Cedric Hombourger
The previous logic for conditionally adding the IMAGE variable to
CUSTOMIZATION_VARS suffered from a Bitbake variable expansion
timing issue.

The original line `CUSTOMIZATION_VARS_IMAGE ?= "${IMAGE}"` would evaluate
the `${IMAGE}` variable too early in the parsing process. If `IMAGE` had
not yet been fully defined or resolved to its final value (e.g.,
`isar-image-base`), `CUSTOMIZATION_VARS_IMAGE` would incorrectly store
the literal string `"${IMAGE}"`.

Consequently, when `CUSTOMIZATION_VARS` was later appended using a
Python expression that retrieved `CUSTOMIZATION_VARS_IMAGE`, it would
receive this unexpanded literal string. This led to build failures and
errors such as:

ERROR: ... Unable to get checksum for ... ${IMAGE} SRC_URI entry ...

Introduce a new Bitbake override, `:customization-for-images`, which
is conditionally activated when `CUSTOMIZATION_FOR_IMAGES` is set (to
preserve the initial semantic of 9a2919be). The `IMAGE` variable is
then appended to `CUSTOMIZATION_VARS` specifically within this override
context:

`CUSTOMIZATION_VARS:append:customization-for-images = " ${IMAGE}"`

By associating the append operation with an override, the expansion is
deferred and ensures that `${IMAGE}` is properly resolved to its value
before being added to `CUSTOMIZATION_VARS`.

Fixes: 9a2919be
Signed-off-by: Cedric Hombourger <cedric.h...@siemens.com>
---
meta/classes/customization-base.bbclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/customization-base.bbclass b/meta/classes/customization-base.bbclass
index 82cad67e..7603460b 100644
--- a/meta/classes/customization-base.bbclass
+++ b/meta/classes/customization-base.bbclass
@@ -8,8 +8,8 @@ CUSTOMIZATIONS[doc] = "List of customization packages to be installed in images.

CUSTOMIZATION_VARS ?= "${DISTRO} ${MACHINE}"
CUSTOMIZATION_VARS[doc] = "List of variables that should be added to customization package names."
-CUSTOMIZATION_VARS_IMAGE ?= "${IMAGE}"
-CUSTOMIZATION_VARS:append = " ${@d.getVar('CUSTOMIZATION_VARS_IMAGE') if d.getVar('CUSTOMIZATION_FOR_IMAGES').strip() else ''}"
+OVERRIDES:append = "${@ ':customization-for-images' if (d.getVar('CUSTOMIZATION_FOR_IMAGES') or '').strip() else '' }"
+CUSTOMIZATION_VARS:append:customization-for-images = " ${IMAGE}"

CUSTOMIZATION_VARS_PREFIXED ?= "${DISTRO}"
CUSTOMIZATION_VARS_PREFIXED[doc] = "List of variables from CUSTOMIZATION_VARS that should be prefixed rather than suffixed to customization package names."
--
2.47.3

Reply all
Reply to author
Forward
0 new messages