[oe-commits] Hongxu Jia : rootfs.py: fix uninstall uneeded pkgs failed
git at git.openembedded.org
git at git.openembedded.org
Tue Feb 11 11:57:01 UTC 2014
Module: openembedded-core.git
Branch: master-next
Commit: 9cdecb3935962653733705ad6313558bfd4fda29
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=9cdecb3935962653733705ad6313558bfd4fda29
Author: Hongxu Jia <hongxu.jia at windriver.com>
Date: Sun Jan 26 18:09:47 2014 +0800
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
...
Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu at intel.com>
---
meta/lib/oe/rootfs.py | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index be9761c..e884e47 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -121,10 +121,23 @@ class Rootfs(object):
delayed_postinsts = self._get_delayed_postinsts()
if delayed_postinsts is None:
- self.pm.remove(["update-rc.d",
- "base-passwd",
- self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True)],
- False)
+ 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 os.path.exists(self.d.expand("${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts")):
self._exec_shell_cmd(["update-rc.d", "-f", "-r",
More information about the Openembedded-commits
mailing list