summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-01-26 14:40:40 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-03 14:53:50 +0000
commit26e5b0f7b9a52d6eed7d46c003c45b202acabebc (patch)
tree785f72a27f005e3cd56dd7b4cf628bf09b7c1ad0 /meta/lib
parent69c588b66d5d44ed97e21826ff2501c76e5b4ea8 (diff)
downloadpoky-26e5b0f7b9a52d6eed7d46c003c45b202acabebc.tar.gz
classes/image: ensure uninstalled packages do not appear in manifests
Since the rewrite of the image construction code in python a few releases ago, we remove a couple of packages from the image as one of the final steps when constructing the image (notably update-rc.d and run-postinsts). However, because of the order of operations, these packages are still listed both in the buildhistory installed_package*.txt files and in the manifest file created next to the image, which is wrong. There were two possible solutions to this: (1) change the order such that the uninstallation occurs before calling ROOTFS_POSTPROCESS_COMMAND or (2) add another hook variable in such that we can have the package list collection code run at the right time. Because it's currently possible (but very much not recommended) to install additional packages within ROOTFS_POSTPROCESS_COMMAND, which may have postinstall scripts and thus require the packages we would otherwise uninstall if we were to take option 1, option 2 is really the least likely to cause problems. Therefore, add ROOTFS_POSTUNINSTALL_COMMAND and make the image and buildhistory classes use it. Fixes [YOCTO #6479]. (From OE-Core rev: b198a189228648057c3be7d068598f50841b3bf9) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/rootfs.py55
1 files changed, 30 insertions, 25 deletions
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),