diff options
-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 | |||
484 | echo "SDKSIZE = $sdksize" >> ${BUILDHISTORY_DIR_SDK}/sdk-info.txt | 484 | echo "SDKSIZE = $sdksize" >> ${BUILDHISTORY_DIR_SDK}/sdk-info.txt |
485 | } | 485 | } |
486 | 486 | ||
487 | # By prepending we get in before the removal of packaging files | 487 | # By using ROOTFS_POSTUNINSTALL_COMMAND we get in after uninstallation of |
488 | ROOTFS_POSTPROCESS_COMMAND =+ " buildhistory_list_installed_image ;\ | 488 | # unneeded packages but before the removal of packaging files |
489 | ROOTFS_POSTUNINSTALL_COMMAND += " buildhistory_list_installed_image ;\ | ||
489 | buildhistory_get_image_installed ; " | 490 | buildhistory_get_image_installed ; " |
490 | 491 | ||
491 | IMAGE_POSTPROCESS_COMMAND += " buildhistory_get_imageinfo ; " | 492 | 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 | |||
167 | ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}' | 167 | ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}' |
168 | # Write manifest | 168 | # Write manifest |
169 | IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest" | 169 | IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest" |
170 | ROOTFS_POSTPROCESS_COMMAND =+ "write_image_manifest ; " | 170 | ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; " |
171 | # Set default postinst log file | 171 | # Set default postinst log file |
172 | POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log" | 172 | POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log" |
173 | # Set default target for systemd images | 173 | # 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): | |||
137 | self.d.getVar('IMAGE_ROOTFS', True), | 137 | self.d.getVar('IMAGE_ROOTFS', True), |
138 | "run-postinsts", "remove"]) | 138 | "run-postinsts", "remove"]) |
139 | 139 | ||
140 | # Remove unneeded package-management related components | 140 | runtime_pkgmanage = bb.utils.contains("IMAGE_FEATURES", "package-management", |
141 | if bb.utils.contains("IMAGE_FEATURES", "package-management", | 141 | True, False, self.d) |
142 | True, False, self.d): | 142 | if not runtime_pkgmanage: |
143 | return | 143 | # Remove components that we don't need if we're not going to install |
144 | # additional packages at runtime | ||
145 | if delayed_postinsts is None: | ||
146 | installed_pkgs_dir = self.d.expand('${WORKDIR}/installed_pkgs.txt') | ||
147 | pkgs_to_remove = list() | ||
148 | with open(installed_pkgs_dir, "r+") as installed_pkgs: | ||
149 | pkgs_installed = installed_pkgs.read().split('\n') | ||
150 | for pkg_installed in pkgs_installed[:]: | ||
151 | pkg = pkg_installed.split()[0] | ||
152 | if pkg in ["update-rc.d", | ||
153 | "base-passwd", | ||
154 | self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True) | ||
155 | ]: | ||
156 | pkgs_to_remove.append(pkg) | ||
157 | pkgs_installed.remove(pkg_installed) | ||
158 | |||
159 | if len(pkgs_to_remove) > 0: | ||
160 | self.pm.remove(pkgs_to_remove, False) | ||
161 | # Update installed_pkgs.txt | ||
162 | open(installed_pkgs_dir, "w+").write('\n'.join(pkgs_installed)) | ||
144 | 163 | ||
145 | if delayed_postinsts is None: | 164 | else: |
146 | installed_pkgs_dir = self.d.expand('${WORKDIR}/installed_pkgs.txt') | 165 | self._save_postinsts() |
147 | pkgs_to_remove = list() | ||
148 | with open(installed_pkgs_dir, "r+") as installed_pkgs: | ||
149 | pkgs_installed = installed_pkgs.read().split('\n') | ||
150 | for pkg_installed in pkgs_installed[:]: | ||
151 | pkg = pkg_installed.split()[0] | ||
152 | if pkg in ["update-rc.d", | ||
153 | "base-passwd", | ||
154 | self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True) | ||
155 | ]: | ||
156 | pkgs_to_remove.append(pkg) | ||
157 | pkgs_installed.remove(pkg_installed) | ||
158 | |||
159 | if len(pkgs_to_remove) > 0: | ||
160 | self.pm.remove(pkgs_to_remove, False) | ||
161 | # Update installed_pkgs.txt | ||
162 | open(installed_pkgs_dir, "w+").write('\n'.join(pkgs_installed)) | ||
163 | 166 | ||
164 | else: | 167 | post_uninstall_cmds = self.d.getVar("ROOTFS_POSTUNINSTALL_COMMAND", True) |
165 | self._save_postinsts() | 168 | execute_pre_post_process(self.d, post_uninstall_cmds) |
166 | 169 | ||
167 | self.pm.remove_packaging_data() | 170 | if not runtime_pkgmanage: |
171 | # Remove the package manager data files | ||
172 | self.pm.remove_packaging_data() | ||
168 | 173 | ||
169 | def _run_intercepts(self): | 174 | def _run_intercepts(self): |
170 | intercepts_dir = os.path.join(self.d.getVar('WORKDIR', True), | 175 | intercepts_dir = os.path.join(self.d.getVar('WORKDIR', True), |