image_types_wic.bbclass: remove .env file in do_clean
PATCH 1/1 image_types_wic.bbclass: remove .env file in do_clean
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"
--- meta/classes-recipe/image_types_wic.bbclass | 11 +++++++++++ 1 file changed, 11 insertions(+)
meta/classes-recipe/image_types_wic.bbclass +11 -0
@@ -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') +}
Signature · 1 line
2.34.1
Quoted 30 lines · Mauro
Before this commit, the .env file created in tmp/sysroots/<machine>/imgdata/<image>.env was never cleaned, but when the
do_cleantask 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(+)meta/classes-recipe/image_types_wic.bbclass +0
-0@@ -205,3 +205,14 @@ addtask do_flush_pseudodb after do_rootfs before
do_imagedo_image_qa
addtaskdo_rootfs_wicenvafterdo_imagebeforedo_image_wicdo_rootfs_wicenv[vardeps] += "${WICVARS}" do_rootfs_wicenv[prefuncs] = 'set_image_size'meta/classes-recipe/image_types_wic.bbclass +3
-0+ +# +# Clean also .env file created intmp/sysroots/<machine>/imgdata/<image>.env
meta/classes-recipe/image_types_wic.bbclass addtask do_flush_pseudodb after do_rootfs before do_image do_image_qa · line 218
Quoted 8 lines
meta/classes-recipe/image_types_wic.bbclass +8
-0+# 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
Quoted 42 lines · Richard Purdie
Quoted 30 lines · Mauro
Before this commit, the .env file created in tmp/sysroots/<machine>/imgdata/<image>.env was never cleaned, but when the
do_cleantask 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(+)meta/classes-recipe/image_types_wic.bbclass +0
-0@@ -205,3 +205,14 @@ addtask do_flush_pseudodb after do_rootfs before
do_imagedo_image_qa
addtaskdo_rootfs_wicenvafterdo_imagebeforedo_image_wicdo_rootfs_wicenv[vardeps] += "${WICVARS}" do_rootfs_wicenv[prefuncs] = 'set_image_size'meta/classes-recipe/image_types_wic.bbclass +3
-0+ +# +# Clean also .env file created intmp/sysroots/<machine>/imgdata/<image>.env
meta/classes-recipe/image_types_wic.bbclass addtask do_flush_pseudodb after do_rootfs before do_image do_image_qa · line 218
Quoted 8 lines
meta/classes-recipe/image_types_wic.bbclass +8
-0+# 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.
Quoted 8 lines
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
Signature · 1 line
Mauro
Quoted 42 lines · Richard Purdie
Quoted 30 lines · Mauro
Before this commit, the .env file created in tmp/sysroots/<machine>/imgdata/<image>.env was never cleaned, but when the
do_cleantask 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(+)meta/classes-recipe/image_types_wic.bbclass +0
-0@@ -205,3 +205,14 @@ addtask do_flush_pseudodb after do_rootfs before
do_imagedo_image_qa
addtaskdo_rootfs_wicenvafterdo_imagebeforedo_image_wicdo_rootfs_wicenv[vardeps] += "${WICVARS}" do_rootfs_wicenv[prefuncs] = 'set_image_size'meta/classes-recipe/image_types_wic.bbclass +3
-0+ +# +# Clean also .env file created intmp/sysroots/<machine>/imgdata/<image>.env
meta/classes-recipe/image_types_wic.bbclass addtask do_flush_pseudodb after do_rootfs before do_image do_image_qa · line 218
Quoted 8 lines
meta/classes-recipe/image_types_wic.bbclass +8
-0+# 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.
Quoted 9 lines
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.
What would be the correct directory where to put the .env files?
I don't know much about Yocto internals, but I can try do arrange a patch to solve the problem at the source.
Thanks, regards
Signature · 1 line
Mauro