[PATCH] Fix cache-deb-src functionality for non-amd64 builds

7 views
Skip to first unread message

Anton Mikanovich

unread,
Jul 17, 2025, 6:52:11 AMJul 17
to isar-...@googlegroups.com, Anton Mikanovich
Commit f0da749f introduced `apt-cache -o Dir=${rootfs} dumpavail`
method to get info about packages installed in rootfs, instead of
parsing dpkg.log previuosly used.

But it does not work in case of foreing architecture used. The list
comes empty and no source packages get downloaded.

Instead, chroot into the rootfs and run this inside. The difference:

Works for the same arch:
apt-cache -o Dir=/build/tmp/work/debian-bookworm-amd64/isar-image-base-qemuamd64/1.0-r0/rootfs dumpavail | wc -l
1190397

Doesn't work for the foreign arch:
apt-cache -o Dir=/build/tmp/work/debian-bookworm-arm64/isar-image-base-qemuarm64/1.0-r0/rootfs/ dumpavail | wc -l
0

After the patch:
sudo chroot /build/tmp/work/debian-bookworm-arm64/isar-image-base-qemuarm64/1.0-r0/rootfs/ apt-cache dumpavail | wc -l
1170789

Signed-off-by: Anton Mikanovich <ami...@ilbers.de>
---
meta/classes/deb-dl-dir.bbclass | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 3f560da4..1f3876db 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -68,7 +68,9 @@ debsrc_download() {
trap "rm -f ${avail} ${wanted}" EXIT

# List all packages known to apt
- apt-cache -o Dir=${rootfs} dumpavail | debsrc_source_version_filter > ${avail}
+ sudo -E chroot --userspec=$( id -u ):$( id -g ) ${rootfs} \
+ apt-cache dumpavail \
+ | debsrc_source_version_filter > ${avail}

# Use apt-ftparchive to scan all .deb files found in the download directory
# and get the <source> <version> pairs that we wish to download
--
2.34.1

cedric.h...@siemens.com

unread,
Jul 22, 2025, 1:27:38 AMJul 22
to ami...@ilbers.de, isar-...@googlegroups.com
On Thu, 2025-07-17 at 13:51 +0300, Anton Mikanovich wrote:
> Commit f0da749f introduced `apt-cache -o Dir=${rootfs} dumpavail`
> method to get info about packages installed in rootfs, instead of
> parsing dpkg.log previuosly used.

previously

>
> But it does not work in case of foreing architecture used. The list

foreign

> comes empty and no source packages get downloaded.
>
> Instead, chroot into the rootfs and run this inside. The difference:

Yes but with a significant performance hit (QEMU)
I can recheck our options. This is a reminder that I had earlier
proposed
https://lists.isar-build.org/isar-users/20250515150727.176498...@siemens.com/T/#t
(probably does not address this specific issue though)
--
Cedric Hombourger
Siemens AG
www.siemens.com

cedric.h...@siemens.com

unread,
Jul 22, 2025, 2:35:49 AMJul 22
to ami...@ilbers.de, isar-...@googlegroups.com
On Tue, 2025-07-22 at 07:27 +0200, Cedric Hombourger wrote:
> On Thu, 2025-07-17 at 13:51 +0300, Anton Mikanovich wrote:
> > Commit f0da749f introduced `apt-cache -o Dir=${rootfs} dumpavail`
> > method to get info about packages installed in rootfs, instead of
> > parsing dpkg.log previuosly used.
>
> previously
>
> >
> > But it does not work in case of foreing architecture used. The list
>
> foreign
>
> > comes empty and no source packages get downloaded.
> >
> > Instead, chroot into the rootfs and run this inside. The
> > difference:
>
> Yes but with a significant performance hit (QEMU)
> I can recheck our options. This is a reminder that I had earlier
> proposed
> https://lists.isar-build.org/isar-users/20250515150727.176498...@siemens.com/T/#t
> (probably does not address this specific issue though)

That issue did ring a bell and I was able to find the fix I had
suggested earlier "specify target architecture for apt-cache lookups"


https://lists.isar-build.org/isar-users/20250417201747.90299...@siemens.com/

MOESSBAUER, Felix

unread,
Jul 22, 2025, 7:02:08 AMJul 22
to ami...@ilbers.de, isar-...@googlegroups.com, cedric.h...@siemens.com
On Tue, 2025-07-22 at 06:35 +0000, 'cedric.h...@siemens.com' via
isar-users wrote:
> On Tue, 2025-07-22 at 07:27 +0200, Cedric Hombourger wrote:
> > On Thu, 2025-07-17 at 13:51 +0300, Anton Mikanovich wrote:
> > > Commit f0da749f introduced `apt-cache -o Dir=${rootfs} dumpavail`
> > > method to get info about packages installed in rootfs, instead of
> > > parsing dpkg.log previuosly used.
> >
> > previously
> >
> > >
> > > But it does not work in case of foreing architecture used. The
> > > list
> >
> > foreign
> >
> > > comes empty and no source packages get downloaded.
> > >
> > > Instead, chroot into the rootfs and run this inside. The
> > > difference:
> >
> > Yes but with a significant performance hit (QEMU)
> > I can recheck our options. This is a reminder that I had earlier
> > proposed
> > https://lists.isar-build.org/isar-users/20250515150727.176498...@siemens.com/T/#t
> > (probably does not address this specific issue though)
>
> That issue did ring a bell and I was able to find the fix I had
> suggested earlier "specify target architecture for apt-cache lookups"
>
>
> https://lists.isar-build.org/isar-users/20250417201747.90299...@siemens.com/

If that works here as well, it would be WAY better than falling back to
a changeroot.

Felix

>
>
> --
> Cedric Hombourger
> Siemens AG
> www.siemens.com

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

Anton Mikanovich

unread,
Jul 22, 2025, 7:44:23 AMJul 22
to cedric.h...@siemens.com, isar-...@googlegroups.com, Felix Moessbauer
22/07/2025 09:35, cedric.h...@siemens.com wrote:
> That issue did ring a bell and I was able to find the fix I had
> suggested earlier "specify target architecture for apt-cache lookups"
>
>
> https://lists.isar-build.org/isar-users/20250417201747.90299...@siemens.com/
>
Thanks. We will check the original issue with this patch, but probably
PACKAGE_ARCH should be used instead, to properly download sources for
:compat
packages.
Reply all
Reply to author
Forward
0 new messages