[oe-commits] [openembedded-core] 22/42: wic: Preserve intermediate files

git at git.openembedded.org git at git.openembedded.org
Wed Jan 8 21:24:14 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 13fdd0a4e1fe0a79849be13195325442b6bea16f
Author: Paul Barker <pbarker at konsulko.com>
AuthorDate: Wed Jan 8 11:25:45 2020 +0000

    wic: Preserve intermediate files
    
    When debugging issues or trying to add new features in wic it's useful
    to examine the intermediate files created by the tool such as images of
    the individual partitions. Previously these files were created in a
    subdirectory of IMGDEPLOYDIR and, deleted by wic itself and then the
    working subdirectory completely removed at the end of IMAGE_CMD_wic.
    Instead we should work in a staging directory named build-wic and leave
    behind intermediate files for analysis if necessary.
    
    This has the added benefit of allowing individual partition images to
    be preserved by adding commands to IMAGE_CMD_wic_append() in an image
    recipe if needed. This is useful where an update system requires exact
    sized and pre-formatted partition images for deployment.
    
    Signed-off-by: Paul Barker <pbarker at konsulko.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/image_types_wic.bbclass     | 7 ++++---
 scripts/lib/wic/plugins/imager/direct.py | 4 +---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 7d5ebe1..fc9b106 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -27,16 +27,17 @@ WIC_CREATE_EXTRA_ARGS ?= ""
 
 IMAGE_CMD_wic () {
 	out="${IMGDEPLOYDIR}/${IMAGE_NAME}"
+	build_wic="${WORKDIR}/build-wic"
 	wks="${WKS_FULL_PATH}"
 	if [ -z "$wks" ]; then
 		bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
 	fi
 
-	BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS}
-	mv "$out/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
-	rm -rf "$out/"
+	BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
+	mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
 }
 IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
+do_image_wic[cleandirs] = "${WORKDIR}/build-wic"
 
 # Rebuild when the wks file or vars in WICVARS change
 USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 2441cc3..c50645f 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -580,9 +580,7 @@ class PartitionedImage():
                                 self.native_sysroot)
 
     def cleanup(self):
-        # remove partition images
-        for image in set(self.partimages):
-            os.remove(image)
+        pass
 
     def assemble(self):
         logger.debug("Installing partitions")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list