public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Zhihang Wei <wzh@ilbers.de>
To: Cedric Hombourger <cedric.hombourger@siemens.com>,
	isar-users@googlegroups.com
Subject: Re: [PATCH] customizations: defer IMAGE variable expansion in CUSTOMIZATION_VARS
Date: Mon, 10 Nov 2025 12:53:05 +0100	[thread overview]
Message-ID: <7cc53bda-e512-40a2-b05b-f3569991e857@ilbers.de> (raw)
In-Reply-To: <20251106151508.3872857-1-cedric.hombourger@siemens.com>

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.

      reply	other threads:[~2025-11-10 11:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 15:15 'Cedric Hombourger' via isar-users
2025-11-10 11:53 ` Zhihang Wei [this message]

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=7cc53bda-e512-40a2-b05b-f3569991e857@ilbers.de \
    --to=wzh@ilbers.de \
    --cc=cedric.hombourger@siemens.com \
    --cc=isar-users@googlegroups.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