* [PATCH] image_types_wic.bbclass: remove .env file in do_clean
@ 2024-03-06 16:36 Mauro Salvini
2024-03-06 16:57 ` [OE-core] " Richard Purdie
0 siblings, 1 reply; 4+ messages in thread
From: Mauro Salvini @ 2024-03-06 16:36 UTC (permalink / raw
To: openembedded-core; +Cc: Mauro Salvini
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 <m.salvini@koansoftware.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] image_types_wic.bbclass: remove .env file in do_clean
2024-03-06 16:36 [PATCH] image_types_wic.bbclass: remove .env file in do_clean Mauro Salvini
@ 2024-03-06 16:57 ` Richard Purdie
2024-03-07 8:21 ` Mauro Salvini
2024-03-11 14:58 ` Mauro Salvini
0 siblings, 2 replies; 4+ messages in thread
From: Richard Purdie @ 2024-03-06 16:57 UTC (permalink / raw
To: Mauro, openembedded-core
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 <m.salvini@koansoftware.com>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] image_types_wic.bbclass: remove .env file in do_clean
2024-03-06 16:57 ` [OE-core] " Richard Purdie
@ 2024-03-07 8:21 ` Mauro Salvini
2024-03-11 14:58 ` Mauro Salvini
1 sibling, 0 replies; 4+ messages in thread
From: Mauro Salvini @ 2024-03-07 8:21 UTC (permalink / raw
To: openembedded-core
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 <m.salvini@koansoftware.com>
>> ---
>> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH] image_types_wic.bbclass: remove .env file in do_clean
2024-03-06 16:57 ` [OE-core] " Richard Purdie
2024-03-07 8:21 ` Mauro Salvini
@ 2024-03-11 14:58 ` Mauro Salvini
1 sibling, 0 replies; 4+ messages in thread
From: Mauro Salvini @ 2024-03-11 14:58 UTC (permalink / raw
To: Richard Purdie; +Cc: openembedded-core
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 <m.salvini@koansoftware.com>
>> ---
>> 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.
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
--
Mauro
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-11 14:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-06 16:36 [PATCH] image_types_wic.bbclass: remove .env file in do_clean Mauro Salvini
2024-03-06 16:57 ` [OE-core] " Richard Purdie
2024-03-07 8:21 ` Mauro Salvini
2024-03-11 14:58 ` Mauro Salvini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.