[2/2] fix(imager): correctly expand to-be-installed package list

Message ID 20260728082010.687942-2-felix.moessbauer@siemens.com
State Under Review
Headers show
Series [1/2] fix(imager): mount base-apt on unshare if needed | expand

Commit Message

Felix Moessbauer July 28, 2026, 8:20 a.m. UTC
The local_install variable is a shell variable. By that, it has to be
explicitly passed to the heredocs that expand the variables in the outer
shell. In case of the package pre-caching, this was done on the wrong
level: inside the lockrun heredoc, but without passing it to the lockrun
heredoc. By that, the variable was effectively empty, meaning no
packages have been downloaded and cached.

The later heredoc that does the install then downloaded the packages
(instead of just taking them from the cache), which works but also does
mean the packages were never added to the downloads cache. On subsequent
offline builds, these packages were missing, breaking the build.

This fix is related to the ReproTest with -p rootless=1.

Fixes: 4fedb1ae ("add support for fully rootless builds")
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/image-tools-extension.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes-recipe/image-tools-extension.bbclass b/meta/classes-recipe/image-tools-extension.bbclass
index 313c81aa..8f666444 100644
--- a/meta/classes-recipe/image-tools-extension.bbclass
+++ b/meta/classes-recipe/image-tools-extension.bbclass
@@ -169,8 +169,9 @@  EOF
 
         E="${@ isar_export_proxies(d)}"
         deb_dl_dir_import ${ROOTFS_IMAGETOOLS} ${distro}
+        local_install=$local_install \
         ${SCRIPTSDIR}/lockrun.py -r -f "${REPO_ISAR_DIR}/isar.lock" -s <<'EOAPT'
-        local_install=$local_install ${@run_privileged_cmd(d)} /bin/bash -s <<'EOF'
+        ${@run_privileged_cmd(d)} /bin/bash -s <<'EOF'
             set -e
             ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('IMAGER_UNSHARE_MOUNTS'))}
             chroot ${ROOTFS_IMAGETOOLS} apt-get update \