summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/rootfs.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-rw-r--r--meta/lib/oe/rootfs.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 71bd1a78dc..754ef563ab 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -261,15 +261,22 @@ class Rootfs(object, metaclass=ABCMeta):
261 # Remove components that we don't need if it's a read-only rootfs 261 # Remove components that we don't need if it's a read-only rootfs
262 unneeded_pkgs = self.d.getVar("ROOTFS_RO_UNNEEDED").split() 262 unneeded_pkgs = self.d.getVar("ROOTFS_RO_UNNEEDED").split()
263 pkgs_installed = image_list_installed_packages(self.d) 263 pkgs_installed = image_list_installed_packages(self.d)
264 # Make sure update-alternatives is last on the command line, so 264 # Make sure update-alternatives is removed last. This is
265 # that it is removed last. This makes sure that its database is 265 # because its database has to available while uninstalling
266 # available while uninstalling packages, allowing alternative 266 # other packages, allowing alternative symlinks of packages
267 # symlinks of packages to be uninstalled to be managed correctly. 267 # to be uninstalled or to be managed correctly otherwise.
268 provider = self.d.getVar("VIRTUAL-RUNTIME_update-alternatives") 268 provider = self.d.getVar("VIRTUAL-RUNTIME_update-alternatives")
269 pkgs_to_remove = sorted([pkg for pkg in pkgs_installed if pkg in unneeded_pkgs], key=lambda x: x == provider) 269 pkgs_to_remove = sorted([pkg for pkg in pkgs_installed if pkg in unneeded_pkgs], key=lambda x: x == provider)
270 270
271 # update-alternatives provider is removed in its own remove()
272 # call because all package managers do not guarantee the packages
273 # are removed in the order they given in the list (which is
274 # passed to the command line). The sorting done earlier is
275 # utilized to implement the 2-stage removal.
276 if len(pkgs_to_remove) > 1:
277 self.pm.remove(pkgs_to_remove[:-1], False)
271 if len(pkgs_to_remove) > 0: 278 if len(pkgs_to_remove) > 0:
272 self.pm.remove(pkgs_to_remove, False) 279 self.pm.remove([pkgs_to_remove[-1]], False)
273 280
274 if delayed_postinsts: 281 if delayed_postinsts:
275 self._save_postinsts() 282 self._save_postinsts()