create-spdx: Don't collect natives sources
PATCH 1/1 create-spdx: Don't collect natives sources
When the collect_dep_sources() runs, it collects sources from both native and non-native recipes. Later when the GENERATED_FROM matching occurs it may find the file (via checksum) from the native recipe since it's the same checksum as the target file. The that are generated DocumentRefs point to the native recipe rather than the target recipe DocumentRef.
--- meta/classes/create-spdx.bbclass | 4 ++++ 1 file changed, 4 insertions(+)
meta/classes/create-spdx.bbclass +4 -0
@@ -336,6 +336,10 @@ def collect_dep_sources(d, dep_recipes): sources = {} for dep in dep_recipes: + # Don't collect sources from native recipes as they + # match non-native sources also. + if "-native" in dep.recipe.name: + continue recipe_files = set(dep.recipe.hasFiles) for spdx_file in dep.doc.files:
Signature · 1 line
2.25.1
Quoted 16 lines · Saul Wold
When the
collect_dep_sources()runs, it collects sources from both native and non-native recipes. Later when theGENERATED_FROMmatching occurs it may find the file (via checksum) from the native recipe since it's the same checksum as the target file. The that are generated DocumentRefs point to the native recipe rather than the target recipe DocumentRef.Signed-off-by Saul Wold <[email protected]>--- meta/classes/create-spdx.bbclass | 4 ++++ 1 file changed, 4 insertions(+)meta/classes/create-spdx.bbclass +0
-0
meta/classes/create-spdx.bbclass def collect_dep_sources(d, dep_recipes): · line 341
Quoted 6 lines
meta/classes/create-spdx.bbclass +3
-0@@ -336,6 +336,10 @@ def collect_dep_sources(d, dep_recipes): sources = {} for dep in dep_recipes: + # Don't collect sources from native recipes as they + # match non-native sources also. + if "-native" in dep.recipe.name:
That looks a bit too fuzzy to me - I would have expected
if dep.recipe.name.endswith("-native"):
here. Otherwise this is very prone to false positives
Quoted 9 lines
meta/classes/create-spdx.bbclass +1
-0+ continue recipe_files = set(dep.recipe.hasFiles) for spdx_file in dep.doc.files:
Quoted 38 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Konrad Weihmann
Sent: den 23 september 2021 10:24
To: Saul Wold <[email protected]>; openembedded- [email protected]; [email protected]
Subject: Re: [OE-core] [PATCH] create-spdx: Don't collect natives sourcesQuoted 1 line · Saul Wold
When the
collect_dep_sources()runs, it collects sources from bothnative
meta/classes/create-
Quoted 11 lines
and non-native recipes. Later when the
GENERATED_FROMmatching occurs it may find the file (via checksum) from the native recipe since it's the same checksum as the target file. The that are generated DocumentRefs point to the native recipe rather than the target recipe DocumentRef.Signed-off-by Saul Wold <[email protected]>--- meta/classes/create-spdx.bbclass | 4 ++++ 1 file changed, 4 insertions(+)meta/classes/create- renamed from meta/classes/create-spdx.bbclass +0
-0spdx.bbclass
meta/classes/create-spdx.bbclass def collect_dep_sources(d, dep_recipes): · line 341
Quoted 10 lines
index
3c73c21c04..8f7fae43f1100644meta/classes/create-spdx.bbclass +3
-0@@ -336,6 +336,10 @@ def collect_dep_sources(d, dep_recipes): sources = {} for dep in dep_recipes: + # Don't collect sources from native recipes as they + # match non-native sources also. + if "-native" in dep.recipe.name:That looks a bit too fuzzy to me - I would have expected
Quoted 3 lines
if
dep.recipe.name.endswith("-native"):here. Otherwise this is very prone to false positives
Absolutely. E.g., we have a recipe called crate-native-tls for the native-tls Rust crate.
At the same time I hate all these hardcoded tests for recipe types all over OE Core as they assume only the types that are in OE Core exist without any (easy) way of extending the tests for non-OE Core recipe types.
Would it instead be possible to add the is_native in do_create_spdx() to the recipe object so that it is available here?
Quoted 4 lines
meta/classes/create-spdx.bbclass def collect_dep_sources(d, dep_recipes): · line 345
Quoted 4 lines
meta/classes/create-spdx.bbclass +1
-0+ continue recipe_files = set(dep.recipe.hasFiles) for spdx_file in dep.doc.files:
//Peter
Quoted 46 lines · Peter Kjellerstedt
Quoted 10 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Konrad Weihmann
Sent: den 23 september 2021 10:24
To: Saul Wold <[email protected]>; openembedded- [email protected]; [email protected]
Subject: Re: [OE-core] [PATCH] create-spdx: Don't collect natives sourcesQuoted 4 lines
Quoted 1 line · Saul Wold
When the
collect_dep_sources()runs, it collects sources from bothnative
Quoted 1 line
and non-native recipes. Later when the
GENERATED_FROMmatching occursit
Quoted 24 lines
meta/classes/create-
Quoted 10 lines
may find the file (via checksum) from the native recipe since it's the same checksum as the target file. The that are generated DocumentRefs point to the native recipe rather than the target recipe DocumentRef.
Signed-off-by Saul Wold <[email protected]>--- meta/classes/create-spdx.bbclass | 4 ++++ 1 file changed, 4 insertions(+)meta/classes/create- renamed from meta/classes/create-spdx.bbclass +0
-0spdx.bbclass
meta/classes/create-spdx.bbclass def collect_dep_sources(d, dep_recipes): · line 341
Quoted 10 lines
index
3c73c21c04..8f7fae43f1100644meta/classes/create-spdx.bbclass +3
-0@@ -336,6 +336,10 @@ def collect_dep_sources(d, dep_recipes): sources = {} for dep in dep_recipes: + # Don't collect sources from native recipes as they + # match non-native sources also. + if "-native" in dep.recipe.name:That looks a bit too fuzzy to me - I would have expected
Quoted 3 lines
if
dep.recipe.name.endswith("-native"):here. Otherwise this is very prone to false positives
Absolutely. E.g., we have a recipe called crate-native-tls for the native-tls Rust crate.
Quoted 8 lines
At the same time I hate all these hardcoded tests for recipe types all over OE Core as they assume only the types that are in OE Core exist without any (easy) way of extending the tests for non-OE Core recipe types.
Would it instead be possible to add the
is_nativeindo_create_spdx()to the recipe object so that it is available here?
Yes. We should be able to add a custom annotation when we create the recipe that we can check later
Quoted 8 lines
Quoted 4 lines
meta/classes/create-spdx.bbclass def collect_dep_sources(d, dep_recipes): · line 345
Quoted 4 lines
meta/classes/create-spdx.bbclass +1
-0+ continue recipe_files = set(dep.recipe.hasFiles) for spdx_file in dep.doc.files://Peter
Quoted 66 lines · Joshua Watt
On Thu, Sep 23, 2021, 5:27 AM Peter Kjellerstedt <[email protected] <mailto:[email protected]>> wrote:
> -----Original Message-----
> From: [email protected]
<mailto:[email protected]> <openembedded-
> [email protected] <mailto:[email protected]>>
On Behalf Of Konrad Weihmann
> Sent: den 23 september 2021 10:24
> To: Saul Wold <[email protected]
<mailto:[email protected]>>; openembedded-
> [email protected] <mailto:[email protected]>;
[email protected] <mailto:[email protected]>
> Subject: Re: [OE-core] [PATCH] create-spdx: Don't collect natives
sources
>
>
>
> On 23.09.21 00:14, Saul Wold wrote:
> > When thecollect_dep_sources()runs, it collects sources from both > native
> > and non-native recipes. Later when theGENERATED_FROMmatching
occurs it
> > may find the file (via checksum) from the native recipe since
it's the
> > same checksum as the target file. The that are generated
DocumentRefs
> > point to the native recipe rather than the target recipe
DocumentRef.
> >
> > Signed-off-by: Saul Wold <[email protected]
<mailto:[email protected]>>
> > ---
> > meta/classes/create-spdx.bbclass | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/meta/classes/create-spdx.bbclass
b/meta/classes/create-
> spdx.bbclass
> > index3c73c21c04..8f7fae43f1100644
> > --- a/meta/classes/create-spdx.bbclass
> > +++ b/meta/classes/create-spdx.bbclass
> > @@ -336,6 +336,10 @@ defcollect_dep_sources(d, dep_recipes):
> >
> > sources = {}
> > for dep indep_recipes:
> > + # Don't collect sources from native recipes as they > > + # match non-native sources also.
> > + if "-native" in dep.recipe.name
<https://urldefense.com/v3/__http://dep.recipe.name__;!!AjveYdw8EvQ!KhzFBhUyb3qZAcSIhlUVGRaWHWWBWh2YZu-s_7VeaS3HaafxJOuneeo9xWwBCOboCok$>:
>
> That looks a bit too fuzzy to me - I would have expected >
> ifdep.recipe.name.endswith("-native"):
>
> here. Otherwise this is very prone to false positivesAbsolutely. E.g., we have a recipe called crate-native-tls for the native-tls Rust crate.
At the same time I hate all these hardcoded tests for recipe types all over OE Core as they assume only the types that are in OE Core exist without any (easy) way of extending the tests for non-OE Core recipe types.
Quoted 6 lines
Would it instead be possible to add the
is_nativeindo_create_spdx()to the recipe object so that it is available here?Yes. We should be able to add a custom annotation when we create the recipe that we can check later
I will re-work the patch and work on adding the is_native to the Recipe object.
Sau!
Quoted 8 lines
> > + continue
> > recipe_files = set(dep.recipe.hasFiles) > >
> > forspdx_filein dep.doc.files://Peter
Signature · 1 line
Sau!