To perform the localepurge, we install the localepurge package, run the
command and then remove it again from the rootfs. In case the set of
newly installed packages intersects with the set of suggested packages
from all previously installed packages, the intersection is not removed
on autopurge (as apt internally does not track why a package was
installed). However, we want these packages to be removed, as we never
intended to install them in the first place (except for the localepurge
operation).
We fix this by tracking which new packages will be installed when
installing localepurge and then remove exactly these.
One example package that is affected in the base image is "perl".
Signed-off-by: Felix Moessbauer <
felix.mo...@siemens.com>
---
meta/classes-recipe/image-locales-extension.bbclass | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meta/classes-recipe/image-locales-extension.bbclass b/meta/classes-recipe/image-locales-extension.bbclass
index b6b07dba..45dcdb67 100644
--- a/meta/classes-recipe/image-locales-extension.bbclass
+++ b/meta/classes-recipe/image-locales-extension.bbclass
@@ -69,6 +69,9 @@ __EOF__
else
localepurge_state='p'
echo 'localepurge was not installed (removing it later)'
+ # track additional packages that will be installed, as these packages might be
+ # in the suggested set of other packages and by that need to be explicitly removed
+ localepurge_pkgs=$(chroot '${ROOTFSDIR}' apt-get ${ROOTFS_APT_ARGS} -s localepurge 2>&1 | sed -n 's/^Inst \([^ ]*\) .*/\1/p')
chroot '${ROOTFSDIR}' apt-get ${ROOTFS_APT_ARGS} localepurge
fi
@@ -105,7 +108,7 @@ EOSH
if [ "$localepurge_state" = 'p' ]
then
echo removing localepurge...
- chroot '${ROOTFSDIR}' apt-get autopurge --yes localepurge
+ chroot '${ROOTFSDIR}' apt-get purge --yes $localepurge_pkgs
fi
EOSUDO
}
--
2.53.0