public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Andreas Naumann <anaumann@emlix.com>
To: isar-users@googlegroups.com, felix.moessbauer@siemens.com
Subject: Re: [PATCH 2/2] handle DPKG_ARCH=all case for transitive deps
Date: Wed, 10 Sep 2025 13:00:34 +0200	[thread overview]
Message-ID: <24e7baaa-c347-4327-b06d-25c9a074a494@emlix.com> (raw)
In-Reply-To: <20250820124140.281190-3-felix.moessbauer@siemens.com>

Hi Felix, all,

Am 20.08.25 um 14:41 schrieb 'Felix Moessbauer' via isar-users:
> Arch=all packages might build depend on other arch=all packages, hence we
> need to correctly model the dependency chain. Otherwise the transitive
> dependencies are built for the distro arch instead of the native arch.
>
> We implement this by dispatching the non-native variant of DPKG_ARCH=all
> packages to the -native variant by adding a dependency. We further
> replace the non-native do_deploy_dep task with a noop to preserve the
> dependency chain.
>
> Co-developed-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>   meta/classes/multiarch.bbclass | 18 +++++++++++++++++-
>   1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
> index babdfbd4..c2bba21f 100644
> --- a/meta/classes/multiarch.bbclass
> +++ b/meta/classes/multiarch.bbclass
> @@ -29,7 +29,11 @@ python() {
>               d.appendVar('BBCLASSEXTEND', ' compat')
>   
>       # build native separately only when it differs from the target variant
> -    if not archIsAll and archDiffers:
> +    # We must not short-circuit for DPKG_ARCH=all packages, as they might
> +    # have transitive dependencies which need to be built for -native.

Funny enough i suspected to have the same problem yesterday, but it 
turned out to
be different: When a package is single architecture only, e.g. arm64, it 
should not be
extended as native if HOST_ARCH is amd64.

So I added a check to BBCLASSEXTEND only if DPKG_ARCH != HOST_ARCH.

> +    # This special handling for DPKG_ARCH=all packages is left to the
> +    # multiarch_virtclass_handler
> +    if archDiffers:
>           d.appendVar('BBCLASSEXTEND', ' native')
Now, seeing your patch to remove the not-"all" case also, I wonder if 
that could be used
as the sole check before BBCLASSEXTEND. Like e.g.
archIsNative = d.getVar('DPKG_ARCH') == d.getVar('HOST_ARCH')
if isNative:
    d.appendVar('BBCLASSEXTEND', ' native')
>       else:
>           extend_provides(pn, 'native', d)

but now I wonder what the extend_provides is needed for. If HOST_ARCH == 
DISTRO_ARCH, what's
the use of providing a native variant?

But back to your Patch: Is it possible that -compat "all" packages also have
dependencies on other "all" packages, which in turn have dependencies on
architecture specific packages?

regards,
Andreas


> @@ -86,6 +90,8 @@ python multiarch_virtclass_handler() {
>               d.setVar(var, ' '.join(multiarch_var))
>   
>       pn = e.data.getVar('PN')
> +    archDiffers = d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH')
> +    archIsAll = d.getVar('DPKG_ARCH') == 'all'
>       if pn.endswith('-compat'):
>           e.data.setVar('BPN', pn[:-len('-compat')])
>           e.data.appendVar('OVERRIDES', ':class-compat')
> @@ -96,6 +102,16 @@ python multiarch_virtclass_handler() {
>           e.data.appendVar('OVERRIDES', ':class-native')
>           fixup_pn_in_vars(e.data)
>           fixup_depends('-native', e.data)
> +    elif archIsAll and archDiffers:
> +        # Arch=all packages might build depend on other arch=all packages,
> +        # hence we need to correctly model the dependency chain.
> +        # We implement this by dispatching the non-native variant to the -native
> +        # variant by adding a dependency. We further replace the non-native
> +        # do_deploy_dep task with a noop to preserve the dependency chain.
> +        e.data.setVar('do_deploy_deb', '')
> +        bb.build.deltask('deploy_deb', e.data)
> +        bb.build.addtask('deploy_deb', 'do_build', '', e.data)
> +        e.data.setVarFlag('do_deploy_deb', 'depends', f'{pn}-native:do_deploy_deb')
>   }
>   addhandler multiarch_virtclass_handler
>   multiarch_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"

-- 
Andreas Naumann

emlix GmbH
Headquarters: Berliner Str. 12, 37073 Goettingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Goettingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com

-- 
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/24e7baaa-c347-4327-b06d-25c9a074a494%40emlix.com.

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 12:41 [PATCH 0/2] " 'Felix Moessbauer' via isar-users
2025-08-20 12:41 ` [PATCH 1/2] dpkg-raw: add files to source package 'Felix Moessbauer' via isar-users
2025-08-20 12:41 ` [PATCH 2/2] handle DPKG_ARCH=all case for transitive deps 'Felix Moessbauer' via isar-users
2025-09-10 11:00   ` Andreas Naumann [this message]
2025-09-11 10:20     ` 'MOESSBAUER, Felix' via isar-users
2025-09-12 15:50       ` Andreas Naumann

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=24e7baaa-c347-4327-b06d-25c9a074a494@emlix.com \
    --to=anaumann@emlix.com \
    --cc=felix.moessbauer@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