[PATCH] deb-dl-dir: specify target architecture for apt-cache lookups

18 views
Skip to first unread message

Cedric Hombourger

unread,
Apr 17, 2025, 4:17:59 PM4/17/25
to isar-...@googlegroups.com, Cedric Hombourger, Srinuvasan A
apt-cache needs to be told for which main architecture it should check
when listing packages via "dumpavail": it would otherwise default to its
default architecture (HOST_DISTRO_ARCH when running outside of the target
rootfs vs DISTRO_ARCH when running under chroot). Use "apt-cache -o
APT::Architecture=${DISTRO_ARCH}" for a correct listing of packages known
to apt; this approach is preferred over e.g. "sudo chroot ${rootfs}
apt-cache dumpavail" as we avoid a sudo call and avoid running apt under
qemu (slow) when the host and target architectures are different.

Reported-by: Srinuvasan A <srinuv...@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.h...@siemens.com>
---
meta/classes/deb-dl-dir.bbclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 24b2dec7..e12144ef 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -64,7 +64,8 @@ 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}
+ apt-cache -o APT::Architecture=${DISTRO_ARCH} -o Dir=${rootfs} 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.39.5

Baurzhan Ismagulov

unread,
Aug 7, 2025, 9:12:37 AM8/7/25
to isar-...@googlegroups.com
On 2025-04-17 22:17, 'Cedric Hombourger' via isar-users wrote:
> apt-cache needs to be told for which main architecture it should check
> when listing packages via "dumpavail": it would otherwise default to its
> default architecture (HOST_DISTRO_ARCH when running outside of the target
> rootfs vs DISTRO_ARCH when running under chroot). Use "apt-cache -o
> APT::Architecture=${DISTRO_ARCH}" for a correct listing of packages known
> to apt; this approach is preferred over e.g. "sudo chroot ${rootfs}
> apt-cache dumpavail" as we avoid a sudo call and avoid running apt under
> qemu (slow) when the host and target architectures are different.

Applied to next, thanks.

With kind regards,
Baurzhan
Reply all
Reply to author
Forward
0 new messages