[2/3] apt-fetcher: cache sources under the chroot's base distro

Message ID 20261021102544.3614772-3-felix.moessbauer@siemens.com
State New
Headers show
Series Fixes for BASE_DISTRO | expand

Commit Message

Felix Moessbauer Oct. 21, 2026, 10:25 a.m. UTC
The apt source fetcher derives the DEBSRCDIR sub-directory from
BASE_DISTRO, which is resolved against OVERRIDES and therefore describes
the recipe's PACKAGE_ARCH rather than the chroot the sources are fetched
in. On raspios, where BASE_DISTRO:arm64 is "raspios64", a native recipe
in mc:rpi-arm64-v8-bookworm caches its .dsc below raspios-bookworm while
base-apt only imports raspios64-bookworm and debian-bookworm for that
multiconfig. The sources are then missing from the cached base
repository and the offline rebuild of the repro test fails in do_unpack.

Use SCHROOT_BASE_DISTRO, which names the base distro of SBUILD_CHROOT.
For native and cross-built recipes this is HOST_BASE_DISTRO, matching
populate_base_apt() in base-apt.bb and deb_dl_dir_import() in
dpkg.bbclass.

Fixes: 37cb017a ("Convert apt source fetcher into native bitbake ...")
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/lib/aptsrc_fetcher.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/lib/aptsrc_fetcher.py b/meta/lib/aptsrc_fetcher.py
index fe8f1cd3..fc3cf363 100644
--- a/meta/lib/aptsrc_fetcher.py
+++ b/meta/lib/aptsrc_fetcher.py
@@ -23,7 +23,9 @@  class AptSrc(FetchMethod):
         ud.src_package = ud.url[len('apt://'):]
         ud.host = ud.host.replace('=', '_')
 
-        base_distro = d.getVar('BASE_DISTRO')
+        # The sources are fetched from inside SBUILD_CHROOT, so they have to be
+        # cached below the base distro of that chroot, not below BASE_DISTRO.
+        base_distro = d.getVar('SCHROOT_BASE_DISTRO')
         codename = d.getVar('BASE_DISTRO_CODENAME')
         ud.localfile='deb-src/' + base_distro + '-' + codename + '/' + ud.host