public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'MOESSBAUER, Felix' via isar-users" <isar-users@googlegroups.com>
To: "Schmidt, Adriaan" <adriaan.schmidt@siemens.com>,
	"anaumann@emlix.com" <anaumann@emlix.com>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: Re: [PATCH 2/2] handle DPKG_ARCH=all case for transitive deps
Date: Mon, 15 Sep 2025 07:55:50 +0000	[thread overview]
Message-ID: <96bbe4d4fa98a89ca8ee07dd8100b1a936b394d5.camel@siemens.com> (raw)
In-Reply-To: <f7ac34b9-c96b-4939-aec4-c72bcd471db9@emlix.com>

On Fri, 2025-09-12 at 17:50 +0200, Andreas Naumann wrote:
> Am 11.09.25 um 12:20 schrieb MOESSBAUER, Felix:
> > On Wed, 2025-09-10 at 13:00 +0200, Andreas Naumann wrote:
> > > 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.
> > Good catch. This case is currently not handled. But I would like to
> > have it in a separate patch, as it tackles another issue.
> 
> I thought it's possible to make the nesting of if-clauses easier that
> way, but after some more thought and fiddling... unfortunately it's the
> opposite. So yes, separate patch.
> 
> > 
> > > > +    # 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?
> > If we are building for the native arch, we can just add the -native
> > variants to the PROVIDES, so dependencies of packages depending
> > explicitly on <foo>-native can be resolved (without the need for extra
> > recipe variants).
> 
> I understand that its a simpler solution in that case. But, maybe I'm not
> seeing the obvious, what would require a -native package then? If 
> target-arch
> is host-arch, why would anything else than the base package be in any
> dependency chain?

Consider the case where you have a documentation generator in your
dependency chain. This should always run in the native arch. In Debian,
this build dependency would be annotated with <foo>:any. In ISAR, you
need to annotate it with -native, to ensure that always the native
version is built, no matter what is DISTRO_ARCH.

> 
> > 
> > > 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?
> > Good question. In general, package dependencies are resolved for the
> > native architecture (or the requested one). AFAIK this selection is
> > propagated down the dependency tree. By that, A:i386 -> B:all -> C:x
> > should always resolve C as either :all or i386 (except if there is a
> > explicit cross-arch dependency specifier like :any, which we don't
> > model in bitbake). Anyways, The A:i386 -> B:all -> C:i386 chain should
> > already be resolved correctly with this patch.
> The patch doesnt change that -compat is "short-circuited" when 
> archIsAll, doesnt it?
> Or maybe I dont fully understand how the code works yet.
> > 
> > Tested by's are welcome :)
> 
> I'm working with it and keep an eye on it.

Thanks!

If there are no other comments, this patchset is ready to be merged.

Felix


-- 
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

-- 
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/96bbe4d4fa98a89ca8ee07dd8100b1a936b394d5.camel%40siemens.com.

  reply	other threads:[~2025-09-15  7:56 UTC|newest]

Thread overview: 14+ 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-10-03 11:09   ` Anton Mikanovich
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
2025-09-11 10:20     ` 'MOESSBAUER, Felix' via isar-users
2025-09-12 15:50       ` Andreas Naumann
2025-09-15  7:55         ` 'MOESSBAUER, Felix' via isar-users [this message]
2025-09-15 17:49   ` Andreas Naumann
2025-09-16  7:16     ` 'MOESSBAUER, Felix' via isar-users
2025-09-19  7:15       ` Andreas Naumann
2025-10-06 14:05         ` 'MOESSBAUER, Felix' via isar-users
2025-10-07 10:57           ` 'Andreas Naumann' via isar-users
2025-10-07 12:31   ` 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=96bbe4d4fa98a89ca8ee07dd8100b1a936b394d5.camel@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=anaumann@emlix.com \
    --cc=felix.moessbauer@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