[v8,11/14] rootfs: Fix URL parsing

Message ID 20260727112812.2255297-12-akarpovich@ilbers.de
State New
Headers show
Series Improving base-apt usage | expand

Commit Message

Aliaksei Karpovich July 27, 2026, 11:26 a.m. UTC
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

The apt uses the percent-encoding in URI and print it with
replacing of some symbols (f.e. '+' -> '%2b'). Current
implementation extracts package name from URL and gets it with
percent-encoding which leads to error above.

Format of output is following:
 http://security.ubuntu.com/ubuntu/pool/universe/g/gcc-12/libstdc%2b%2b-12-dev_12.4.0-2ubuntu1%7e24.04.1_amd64.deb' libstdc++-12-dev_12.4.0-2ubuntu1~24.04.1_amd64.deb 2194756 MD5Sum:47b73d6b9f0aa4f0e115b1898ca80455

Fix: use second field (the name itself) instead of URL.
Signed-off-by: Aliaksei Karpovich <akarpovich@ilbers.de>
---
 meta/classes-recipe/rootfs.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Kiszka July 27, 2026, 11:45 a.m. UTC | #1
On 27.07.26 13:26, Aliaksei Karpovich wrote:
> 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
> 
> The apt uses the percent-encoding in URI and print it with
> replacing of some symbols (f.e. '+' -> '%2b'). Current
> implementation extracts package name from URL and gets it with
> percent-encoding which leads to error above.
> 
> Format of output is following:
>  http://security.ubuntu.com/ubuntu/pool/universe/g/gcc-12/libstdc%2b%2b-12-dev_12.4.0-2ubuntu1%7e24.04.1_amd64.deb' libstdc++-12-dev_12.4.0-2ubuntu1~24.04.1_amd64.deb 2194756 MD5Sum:47b73d6b9f0aa4f0e115b1898ca80455
> 
> Fix: use second field (the name itself) instead of URL.
> Signed-off-by: Aliaksei Karpovich <akarpovich@ilbers.de>
> ---
>  meta/classes-recipe/rootfs.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
> index 5a66b4ca..2ffbbca7 100644
> --- a/meta/classes-recipe/rootfs.bbclass
> +++ b/meta/classes-recipe/rootfs.bbclass
> @@ -379,8 +379,8 @@ rootfs_install_pkgs_isar_download() {
>                 --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\" | \
> +               -- /usr/bin/sh -c "apt-get ${ROOTFS_APT_ARGS} --print-uris ${ROOTFS_PACKAGES} |  \
> +                                  sed -n \"s|^[^ ]* \([^_]*\)_[^_]*_[^_]*\\.deb .*|\1|p\" | \
>                                    xargs -r apt-get download"
>  }
>  

Is this a fix for an issue that is independent of this series? Then move
it to the front, possibly even outside of the series.

Or is the fix only relevant with the changes coming after this? Then
clarify the impact, when the issue can hit and when not.

Jan

Patch

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 5a66b4ca..2ffbbca7 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -379,8 +379,8 @@  rootfs_install_pkgs_isar_download() {
                --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\" | \
+               -- /usr/bin/sh -c "apt-get ${ROOTFS_APT_ARGS} --print-uris ${ROOTFS_PACKAGES} |  \
+                                  sed -n \"s|^[^ ]* \([^_]*\)_[^_]*_[^_]*\\.deb .*|\1|p\" | \
                                   xargs -r apt-get download"
 }