[1/1] rootfs: Use curl instead of apt download

2 views
Skip to first unread message

Aliaksei Karpovich

unread,
Jul 30, 2026, 3:19:20 AM (6 days ago) Jul 30
to isar-...@googlegroups.com, Aliaksei Karpovich
It fixes two issues:

1) Current implementation extracts package name from URL and gets
it along with percent-encoding which leads to following error:
| DEBUG: Executing shell function rootfs_install_pkgs_isar_download
| Starting pkgProblemResolver with broken count: 0
| Starting 2 pkgProblemResolver with broken count: 0
| Done
| E: Unable to locate package libstdc%2b%2b-12-dev
| E: Unable to locate package g%2b%2b-12
| E: Unable to locate package g%2b%2b

To fix it the second field (extracted by sed) will be used as
deb file name.

2) In case of cross compile the arch of package is lost. F.e. the
gcc-14-base_14.2.0-19_arm64.deb will be transformed in
gcc-14-base name and amd64 version will be downloaded instead of
arm64.

With this fix the specified version of deb package will be
downloaded as the URL is used for download.

Signed-off-by: Aliaksei Karpovich <akarp...@ilbers.de>
---
meta/classes-recipe/rootfs.bbclass | 5 +++--
meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 77e6aefc..2a2dead8 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -370,14 +370,15 @@ rootfs_install_pkgs_isar_download() {
# Command apt-get install do not cache packages from local repos
# We can obtain non cached package URIs by recalling install command here
# No need in export those files to dl_dir, so we can run it right after
+ # Sed below extracts URL and name of deb packages for curl to download.
rootfs_cmd --bind "${ROOTFSDIR}/var/cache/apt/archives" /var/cache/apt/archives \
--bind "${WORKDIR}/dpkg/lock" /var/lib/dpkg/lock \
--bind "${WORKDIR}/dpkg/lock-frontend" /var/lib/dpkg/lock-frontend \
--chdir "/var/cache/apt/archives" \
${ROOTFSDIR} \
-- /usr/bin/sh -c "apt-get ${ROOTFS_APT_ARGS} --print-uris ${ROOTFS_PACKAGES} | \
- sed -n \"s|^.*/\\(.*\\)_[^_]*_[^_]*\\.deb'.*|\\1|p\" | \
- xargs -r apt-get download"
+ sed -En \"s/^'([^']+\.deb)' ([^ ]+).*/\1 -o \2/p\" | \
+ xargs -r -L1 curl"
}

ROOTFS_INSTALL_COMMAND += "${@ 'rootfs_install_clean_files' if (d.getVar('ROOTFS_CLEAN_FILES') or '').strip() else ''}"
diff --git a/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc b/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc
index 994da174..a8afb0a6 100644
--- a/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc
+++ b/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc
@@ -9,7 +9,7 @@ inherit bootstrap
inherit compat
inherit deb-dl-dir

-DISTRO_BOOTSTRAP_BASE_PACKAGES += "locales apt"
+DISTRO_BOOTSTRAP_BASE_PACKAGES += "locales apt curl"
DISTRO_BOOTSTRAP_BASE_PACKAGES:append:https-support = " ca-certificates"

BOOTSTRAP_TMPDIR = "${WORKDIR}/tempdir"
--
2.43.0

MOESSBAUER, Felix

unread,
Jul 30, 2026, 3:39:58 AM (6 days ago) Jul 30
to Aliaksei Karpovich, isar-...@googlegroups.com

While implementing my patch, I noticed this dependency as well. I now
have a simpler solution which just uses cp. Once it passes the fast CI,
I'll send it.

Felix

>  DISTRO_BOOTSTRAP_BASE_PACKAGES:append:https-support = " ca-certificates"
>  
>  BOOTSTRAP_TMPDIR = "${WORKDIR}/tempdir"
> --
> 2.43.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+...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260730071848.2521390-1-akarpovich%40ilbers.de.

Reply all
Reply to author
Forward
0 new messages