When running apt-get install --print-uris, the first component denotes
the download location, the second one the location under which the file
should be stored on disk. The current approach which assumes both are
identical breaks on these cases, resulting in errors like:
cp: cannot stat
'///base-apt/debian/pool/main/f/file/libmagic-mgc_1%3a5.39-3+deb11u1_amd64.deb':
No such file or directory
We fix this, by properly URL decoding the first part, while copying in
with the name of the second part.
Fixes: b294d592 ("fix(rootfs): copy isar-apt packages instead of ...")
Reported-by: Aliaksei Karpovich <
akarp...@ilbers.de>
Signed-off-by: Felix Moessbauer <
felix.mo...@siemens.com>
---
@Aliaksei: Please give this a try, it should fix the issue you reported.
Do you have a test case in citest.py that reproduces this issue?
Best regards,
Felix
meta/classes-recipe/rootfs.bbclass | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index bdb9ea7a..7a638b91 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -369,8 +369,9 @@ rootfs_install_pkgs_isar_download() {
--chdir "/var/cache/apt/archives" \
${ROOTFSDIR} \
-- /usr/bin/sh -c 'apt-get ${ROOTFS_APT_ARGS} --print-uris ${ROOTFS_PACKAGES} | \
- sed -n "s|^.file:\(/[^'\'']*/\)[^'\'']*\.deb. \([^ ]*\.deb\) .*|\1\2|p" | \
- while read -r path; do cp -n "$path" ./ ; done'
+ sed -n "s|^.file:\(/[^'\'']*\.deb\). \([^ ]*\.deb\).*|\1 \2|p" | \
+ sed ":a; s|^\([^ ]*\)%|\1\\\\x|; ta" | \
+ while read -r path name; do cp -n "$(/usr/bin/printf "%b" "$path")" "$name" ; done'
}
ROOTFS_INSTALL_COMMAND += "${@ 'rootfs_install_clean_files' if (d.getVar('ROOTFS_CLEAN_FILES') or '').strip() else ''}"
--
2.55.0