Skip to contentSkip to conversation

image.bbclass: uninstall package only if it's already installed

PATCH New [email protected] 1 participant 2 messages Sep 22, 2013

lore
Share & tools
lore
#0 lore raw

cover image.bbclass: uninstall package only if it's already installed

From: Chen Qi <[email protected]>

The following changes since commit 1181e691197ab223e325546185d0a991e5ccbf1c:

bitbake: build: Add logfile to add TaskBase events (2013-09-16 13:12:34 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/uninstall-if-installed
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/uninstall-if-installed

Chen Qi (1):
image.bbclass: uninstall package only if it's already installed

 meta/classes/image.bbclass |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 image.bbclass: uninstall package only if it's already installed

From: Chen Qi <[email protected]>

Remove a package from rootfs only if it's already installed. Also, if a package is uninstalled, remove it from installed_pkgs.txt.

[YOCTO #5169]

---
 meta/classes/image.bbclass |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/image.bbclass +11 -1
index 889547a..b4be509 100644
@@ -510,7 +510,17 @@ rootfs_uninstall_unneeded () {
 			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
 				remove_run_postinsts=true
 			fi
-			rootfs_uninstall_packages update-rc.d base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}
+
+			# 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
 
 			# Need to remove rc.d files for run-postinsts by hand since opkg won't
 			# call postrm scripts in offline root mode.
Signature · 1 line
1.7.9.5