summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/spdx30_tasks.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-10-07 10:24:15 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-15 11:47:24 +0100
commit19aa2c0a99b02dfa157f38d8975ea73e95647861 (patch)
tree71ba9519e7d535c79e6ec54f2e67919512c738a8 /meta/lib/oe/spdx30_tasks.py
parentca5472cd2ce30061dc8bd18efe9e85c8f76b8444 (diff)
downloadpoky-19aa2c0a99b02dfa157f38d8975ea73e95647861.tar.gz
spdx30: Link license and build by alias
The license information and Build created by do_create_spdx are changed to be referenced by their link alias instead of the actual SPDX ID. This fixes a case where do_create_package_spdx would pull these from mismatching sstate, and then the SPDX IDs would be unresolved when assembling the final document (From OE-Core rev: c0fcdc72a7c8fca86a874d1b04298fe9e500c796) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/spdx30_tasks.py')
-rw-r--r--meta/lib/oe/spdx30_tasks.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index d0dd40877e..e0b656d81f 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -119,9 +119,11 @@ def add_license_expression(d, objset, license_expression, license_data):
119 ) 119 )
120 spdx_license_expression = " ".join(convert(l) for l in lic_split) 120 spdx_license_expression = " ".join(convert(l) for l in lic_split)
121 121
122 return objset.new_license_expression( 122 o = objset.new_license_expression(
123 spdx_license_expression, license_data, license_text_map 123 spdx_license_expression, license_data, license_text_map
124 ) 124 )
125 objset.set_element_alias(o)
126 return o
125 127
126 128
127def add_package_files( 129def add_package_files(
@@ -462,6 +464,8 @@ def create_spdx(d):
462 build_objset = oe.sbom30.ObjectSet.new_objset(d, d.getVar("PN")) 464 build_objset = oe.sbom30.ObjectSet.new_objset(d, d.getVar("PN"))
463 465
464 build = build_objset.new_task_build("recipe", "recipe") 466 build = build_objset.new_task_build("recipe", "recipe")
467 build_objset.set_element_alias(build)
468
465 build_objset.doc.rootElement.append(build) 469 build_objset.doc.rootElement.append(build)
466 470
467 build_objset.set_is_native(is_native) 471 build_objset.set_is_native(is_native)
@@ -603,7 +607,7 @@ def create_spdx(d):
603 set_var_field("DESCRIPTION", spdx_package, "description", package=package) 607 set_var_field("DESCRIPTION", spdx_package, "description", package=package)
604 608
605 pkg_objset.new_scoped_relationship( 609 pkg_objset.new_scoped_relationship(
606 [build._id], 610 [oe.sbom30.get_element_link_id(build)],
607 oe.spdx30.RelationshipType.hasOutput, 611 oe.spdx30.RelationshipType.hasOutput,
608 oe.spdx30.LifecycleScopeType.build, 612 oe.spdx30.LifecycleScopeType.build,
609 [spdx_package], 613 [spdx_package],
@@ -650,7 +654,7 @@ def create_spdx(d):
650 pkg_objset.new_relationship( 654 pkg_objset.new_relationship(
651 [spdx_package], 655 [spdx_package],
652 oe.spdx30.RelationshipType.hasConcludedLicense, 656 oe.spdx30.RelationshipType.hasConcludedLicense,
653 [package_spdx_license._id], 657 [oe.sbom30.get_element_link_id(package_spdx_license)],
654 ) 658 )
655 659
656 # NOTE: CVE Elements live in the recipe collection 660 # NOTE: CVE Elements live in the recipe collection