diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/buildhistory.bbclass | 5 | ||||
-rw-r--r-- | meta/classes/image.bbclass | 2 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 55 |
3 files changed, 34 insertions, 28 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 2b5f84a87a..90cfe4f954 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -484,8 +484,9 @@ END echo "SDKSIZE = $sdksize" >> ${BUILDHISTORY_DIR_SDK}/sdk-info.txt } -# By prepending we get in before the removal of packaging files -ROOTFS_POSTPROCESS_COMMAND =+ " buildhistory_list_installed_image ;\ +# By using ROOTFS_POSTUNINSTALL_COMMAND we get in after uninstallation of +# unneeded packages but before the removal of packaging files +ROOTFS_POSTUNINSTALL_COMMAND += " buildhistory_list_installed_image ;\ buildhistory_get_image_installed ; " IMAGE_POSTPROCESS_COMMAND += " buildhistory_get_imageinfo ; " diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index d4c98db9ea..f09bfeea27 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -167,7 +167,7 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "debug-twe ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}' # Write manifest IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest" -ROOTFS_POSTPROCESS_COMMAND =+ "write_image_manifest ; " +ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; " # Set default postinst log file POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log" # Set default target for systemd images diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index c554f22fbe..19aef2a1de 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -137,34 +137,39 @@ class Rootfs(object): self.d.getVar('IMAGE_ROOTFS', True), "run-postinsts", "remove"]) - # Remove unneeded package-management related components - if bb.utils.contains("IMAGE_FEATURES", "package-management", - True, False, self.d): - return + runtime_pkgmanage = bb.utils.contains("IMAGE_FEATURES", "package-management", + True, False, self.d) + if not runtime_pkgmanage: + # Remove components that we don't need if we're not going to install + # additional packages at runtime + if delayed_postinsts is None: + installed_pkgs_dir = self.d.expand('${WORKDIR}/installed_pkgs.txt') + pkgs_to_remove = list() + with open(installed_pkgs_dir, "r+") as installed_pkgs: + pkgs_installed = installed_pkgs.read().split('\n') + for pkg_installed in pkgs_installed[:]: + pkg = pkg_installed.split()[0] + if pkg in ["update-rc.d", + "base-passwd", + self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True) + ]: + pkgs_to_remove.append(pkg) + pkgs_installed.remove(pkg_installed) + + if len(pkgs_to_remove) > 0: + self.pm.remove(pkgs_to_remove, False) + # Update installed_pkgs.txt + open(installed_pkgs_dir, "w+").write('\n'.join(pkgs_installed)) - if delayed_postinsts is None: - installed_pkgs_dir = self.d.expand('${WORKDIR}/installed_pkgs.txt') - pkgs_to_remove = list() - with open(installed_pkgs_dir, "r+") as installed_pkgs: - pkgs_installed = installed_pkgs.read().split('\n') - for pkg_installed in pkgs_installed[:]: - pkg = pkg_installed.split()[0] - if pkg in ["update-rc.d", - "base-passwd", - self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True) - ]: - pkgs_to_remove.append(pkg) - pkgs_installed.remove(pkg_installed) - - if len(pkgs_to_remove) > 0: - self.pm.remove(pkgs_to_remove, False) - # Update installed_pkgs.txt - open(installed_pkgs_dir, "w+").write('\n'.join(pkgs_installed)) + else: + self._save_postinsts() - else: - self._save_postinsts() + post_uninstall_cmds = self.d.getVar("ROOTFS_POSTUNINSTALL_COMMAND", True) + execute_pre_post_process(self.d, post_uninstall_cmds) - self.pm.remove_packaging_data() + if not runtime_pkgmanage: + # Remove the package manager data files + self.pm.remove_packaging_data() def _run_intercepts(self): intercepts_dir = os.path.join(self.d.getVar('WORKDIR', True), |