diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2014-01-26 18:09:47 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-11 11:53:41 +0000 |
commit | a49d9f8fc55e74491a34cf7f64d8d43cfc420c77 (patch) | |
tree | 5980eba1b79e000667ced94cba5ab9fdc9bc7f2c /meta | |
parent | 9efc87a056fcb433b307d6228c763dd13a709b35 (diff) | |
download | poky-a49d9f8fc55e74491a34cf7f64d8d43cfc420c77.tar.gz |
rootfs.py: fix uninstall uneeded pkgs failed
The refactor of shell function rootfs_uninstall_unneeded is incorrect,
it should check and update the installed_pkgs.txt file for the existance
of the packages that were removed.
...
rootfs_uninstall_unneeded () {
if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
if [ -z "$(delayed_postinsts)" ]; then
# All packages were successfully configured.
# update-rc.d, base-passwd, run-postinsts are no further
# use, remove them now
remove_run_postinsts=false
if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
remove_run_postinsts=true
fi
# Remove package only if it's installed
pkgs_to_remove="update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
for pkg in $pkgs_to_remove; do
# regexp for pkg, to be used in grep and sed
pkg_regexp="^`echo $pkg | sed 's/\./\\\./'` "
if grep -q "$pkg_regexp" ${WORKDIR}/installed_pkgs.txt; then
rootfs_uninstall_packages $pkg
sed -i "/$pkg_regexp/d" ${WORKDIR}/installed_pkgs.txt
fi
done
...
(From OE-Core rev: 9cdecb3935962653733705ad6313558bfd4fda29)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/rootfs.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index be9761c0d9..e884e47733 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -121,10 +121,23 @@ class Rootfs(object): | |||
121 | 121 | ||
122 | delayed_postinsts = self._get_delayed_postinsts() | 122 | delayed_postinsts = self._get_delayed_postinsts() |
123 | if delayed_postinsts is None: | 123 | if delayed_postinsts is None: |
124 | self.pm.remove(["update-rc.d", | 124 | installed_pkgs_dir = self.d.expand('${WORKDIR}/installed_pkgs.txt') |
125 | "base-passwd", | 125 | pkgs_to_remove = list() |
126 | self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True)], | 126 | with open(installed_pkgs_dir, "r+") as installed_pkgs: |
127 | False) | 127 | pkgs_installed = installed_pkgs.read().split('\n') |
128 | for pkg_installed in pkgs_installed[:]: | ||
129 | pkg = pkg_installed.split()[0] | ||
130 | if pkg in ["update-rc.d", | ||
131 | "base-passwd", | ||
132 | self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True) | ||
133 | ]: | ||
134 | pkgs_to_remove.append(pkg) | ||
135 | pkgs_installed.remove(pkg_installed) | ||
136 | |||
137 | if len(pkgs_to_remove) > 0: | ||
138 | self.pm.remove(pkgs_to_remove, False) | ||
139 | # Update installed_pkgs.txt | ||
140 | open(installed_pkgs_dir, "w+").write('\n'.join(pkgs_installed)) | ||
128 | 141 | ||
129 | if os.path.exists(self.d.expand("${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts")): | 142 | if os.path.exists(self.d.expand("${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts")): |
130 | self._exec_shell_cmd(["update-rc.d", "-f", "-r", | 143 | self._exec_shell_cmd(["update-rc.d", "-f", "-r", |