Before this commit, the .env file created in
tmp/sysroots/<machine>/imgdata/<image>.env was never cleaned,
but when the do_clean task is invoked on an image, the .env file
contains paths that are not valid anymore.
If another image wants to use the cleaned image fs to build a .wic,
the wic command fails because paths contained in .env are not found.
With this patch, the returned error is more clear:

  "File /.../tmp/sysroots/<machine>/imgdata/<image>.env doesn't exist"

Signed-off-by: Mauro Salvini <[email protected]>
---
 meta/classes-recipe/image_types_wic.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/classes-recipe/image_types_wic.bbclass 
b/meta/classes-recipe/image_types_wic.bbclass
index cf3be909b3..b0b5691225 100644
--- a/meta/classes-recipe/image_types_wic.bbclass
+++ b/meta/classes-recipe/image_types_wic.bbclass
@@ -205,3 +205,14 @@ addtask do_flush_pseudodb after do_rootfs before do_image 
do_image_qa
 addtask do_rootfs_wicenv after do_image before do_image_wic
 do_rootfs_wicenv[vardeps] += "${WICVARS}"
 do_rootfs_wicenv[prefuncs] = 'set_image_size'
+
+#
+# Clean also .env file created in tmp/sysroots/<machine>/imgdata/<image>.env
+# when a clean is invoked
+#
+do_clean:append() {
+    stdir = d.getVar('STAGING_DIR')
+    outdir = os.path.join(stdir, d.getVar('MACHINE'), 'imgdata')
+    basename = d.getVar('IMAGE_BASENAME')
+    bb.utils.remove(os.path.join(outdir, basename) + '.env')
+}
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196745): 
https://lists.openembedded.org/g/openembedded-core/message/196745
Mute This Topic: https://lists.openembedded.org/mt/104769309/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to