From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: wzh@ilbers.de, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/3] crossvars: provide the base distro of the selected sbuild chroot
Date: Wed, 21 Oct 2026 12:25:42 +0200 [thread overview]
Message-ID: <20261021102544.3614772-2-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20261021102544.3614772-1-felix.moessbauer@siemens.com>
Several places need to know which base distro the chroot of a recipe was
bootstrapped from, mostly to name the DEBDIR/DEBSRCDIR sub-directory that
base-apt later imports. They all answer that question differently:
dpkg.bbclass keys off ISAR_CROSS_COMPILE
aptsrc_fetcher.py uses BASE_DISTRO
sbuild-chroot-*.bb set ROOTFS_BASE_DISTRO explicitly
Only the last one is correct in general. BASE_DISTRO is resolved against
OVERRIDES, which start with PACKAGE_ARCH, so it does not describe the
chroot at all: for native recipes PACKAGE_ARCH is HOST_ARCH, which means
"BASE_DISTRO:arm64 = raspios64" is not applied and BASE_DISTRO silently
expands to something else than it does for a target recipe of the same
multiconfig. The ISAR_CROSS_COMPILE heuristic disagrees with the actual
chroot selection whenever DISTRO_ARCH equals HOST_ARCH.
crossvars.bbclass already performs the host/target chroot dispatch, so
let it export the matching base distro as SCHROOT_BASE_DISTRO next to
SCHROOT_DIR and SCHROOT_DEP, and consume it in dpkg.bbclass. This keeps
one single source of truth and mirrors the ROOTFS_BASE_DISTRO naming of
the sbuild-chroot recipes.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/crossvars.bbclass | 8 ++++++++
meta/classes-recipe/dpkg.bbclass | 5 +----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/meta/classes-recipe/crossvars.bbclass b/meta/classes-recipe/crossvars.bbclass
index 7cf2d660..fbfcda93 100644
--- a/meta/classes-recipe/crossvars.bbclass
+++ b/meta/classes-recipe/crossvars.bbclass
@@ -30,13 +30,21 @@ python __anonymous() {
schroot_dir = d.getVar('SCHROOT_HOST_DIR', False)
sbuild_dep = "sbuild-chroot-host" + flavor_suffix + ":do_build"
sdk_toolchain = "crossbuild-essential-" + distro_arch
+ schroot_base_distro = d.getVar('HOST_BASE_DISTRO', False)
else:
d.setVar('BUILD_ARCH', distro_arch)
schroot_dir = d.getVar('SCHROOT_TARGET_DIR', False)
sbuild_dep = "sbuild-chroot-target" + flavor_suffix + ":do_build"
sdk_toolchain = "build-essential"
+ schroot_base_distro = d.getVar('BASE_DISTRO', False)
d.setVar('SCHROOT_DIR', schroot_dir + flavor_suffix)
d.setVar('SCHROOT_DEP', sbuild_dep)
+ # BASE_DISTRO is resolved against OVERRIDES, which start with PACKAGE_ARCH,
+ # so it does not describe the chroot a recipe is built in (PACKAGE_ARCH is
+ # HOST_ARCH for native recipes). Mirror ROOTFS_BASE_DISTRO of the
+ # sbuild-chroot recipes to give the DEBDIR/DEBSRCDIR layout a single,
+ # chroot-correct name.
+ d.setVar('SCHROOT_BASE_DISTRO', schroot_base_distro)
if isar_can_build_compat(d):
sdk_toolchain += " crossbuild-essential-" + compat_arch
d.setVar('SDK_TOOLCHAIN', sdk_toolchain)
diff --git a/meta/classes-recipe/dpkg.bbclass b/meta/classes-recipe/dpkg.bbclass
index 35408495..0ae00b75 100644
--- a/meta/classes-recipe/dpkg.bbclass
+++ b/meta/classes-recipe/dpkg.bbclass
@@ -82,10 +82,7 @@ dpkg_runbuild() {
bbwarn "Export of '${line}' detected, please migrate to templates"
done
- distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
- if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
- distro="${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
- fi
+ distro="${SCHROOT_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
deb_dl_dir_import "${WORKDIR}/rootfs" "${distro}"
--
2.55.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/20261021102544.3614772-2-felix.moessbauer%40siemens.com.
next prev parent reply other threads:[~2026-10-21 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 10:25 [PATCH 0/3] Fixes for BASE_DISTRO 'Felix Moessbauer' via isar-users
2026-10-21 10:25 ` 'Felix Moessbauer' via isar-users [this message]
2026-10-21 10:25 ` [PATCH 2/3] apt-fetcher: cache sources under the chroot's base distro 'Felix Moessbauer' via isar-users
2026-10-21 10:25 ` [PATCH 3/3] bootstrap: point cached deb-src at the bootstrapped " 'Felix Moessbauer' via isar-users
2026-11-06 9:59 ` [PATCH 0/3] Fixes for BASE_DISTRO 'Moessbauer, Felix' via isar-users
2026-11-06 16:00 ` 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=20261021102544.3614772-2-felix.moessbauer@siemens.com \
--to=isar-users@googlegroups.com \
--cc=felix.moessbauer@siemens.com \
--cc=wzh@ilbers.de \
/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