@@ -597,11 +597,11 @@ def add_custom_annotations(d, objset, obj):
)
-def set_purls(spdx_package, purls):
+def set_purls(spdx_package, purls, dependency_purls=()):
if purls:
spdx_package.software_packageUrl = purls[0]
- for p in sorted(set(purls)):
+ for p in sorted(set(purls) | set(dependency_purls)):
spdx_package.externalIdentifier.append(
oe.spdx30.ExternalIdentifier(
externalIdentifierType=oe.spdx30.ExternalIdentifierType.packageUrl,
@@ -979,6 +979,14 @@ def create_spdx(d):
source_files = add_download_files(d, build_objset)
build_inputs |= source_files
+ # The output packages inherit the PURLs of the downloads they are built
+ # from, as the code of statically linked dependencies is in them.
+ dependency_purls = {
+ dl.software_packageUrl
+ for dl in source_files
+ if getattr(dl, "software_packageUrl", None)
+ }
+
recipe_spdx_license = add_license_expression(
d, build_objset, d.getVar("LICENSE"), license_data, [recipe_objset]
)
@@ -1092,7 +1100,7 @@ def create_spdx(d):
or ""
).split()
- set_purls(spdx_package, purls)
+ set_purls(spdx_package, purls, dependency_purls)
pkg_objset.new_scoped_relationship(
[oe.sbom30.get_element_link_id(build)],