public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] customizations: defer IMAGE variable expansion in CUSTOMIZATION_VARS
@ 2025-11-06 15:15 'Cedric Hombourger' via isar-users
  2025-11-10 11:53 ` Zhihang Wei
  0 siblings, 1 reply; 2+ messages in thread
From: 'Cedric Hombourger' via isar-users @ 2025-11-06 15:15 UTC (permalink / raw)
  To: isar-users; +Cc: 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.hombourger@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

-- 
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/20251106151508.3872857-1-cedric.hombourger%40siemens.com.

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

* Re: [PATCH] customizations: defer IMAGE variable expansion in CUSTOMIZATION_VARS
  2025-11-06 15:15 [PATCH] customizations: defer IMAGE variable expansion in CUSTOMIZATION_VARS 'Cedric Hombourger' via isar-users
@ 2025-11-10 11:53 ` Zhihang Wei
  0 siblings, 0 replies; 2+ messages in thread
From: Zhihang Wei @ 2025-11-10 11:53 UTC (permalink / raw)
  To: Cedric Hombourger, isar-users

Applied to next, thanks.

Best regards,
Zhihang

On 11/6/25 16:15, 'Cedric Hombourger' via isar-users wrote:
> 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.hombourger@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."

-- 
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/7cc53bda-e512-40a2-b05b-f3569991e857%40ilbers.de.

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

end of thread, other threads:[~2025-11-10 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-06 15:15 [PATCH] customizations: defer IMAGE variable expansion in CUSTOMIZATION_VARS 'Cedric Hombourger' via isar-users
2025-11-10 11:53 ` Zhihang Wei

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