public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Felix Moessbauer <felix.moessbauer@siemens.com>,
	isar-users@googlegroups.com
Cc: adriaan.schmidt@siemens.com
Subject: Re: [PATCH 1/1] multiarch: inject native variants of preferred providers
Date: Fri, 17 Oct 2025 11:09:10 +0200	[thread overview]
Message-ID: <8c8b0d6e-95e6-449c-8834-20042035a7ed@siemens.com> (raw)
In-Reply-To: <20251017085344.2647058-1-felix.moessbauer@siemens.com>

On 17.10.25 10:53, Felix Moessbauer wrote:
> We already create multiarch variants of our recipes in case the host and
> target arch are not the same. However, this currently breaks when
> combining with PREFERRED_PROVIDERS, as no entries for the -native
> variantes are created. By that, bitbake bails out with the following
> error:
>   Multiple .bb files are due to be built which each provide
>   <recipe>-native.
> 
> We fix this by injecting the -native variants for all preferred
> providers as well (but only in case no explicit one is provided for the
> -native variant). This needs to be done after config parsing (hence in
> base.bblcass), as the PREFERRED_PROVIDERS are already used at recipe
> parsing time (where multiarch.bbclass is loaded).
> 
> Fixes: 5a7c2f70 ("handle DPKG_ARCH=all case for transitive deps")
> Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> Note, that this can be tested on isar-cip-core, but requires the other
> fix in "image: Fix construction of do_image_tools dependencies" as well.
> 
>  meta/classes/base.bbclass | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 90fd570c..471442e5 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -62,6 +62,30 @@ def get_deb_host_arch():
>  HOST_ARCH ??= "${@get_deb_host_arch()}"
>  HOST_DISTRO ??= "${DISTRO}"
>  
> +# Inject the PREFERRED_PROVIDERs for multiarch variants. This corresponds to
> +# the multiarch_virtclass_handler logic in multiarch.bbclass, but needs to be
> +# done prior to recipe parsing.
> +def inject_preferred_providers(provider, suffix, d):
> +    PP_PREFIX = 'PREFERRED_PROVIDER_'
> +    if provider.endswith(suffix):
> +        return
> +    prefp_value = d.getVar(PP_PREFIX + provider)
> +    if prefp_value and not d.getVar(PP_PREFIX + provider + suffix):
> +        d.setVar(PP_PREFIX + provider + suffix, prefp_value + suffix)
> +
> +python multiarch_preferred_providers_handler() {
> +    if d.getVar('HOST_ARCH') == d.getVar('DISTRO_ARCH'):
> +        return
> +
> +    pref_vars = {var: e.data.getVar(var)
> +                 for var in e.data.keys()
> +                 if var.startswith('PREFERRED_PROVIDER_')}
> +    for p in pref_vars:
> +        inject_preferred_providers(p.replace('PREFERRED_PROVIDER_', ''), '-native', e.data)
> +}
> +addhandler multiarch_preferred_providers_handler
> +multiarch_preferred_providers_handler[eventmask] = "bb.event.ConfigParsed"
> +
>  die() {
>  	bbfatal "$*"
>  }

Works well.

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

I suppose we should do the same for PREFERRED_VERSION, and also for
-kbuildtarget of self-built kernels.

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center

-- 
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/8c8b0d6e-95e6-449c-8834-20042035a7ed%40siemens.com.

  reply	other threads:[~2025-10-17  9:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  8:53 'Felix Moessbauer' via isar-users
2025-10-17  9:09 ` 'Jan Kiszka' via isar-users [this message]
2025-10-24 12:17 ` Zhihang Wei

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=8c8b0d6e-95e6-449c-8834-20042035a7ed@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=jan.kiszka@siemens.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