summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/spdx30_tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/spdx30_tasks.py')
-rw-r--r--meta/lib/oe/spdx30_tasks.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 9d5bbadc0f..03dc47db02 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -28,8 +28,7 @@ def set_timestamp_now(d, o, prop):
28 delattr(o, prop) 28 delattr(o, prop)
29 29
30 30
31def add_license_expression(d, objset, license_expression): 31def add_license_expression(d, objset, license_expression, license_data):
32 license_data = d.getVar("SPDX_LICENSE_DATA")
33 simple_license_text = {} 32 simple_license_text = {}
34 license_text_map = {} 33 license_text_map = {}
35 license_ref_idx = 0 34 license_ref_idx = 0
@@ -120,7 +119,7 @@ def add_license_expression(d, objset, license_expression):
120 ) 119 )
121 spdx_license_expression = " ".join(convert(l) for l in lic_split) 120 spdx_license_expression = " ".join(convert(l) for l in lic_split)
122 121
123 return objset.new_license_expression(spdx_license_expression, license_text_map) 122 return objset.new_license_expression(spdx_license_expression, license_data, license_text_map)
124 123
125 124
126def add_package_files( 125def add_package_files(
@@ -129,6 +128,7 @@ def add_package_files(
129 topdir, 128 topdir,
130 get_spdxid, 129 get_spdxid,
131 get_purposes, 130 get_purposes,
131 license_data,
132 *, 132 *,
133 archive=None, 133 archive=None,
134 ignore_dirs=[], 134 ignore_dirs=[],
@@ -165,7 +165,7 @@ def add_package_files(
165 spdx_files.add(spdx_file) 165 spdx_files.add(spdx_file)
166 166
167 if oe.spdx30.software_SoftwarePurpose.source in file_purposes: 167 if oe.spdx30.software_SoftwarePurpose.source in file_purposes:
168 objset.scan_declared_licenses(spdx_file, filepath) 168 objset.scan_declared_licenses(spdx_file, filepath, license_data)
169 169
170 if archive is not None: 170 if archive is not None:
171 with filepath.open("rb") as f: 171 with filepath.open("rb") as f:
@@ -452,6 +452,8 @@ def create_spdx(d):
452 if val: 452 if val:
453 setattr(obj, name, val) 453 setattr(obj, name, val)
454 454
455 license_data = oe.spdx_common.load_spdx_license_data(d)
456
455 deploydir = Path(d.getVar("SPDXDEPLOY")) 457 deploydir = Path(d.getVar("SPDXDEPLOY"))
456 deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX")) 458 deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
457 spdx_workdir = Path(d.getVar("SPDXWORK")) 459 spdx_workdir = Path(d.getVar("SPDXWORK"))
@@ -508,7 +510,7 @@ def create_spdx(d):
508 source_files = add_download_files(d, build_objset) 510 source_files = add_download_files(d, build_objset)
509 build_inputs |= source_files 511 build_inputs |= source_files
510 512
511 recipe_spdx_license = add_license_expression(d, build_objset, d.getVar("LICENSE")) 513 recipe_spdx_license = add_license_expression(d, build_objset, d.getVar("LICENSE"), license_data)
512 build_objset.new_relationship( 514 build_objset.new_relationship(
513 source_files, 515 source_files,
514 oe.spdx30.RelationshipType.hasConcludedLicense, 516 oe.spdx30.RelationshipType.hasConcludedLicense,
@@ -527,6 +529,7 @@ def create_spdx(d):
527 "sourcefile", str(file_counter) 529 "sourcefile", str(file_counter)
528 ), 530 ),
529 lambda filepath: [oe.spdx30.software_SoftwarePurpose.source], 531 lambda filepath: [oe.spdx30.software_SoftwarePurpose.source],
532 license_data,
530 ignore_dirs=[".git"], 533 ignore_dirs=[".git"],
531 ignore_top_level_dirs=["temp"], 534 ignore_top_level_dirs=["temp"],
532 archive=None, 535 archive=None,
@@ -636,7 +639,7 @@ def create_spdx(d):
636 package_license = d.getVar("LICENSE:%s" % package) 639 package_license = d.getVar("LICENSE:%s" % package)
637 if package_license and package_license != d.getVar("LICENSE"): 640 if package_license and package_license != d.getVar("LICENSE"):
638 package_spdx_license = add_license_expression( 641 package_spdx_license = add_license_expression(
639 d, build_objset, package_license 642 d, build_objset, package_license, license_data
640 ) 643 )
641 else: 644 else:
642 package_spdx_license = recipe_spdx_license 645 package_spdx_license = recipe_spdx_license
@@ -708,6 +711,7 @@ def create_spdx(d):
708 ), 711 ),
709 # TODO: Can we know the purpose here? 712 # TODO: Can we know the purpose here?
710 lambda filepath: [], 713 lambda filepath: [],
714 license_data,
711 ignore_top_level_dirs=["CONTROL", "DEBIAN"], 715 ignore_top_level_dirs=["CONTROL", "DEBIAN"],
712 archive=None, 716 archive=None,
713 ) 717 )
@@ -739,6 +743,7 @@ def create_spdx(d):
739 d.expand("${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"), 743 d.expand("${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN}"),
740 lambda file_counter: build_objset.new_spdxid("sysroot", str(file_counter)), 744 lambda file_counter: build_objset.new_spdxid("sysroot", str(file_counter)),
741 lambda filepath: [], 745 lambda filepath: [],
746 license_data,
742 archive=None, 747 archive=None,
743 ) 748 )
744 749