[oe-commits] Robert Yang : image_types.bbclass: remove the old images

git at git.openembedded.org git at git.openembedded.org
Mon May 20 23:13:54 UTC 2013


Module: openembedded-core.git
Branch: master-next
Commit: b3e2e405c53d63bc71872d41f455507be833e7eb
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=b3e2e405c53d63bc71872d41f455507be833e7eb

Author: Robert Yang <liezhi.yang at windriver.com>
Date:   Tue May  7 06:09:31 2013 +0000

image_types.bbclass: remove the old images

Remove the old image before the new one generated to save disk
space when RM_OLD_IMAGE is set to 1, this is an easy way to keep
the DEPLOY_DIR_IMAGE clean.

[YOCTO #4391]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/image_types.bbclass     |    6 +++++-
 meta/conf/local.conf.sample.extended |    3 +++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 94837ae..38647cf 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -51,7 +51,11 @@ def get_imagecmds(d):
         types.remove("live")
 
     if d.getVar('IMAGE_LINK_NAME', True):
-        cmds += "\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*"
+        if d.getVar('RM_OLD_IMAGE', True) == "1":
+            # Remove the old image
+            cmds += "\trm -f `find ${DEPLOY_DIR_IMAGE} -maxdepth 1 -type l -name ${IMAGE_LINK_NAME}'.*' -exec readlink -f {} \;`"
+        # Remove the symlink
+        cmds += "\n\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*"
 
     for type in types:
         ccmd = []
diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended
index 1d1a8ec..aad615a 100644
--- a/meta/conf/local.conf.sample.extended
+++ b/meta/conf/local.conf.sample.extended
@@ -207,3 +207,6 @@
 #ARCHIVER_MODE[filter] ?= "no"
 #ARCHIVER_CLASS = "${@'archive-${ARCHIVER_MODE}-source' if ARCHIVER_MODE != 'none' else ''}"
 #INHERIT += "${ARCHIVER_CLASS}"
+
+# Remove the old image before the new one generated to save disk space
+#RM_OLD_IMAGE = "1"



More information about the Openembedded-commits mailing list