On 06/03/24 17:57, Richard Purdie wrote:
On Wed, 2024-03-06 at 08:37 -0800, Mauro wrote:
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')
+}
This doesn't look right unfortunately.
Things should not be being placed into the sysroots (STAGING_DIR) that
aren't under the control of sstate. If things are, we need to fix that
at the source of the problem.
Cheers,
Richard
Hi Richard,
thank you.
If I understood correctly, your suggestion is to create the .env file in
WORKDIR instead of in the STAGING_DIR, and use
tmp/deploy/images/<machine>/<image>.env (now copied from STAGING_DIR,
after copied from WORKDIR) when creating the wic file. If this is the
right way, I can try to produce a patch.
Thanks. regards
--
Mauro
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196778):
https://lists.openembedded.org/g/openembedded-core/message/196778
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]]
-=-=-=-=-=-=-=-=-=-=-=-