public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/1] remove all newly installed packages after localepurge
@ 2026-03-23  9:45 'Felix Moessbauer' via isar-users
  2026-03-23 11:09 ` 'Jan Kiszka' via isar-users
  2026-03-26 13:05 ` Zhihang Wei
  0 siblings, 2 replies; 3+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-03-23  9:45 UTC (permalink / raw)
  To: isar-users; +Cc: christoph.steiger, Felix Moessbauer

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.moessbauer@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

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260323094521.682576-1-felix.moessbauer%40siemens.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-26 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-23  9:45 [PATCH 1/1] remove all newly installed packages after localepurge 'Felix Moessbauer' via isar-users
2026-03-23 11:09 ` 'Jan Kiszka' via isar-users
2026-03-26 13:05 ` Zhihang Wei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox