public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/2] do not add cross profile when building native package
@ 2025-11-03 16:01 'Felix Moessbauer' via isar-users
  2025-11-03 16:01 ` [PATCH 2/2] propagate distro-specific dependencies of arch all packages 'Felix Moessbauer' via isar-users
  2025-11-03 16:05 ` [PATCH 1/2] do not add cross profile when building native package 'Jan Kiszka' via isar-users
  0 siblings, 2 replies; 3+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2025-11-03 16:01 UTC (permalink / raw)
  To: isar-users
  Cc: jan.kiszka, cedric.hombourger, Felix Moessbauer, Benedikt Niedermayr

When building a -native package, the cross profile must not be added as
otherwise stricter apt cache checks added in trixie trigger. It anyways
makes no sense to add the cross profile when BUILD_ARCH equals
PACKAGE_ARCH. Previously this check was implemented incorrectly, as the
build arch was compared to the DISTRO_ARCH, which is always the target
arch in isar terms. This resulted in the following error message in
sbuild:

 E: The package cache was built for different architectures: amd64 vs arm64
 W: You may want to run apt-get update to correct these problems
 E: The package cache file is corrupted
 E: apt-get dist-upgrade failed

On bookworm, the incorrect check remained unnoticed, as apt did not have
the stricter checks yet.

Fixes: 872ef2e3 ("dpkg-base: Fix enabling of cross build profile")
Tested-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/dpkg-base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 4468a49a..d8287e8d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -146,7 +146,7 @@ dpkg_runbuild() {
 
 def isar_deb_build_profiles(d):
     deb_build_profiles = d.getVar('DEB_BUILD_PROFILES')
-    if d.getVar('BUILD_ARCH') != d.getVar('DISTRO_ARCH'):
+    if d.getVar('BUILD_ARCH') != d.getVar('PACKAGE_ARCH'):
         deb_build_profiles += ' cross'
     return deb_build_profiles.strip()
 
-- 
2.51.0

-- 
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/20251103160131.1005284-1-felix.moessbauer%40siemens.com.

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

* [PATCH 2/2] propagate distro-specific dependencies of arch all packages
  2025-11-03 16:01 [PATCH 1/2] do not add cross profile when building native package 'Felix Moessbauer' via isar-users
@ 2025-11-03 16:01 ` 'Felix Moessbauer' via isar-users
  2025-11-03 16:05 ` [PATCH 1/2] do not add cross profile when building native package 'Jan Kiszka' via isar-users
  1 sibling, 0 replies; 3+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2025-11-03 16:01 UTC (permalink / raw)
  To: isar-users
  Cc: jan.kiszka, cedric.hombourger, Felix Moessbauer, Benedikt Niedermayr

DPKG_ARCH=all packages are always build in their -native variant.
However, these packages still can have non-native dependencies which
must be built for the distro arch.

Fixes: 23a73895 ("multiarch: inject native variants of preferred providers")
Tested-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/multiarch.bbclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass
index c2bba21f..74b8f5b8 100644
--- a/meta/classes/multiarch.bbclass
+++ b/meta/classes/multiarch.bbclass
@@ -106,11 +106,13 @@ python multiarch_virtclass_handler() {
         # 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.
+        # variant by adding a dependency. We further empty the non-native
+        # do_deploy_dep task and clear the internal dependency chain, but keep
+        # other attached variables like RDEPENDS 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)
+        # clear internal dependencies (e.g. to do_dpkg_build)
+        e.data.setVarFlag('do_deploy_deb', 'deps', [])
+        # dispatch to native variant
         e.data.setVarFlag('do_deploy_deb', 'depends', f'{pn}-native:do_deploy_deb')
 }
 addhandler multiarch_virtclass_handler
-- 
2.51.0

-- 
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/20251103160131.1005284-2-felix.moessbauer%40siemens.com.

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

* Re: [PATCH 1/2] do not add cross profile when building native package
  2025-11-03 16:01 [PATCH 1/2] do not add cross profile when building native package 'Felix Moessbauer' via isar-users
  2025-11-03 16:01 ` [PATCH 2/2] propagate distro-specific dependencies of arch all packages 'Felix Moessbauer' via isar-users
@ 2025-11-03 16:05 ` 'Jan Kiszka' via isar-users
  1 sibling, 0 replies; 3+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-11-03 16:05 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users; +Cc: cedric.hombourger, Benedikt Niedermayr

On 03.11.25 17:01, Felix Moessbauer wrote:
> When building a -native package, the cross profile must not be added as
> otherwise stricter apt cache checks added in trixie trigger. It anyways
> makes no sense to add the cross profile when BUILD_ARCH equals
> PACKAGE_ARCH. Previously this check was implemented incorrectly, as the
> build arch was compared to the DISTRO_ARCH, which is always the target
> arch in isar terms. This resulted in the following error message in
> sbuild:
> 
>  E: The package cache was built for different architectures: amd64 vs arm64
>  W: You may want to run apt-get update to correct these problems
>  E: The package cache file is corrupted
>  E: apt-get dist-upgrade failed
> 
> On bookworm, the incorrect check remained unnoticed, as apt did not have
> the stricter checks yet.
> 
> Fixes: 872ef2e3 ("dpkg-base: Fix enabling of cross build profile")
> Tested-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/classes/dpkg-base.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 4468a49a..d8287e8d 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -146,7 +146,7 @@ dpkg_runbuild() {
>  
>  def isar_deb_build_profiles(d):
>      deb_build_profiles = d.getVar('DEB_BUILD_PROFILES')
> -    if d.getVar('BUILD_ARCH') != d.getVar('DISTRO_ARCH'):
> +    if d.getVar('BUILD_ARCH') != d.getVar('PACKAGE_ARCH'):
>          deb_build_profiles += ' cross'
>      return deb_build_profiles.strip()
>  

Tested here as well: Works, and this makes sense, indeed. Resolves
https://groups.google.com/g/isar-users/c/IUSoAfSF5OU/m/ZYPR34b9AAAJ.

Thanks,
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/60d14dce-4ad9-40e7-b698-5f7f77a18d0d%40siemens.com.

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

end of thread, other threads:[~2025-11-03 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-03 16:01 [PATCH 1/2] do not add cross profile when building native package 'Felix Moessbauer' via isar-users
2025-11-03 16:01 ` [PATCH 2/2] propagate distro-specific dependencies of arch all packages 'Felix Moessbauer' via isar-users
2025-11-03 16:05 ` [PATCH 1/2] do not add cross profile when building native package 'Jan Kiszka' via isar-users

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