[RFC 1/1] speedup localepurge task by emulating less

3 views
Skip to first unread message

Felix Moessbauer

unread,
Aug 21, 2025, 10:45:51 AMAug 21
to isar-...@googlegroups.com, jan.k...@siemens.com, cedric.h...@siemens.com, Felix Moessbauer
The download and dpkg status tasks do not need to be emulated, as these
properly support running without a chroot and for a foreign architecture.

The install task itself does support running without a chroot, however
not for a foreign architecture. By that, we keep the emulation of the
install task for now.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
meta/classes/image-locales-extension.bbclass | 8 +++++---
meta/classes/rootfs.bbclass | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image-locales-extension.bbclass b/meta/classes/image-locales-extension.bbclass
index 9149d643..787719cd 100644
--- a/meta/classes/image-locales-extension.bbclass
+++ b/meta/classes/image-locales-extension.bbclass
@@ -29,8 +29,10 @@ ROOTFS_INSTALL_COMMAND_BEFORE_EXPORT += "image_install_localepurge_download"
image_install_localepurge_download[weight] = "40"
image_install_localepurge_download[network] = "${TASK_USE_NETWORK_AND_SUDO}"
image_install_localepurge_download() {
- sudo -E chroot '${ROOTFSDIR}' \
- /usr/bin/apt-get ${ROOTFS_APT_ARGS} --download-only localepurge
+ sudo -E apt-get \
+ ${ROOTFS_APT_ARGS} \
+ ${NO_CHROOT_APT_ARGS} \
+ --download-only localepurge
}

ROOTFS_INSTALL_COMMAND += "image_install_localepurge_install"
@@ -63,7 +65,7 @@ __EOF__
sudo -E -s <<'EOSUDO'
set -e
localepurge_state='i'
- if chroot '${ROOTFSDIR}' dpkg -s localepurge 2>/dev/null >&2
+ if dpkg --root '${ROOTFSDIR}' -s localepurge 2>/dev/null >&2
then
echo 'localepurge was installed (leaving it installed later)'
else
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 4de684a4..1098a100 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -20,6 +20,7 @@ ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
ROOTFS_FEATURES ?= ""

ROOTFS_APT_ARGS="install --yes -o Debug::pkgProblemResolver=yes"
+NO_CHROOT_APT_ARGS ?= "-o APT::Architecture=${DISTRO_ARCH} -o Dir=${ROOTFSDIR}"

ROOTFS_CLEAN_FILES="/etc/hostname /etc/resolv.conf"

--
2.50.1

Jan Kiszka

unread,
Aug 21, 2025, 11:24:49 AMAug 21
to Felix Moessbauer, isar-...@googlegroups.com, cedric.h...@siemens.com
On 21.08.25 16:45, Felix Moessbauer wrote:
> The download and dpkg status tasks do not need to be emulated, as these
> properly support running without a chroot and for a foreign architecture.
>
> The install task itself does support running without a chroot, however
> not for a foreign architecture. By that, we keep the emulation of the
> install task for now.

Can we always parse with older dpkg newer installations? Or does this
silently assume that builder-release == target-release then?

To avoid emulation, I would use the dpkg from the host-chroot instead.

Jan
Siemens AG, Foundational Technologies
Linux Expert Center
Reply all
Reply to author
Forward
0 new messages