Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] image.bbclass: uninstall package only if it's already installed
@ 2013-09-22  9:34 Qi.Chen
  2013-09-22  9:34 ` [PATCH 1/1] " Qi.Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Qi.Chen @ 2013-09-22  9:34 UTC (permalink / raw)
  To: openembedded-core

From: Chen Qi <Qi.Chen@windriver.com>

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(-)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] image.bbclass: uninstall package only if it's already installed
  2013-09-22  9:34 [PATCH 0/1] image.bbclass: uninstall package only if it's already installed Qi.Chen
@ 2013-09-22  9:34 ` Qi.Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Qi.Chen @ 2013-09-22  9:34 UTC (permalink / raw)
  To: openembedded-core

From: Chen Qi <Qi.Chen@windriver.com>

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]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/image.bbclass |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 889547a..b4be509 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -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.
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-22  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-22  9:34 [PATCH 0/1] image.bbclass: uninstall package only if it's already installed Qi.Chen
2013-09-22  9:34 ` [PATCH 1/1] " Qi.Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox