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

3 views
Skip to first unread message

Felix Moessbauer

unread,
Jul 28, 2026, 4:20:27 AM (8 days ago) Jul 28
to isar-...@googlegroups.com, Felix Moessbauer
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.mo...@siemens.com>
---
meta/classes-recipe/image-tools-extension.bbclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

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 \
--
2.53.0

Felix Moessbauer

unread,
Jul 28, 2026, 4:20:27 AM (8 days ago) Jul 28
to isar-...@googlegroups.com, Felix Moessbauer
In case the build is performed with ISAR_USE_CACHED_BASE_REPO, we need
to mount the base-apt in the imager_run as well. Otherwise, tooling that
is only needed during imaging is not cached and by that is not available
on the next offline 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.mo...@siemens.com>
---
.../classes-recipe/image-tools-extension.bbclass | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/meta/classes-recipe/image-tools-extension.bbclass b/meta/classes-recipe/image-tools-extension.bbclass
index c75025ca..313c81aa 100644
--- a/meta/classes-recipe/image-tools-extension.bbclass
+++ b/meta/classes-recipe/image-tools-extension.bbclass
@@ -19,6 +19,16 @@ SCHROOT_MOUNTS += "${REPO_ISAR_DIR}/${DISTRO}:/isar-apt"
# only used on unshare
ROOTFS_IMAGETOOLS ?= "${WORKDIR}/rootfs-imgtools-${BB_CURRENTTASK}"

+# mirror the handling of ROOTFS_MOUNTS in rootfs.bbclass, only used on unshare
+IMAGER_UNSHARE_MOUNTS ?= "${SCHROOT_MOUNTS}"
+
+python () {
+ if bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')) \
+ and ':/base-apt' not in d.getVar('IMAGER_UNSHARE_MOUNTS', False):
+ d.appendVar('IMAGER_UNSHARE_MOUNTS',
+ ' {}:/base-apt'.format(d.getVar('REPO_BASE_DIR')))
+}
+
imager_run() {
imager_run_${ISAR_CHROOT_MODE} "$@"
}
@@ -162,7 +172,7 @@ EOF
${SCRIPTSDIR}/lockrun.py -r -f "${REPO_ISAR_DIR}/isar.lock" -s <<'EOAPT'
local_install=$local_install ${@run_privileged_cmd(d)} /bin/bash -s <<'EOF'
set -e
- ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('SCHROOT_MOUNTS'))}
+ ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('IMAGER_UNSHARE_MOUNTS'))}
chroot ${ROOTFS_IMAGETOOLS} apt-get update \
-o Dir::Etc::SourceList='sources.list.d/isar-apt.list' \
-o Dir::Etc::SourceParts='-' \
@@ -176,7 +186,7 @@ EOAPT
deb_dl_dir_export ${ROOTFS_IMAGETOOLS} ${distro}
local_install=$local_install run_privileged_heredoc <<'EOF'
set -e
- ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('SCHROOT_MOUNTS'))}
+ ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('IMAGER_UNSHARE_MOUNTS'))}
chroot ${ROOTFS_IMAGETOOLS} apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
--allow-unauthenticated --allow-downgrades install \
$local_install
@@ -186,7 +196,7 @@ EOF
run_privileged_heredoc <<'EOF' "$@"
set -e
mkdir -p ${ROOTFS_IMAGETOOLS}/${SCRIPTSDIR}
- ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('SCHROOT_MOUNTS'))}
+ ${@insert_isar_mounts(d, d.getVar('ROOTFS_IMAGETOOLS'), d.getVar('IMAGER_UNSHARE_MOUNTS'))}
chroot ${ROOTFS_IMAGETOOLS} "$@" <&3
EOF

--
2.53.0

Zhihang Wei

unread,
Jul 31, 2026, 4:28:25 AM (5 days ago) Jul 31
to Felix Moessbauer, isar-...@googlegroups.com
Applied to next, thanks.

Zhihang
Reply all
Reply to author
Forward
0 new messages