]> code.ossystems Code Review - openembedded-core.git/commitdiff
image_types.bbclass: remove the old images
authorRobert Yang <liezhi.yang@windriver.com>
Tue, 7 May 2013 06:09:31 +0000 (06:09 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 20 May 2013 23:12:21 +0000 (00:12 +0100)
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@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/image_types.bbclass
meta/conf/local.conf.sample.extended

index 94837ae0a85d0415d51af093fe61822d044b5d50..38647cfbc7e2a83b31ed942f9deed4222f4c4936 100644 (file)
@@ -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 = []
index 1d1a8ece40d8892aa3bb2b714c8eaa82f1a079e5..aad615a4b74197eca7f6f77d9637da957231f327 100644 (file)
 #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"