Message ID | 20250417201747.90299-1-cedric.hombourger@siemens.com |
---|---|
State | Accepted, archived |
Headers | show |
Series | deb-dl-dir: specify target architecture for apt-cache lookups | expand |
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
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
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 <srinuvasan.a@siemens.com> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com> --- meta/classes/deb-dl-dir.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)