* [PATCH] sanity: Drop data finalize call
@ 2022-11-11 22:58 Richard Purdie
2022-11-15 15:10 ` [OE-core] " Peter Kjellerstedt
0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2022-11-11 22:58 UTC (permalink / raw)
To: openembedded-core
This call was effectively like update_data and no longer did anything
in bitbake. Drop it as it is obsolete.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes-global/sanity.bbclass | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index 8c7d4d08809..6cb0d6cf882 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -1003,13 +1003,6 @@ def check_sanity(sanity_data):
if status.messages != "":
raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
-# Create a copy of the datastore and finalise it to ensure appends and
-# overrides are set - the datastore has yet to be finalised at ConfigParsed
-def copy_data(e):
- sanity_data = bb.data.createCopy(e.data)
- sanity_data.finalize()
- return sanity_data
-
addhandler config_reparse_eventhandler
config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed"
python config_reparse_eventhandler() {
@@ -1020,13 +1013,13 @@ addhandler check_sanity_eventhandler
check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
python check_sanity_eventhandler() {
if bb.event.getName(e) == "SanityCheck":
- sanity_data = copy_data(e)
+ sanity_data = bb.data.createCopy(e.data)
check_sanity(sanity_data)
if e.generateevents:
sanity_data.setVar("SANITY_USE_EVENTS", "1")
bb.event.fire(bb.event.SanityCheckPassed(), e.data)
elif bb.event.getName(e) == "NetworkTest":
- sanity_data = copy_data(e)
+ sanity_data = bb.data.createCopy(e.data)
if e.generateevents:
sanity_data.setVar("SANITY_USE_EVENTS", "1")
bb.event.fire(bb.event.NetworkTestFailed() if check_connectivity(sanity_data) else bb.event.NetworkTestPassed(), e.data)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [OE-core] [PATCH] sanity: Drop data finalize call
2022-11-11 22:58 [PATCH] sanity: Drop data finalize call Richard Purdie
@ 2022-11-15 15:10 ` Peter Kjellerstedt
2022-11-15 22:16 ` Richard Purdie
0 siblings, 1 reply; 3+ messages in thread
From: Peter Kjellerstedt @ 2022-11-15 15:10 UTC (permalink / raw)
To: Richard Purdie, openembedded-core@lists.openembedded.org
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 11 november 2022 23:58
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH] sanity: Drop data finalize call
>
> This call was effectively like update_data and no longer did anything
> in bitbake. Drop it as it is obsolete.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> meta/classes-global/sanity.bbclass | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
> index 8c7d4d08809..6cb0d6cf882 100644
> --- a/meta/classes-global/sanity.bbclass
> +++ b/meta/classes-global/sanity.bbclass
> @@ -1003,13 +1003,6 @@ def check_sanity(sanity_data):
> if status.messages != "":
> raise_sanity_error(sanity_data.expand(status.messages), sanity_data, status.network_error)
>
> -# Create a copy of the datastore and finalise it to ensure appends and
> -# overrides are set - the datastore has yet to be finalised at ConfigParsed
> -def copy_data(e):
> - sanity_data = bb.data.createCopy(e.data)
> - sanity_data.finalize()
> - return sanity_data
> -
> addhandler config_reparse_eventhandler
> config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed"
> python config_reparse_eventhandler() {
> @@ -1020,13 +1013,13 @@ addhandler check_sanity_eventhandler
> check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck bb.event.NetworkTest"
> python check_sanity_eventhandler() {
> if bb.event.getName(e) == "SanityCheck":
> - sanity_data = copy_data(e)
> + sanity_data = bb.data.createCopy(e.data)
For my understanding, wouldn't it be the same to do:
sanity_data = bb.data.createCopy(d)
I found this in the bitbake documentation, which seems to support my
understanding: A global variable "e" is defined, which represents the
current event. ... The global datastore is available as "d". In legacy
code, you might see "e.data" used to get the datastore. However, realize
that "e.data" is deprecated and you should use "d" going forward.
Further, is there any reason to use bb.data.createCopy(d) instead of
d.createCopy()? AFAICT, the former just calls the latter.
> check_sanity(sanity_data)
> if e.generateevents:
> sanity_data.setVar("SANITY_USE_EVENTS", "1")
> bb.event.fire(bb.event.SanityCheckPassed(), e.data)
> elif bb.event.getName(e) == "NetworkTest":
> - sanity_data = copy_data(e)
> + sanity_data = bb.data.createCopy(e.data)
> if e.generateevents:
> sanity_data.setVar("SANITY_USE_EVENTS", "1")
> bb.event.fire(bb.event.NetworkTestFailed() if check_connectivity(sanity_data) else bb.event.NetworkTestPassed(), e.data)
> --
> 2.34.1
//Peter
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [OE-core] [PATCH] sanity: Drop data finalize call
2022-11-15 15:10 ` [OE-core] " Peter Kjellerstedt
@ 2022-11-15 22:16 ` Richard Purdie
0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2022-11-15 22:16 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core@lists.openembedded.org
On Tue, 2022-11-15 at 15:10 +0000, Peter Kjellerstedt wrote:
> > -----Original Message-----
> > From: openembedded-core@lists.openembedded.org
> > <openembedded-core@lists.openembedded.org> On Behalf Of Richard
> > Purdie
> > Sent: den 11 november 2022 23:58
> > To: openembedded-core@lists.openembedded.org
> > Subject: [OE-core] [PATCH] sanity: Drop data finalize call
> >
> > This call was effectively like update_data and no longer did
> > anything
> > in bitbake. Drop it as it is obsolete.
> >
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> > meta/classes-global/sanity.bbclass | 11 ++---------
> > 1 file changed, 2 insertions(+), 9 deletions(-)
> >
> > diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-
> > global/sanity.bbclass
> > index 8c7d4d08809..6cb0d6cf882 100644
> > --- a/meta/classes-global/sanity.bbclass
> > +++ b/meta/classes-global/sanity.bbclass
> > @@ -1003,13 +1003,6 @@ def check_sanity(sanity_data):
> > if status.messages != "":
> > raise_sanity_error(sanity_data.expand(status.messages),
> > sanity_data, status.network_error)
> >
> > -# Create a copy of the datastore and finalise it to ensure appends
> > and
> > -# overrides are set - the datastore has yet to be finalised at
> > ConfigParsed
> > -def copy_data(e):
> > - sanity_data = bb.data.createCopy(e.data)
> > - sanity_data.finalize()
> > - return sanity_data
> > -
> > addhandler config_reparse_eventhandler
> > config_reparse_eventhandler[eventmask] = "bb.event.ConfigParsed"
> > python config_reparse_eventhandler() {
> > @@ -1020,13 +1013,13 @@ addhandler check_sanity_eventhandler
> > check_sanity_eventhandler[eventmask] = "bb.event.SanityCheck
> > bb.event.NetworkTest"
> > python check_sanity_eventhandler() {
> > if bb.event.getName(e) == "SanityCheck":
> > - sanity_data = copy_data(e)
> > + sanity_data = bb.data.createCopy(e.data)
>
> For my understanding, wouldn't it be the same to do:
>
> sanity_data = bb.data.createCopy(d)
Yes.
> I found this in the bitbake documentation, which seems to support my
> understanding: A global variable "e" is defined, which represents the
> current event. ... The global datastore is available as "d". In
> legacy
> code, you might see "e.data" used to get the datastore. However,
> realize
> that "e.data" is deprecated and you should use "d" going forward.
e.data is how we used to have to access the datastore in event
contexts. We did add d to allow standardisation and we do want to
remove e.data but haven't cleaned out the old references yet. Arguably
I could/should have here but I was already nesting a few issues deep in
cleanups so I've left that for another time.
> Further, is there any reason to use bb.data.createCopy(d) instead of
> d.createCopy()? AFAICT, the former just calls the latter.
d.createCopy() is indeed the preferred syntax and functionally the
same.
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-15 22:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11 22:58 [PATCH] sanity: Drop data finalize call Richard Purdie
2022-11-15 15:10 ` [OE-core] " Peter Kjellerstedt
2022-11-15 22:16 ` Richard Purdie
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.