* [wrynose][PATCH 1/2] spdx30_tasks: include the SDK target packages in the SDK SBOM
2026-11-28 0:50 [wrynose][PATCH 0/2] spdx30_tasks: fix missing content in the image and SDK SBOMs Alexandre Marques
@ 2026-11-28 0:50 ` Alexandre Marques
2026-11-28 0:50 ` [wrynose][PATCH 2/2] spdx30_tasks: fix missing SPDX runtime dependencies Alexandre Marques
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Marques @ 2026-11-28 0:50 UTC (permalink / raw)
To: openembedded-core
Cc: yoann.congal, Prasanth R, Prasanth R, Mathieu Dubois-Briand,
Richard Purdie, Alexandre Marques
From: Prasanth R <ragaprasanth@gmail.com>
The SDK target and host parts both write sdk-rootfs.spdx.json. The host
part runs last and overwrites the target one, so the SDK SBOM lists the
nativesdk packages but none of the target sysroot packages.
Write separate target and host documents, with their own build IDs, and
include both in the SDK SBOM.
SPDX 2.2 wrote separate host and target SBOMs, so this was lost when
the SDK SBOM moved to SPDX 3.0.
AI-Generated: Uses Claude
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 06452702d0694c13534555e7097a772641c39f19)
Signed-off-by: Alexandre Marques <alexandre.marques@ctw.bmwgroup.com>
---
meta/lib/oe/spdx30_tasks.py | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 62fc41f51a..953a4ba052 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -1588,7 +1588,9 @@ def sdk_create_spdx(d, sdk_type, spdx_work_dir, toolchain_outputname):
)
set_timestamp_now(d, sdk_rootfs, "builtTime")
- sdk_build = objset.add_root(objset.new_task_build("sdk-rootfs", "sdk-rootfs"))
+ sdk_build = objset.add_root(
+ objset.new_task_build("sdk-rootfs-" + sdk_type, "sdk-rootfs")
+ )
set_timestamp_now(d, sdk_build, "build_buildEndTime")
objset.new_scoped_relationship(
@@ -1601,28 +1603,36 @@ def sdk_create_spdx(d, sdk_type, spdx_work_dir, toolchain_outputname):
collect_build_package_inputs(d, objset, sdk_build, sdk_packages)
objset.add_aliases()
- oe.sbom30.write_jsonld_doc(d, objset, spdx_work_dir / "sdk-rootfs.spdx.json")
+ oe.sbom30.write_jsonld_doc(
+ d, objset, spdx_work_dir / ("sdk-rootfs-%s.spdx.json" % sdk_type)
+ )
def create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, toolchain_outputname):
- # Load the document written earlier
- rootfs_objset = oe.sbom30.load_jsonld(
- d, spdx_work_dir / "sdk-rootfs.spdx.json", required=True
- )
+ # Load the target and host documents written earlier
+ rootfs_objsets = []
+ rootfs = []
+ for sdk_type in ("target", "host"):
+ objset = oe.sbom30.load_jsonld(
+ d, spdx_work_dir / ("sdk-rootfs-%s.spdx.json" % sdk_type), required=True
+ )
+ root = objset.find_root(oe.spdx30.software_Package)
+ if root is None:
+ bb.fatal("Unable to find %s rootfs artifact" % sdk_type)
+ rootfs_objsets.append(objset)
+ rootfs.append(root)
+
+ rootfs_objset = rootfs_objsets[0]
# Create a new build for the SDK installer
sdk_build = rootfs_objset.new_task_build("sdk-populate", "sdk-populate")
set_timestamp_now(d, sdk_build, "build_buildEndTime")
- rootfs = rootfs_objset.find_root(oe.spdx30.software_Package)
- if rootfs is None:
- bb.fatal("Unable to find rootfs artifact")
-
rootfs_objset.new_scoped_relationship(
[sdk_build],
oe.spdx30.RelationshipType.hasInput,
oe.spdx30.LifecycleScopeType.build,
- [rootfs],
+ rootfs,
)
files = set()
@@ -1669,7 +1679,7 @@ def create_sdk_sbom(d, sdk_deploydir, spdx_work_dir, toolchain_outputname):
bb.warn(f"No SDK output files found in {sdk_deploydir}")
objset, sbom = oe.sbom30.create_sbom(
- d, toolchain_outputname, sorted(list(files)), [rootfs_objset]
+ d, toolchain_outputname, sorted(list(files)), rootfs_objsets
)
# Set supplier on root elements if SPDX_SDK_SUPPLIER is defined
^ permalink raw reply related [flat|nested] 3+ messages in thread* [wrynose][PATCH 2/2] spdx30_tasks: fix missing SPDX runtime dependencies
2026-11-28 0:50 [wrynose][PATCH 0/2] spdx30_tasks: fix missing content in the image and SDK SBOMs Alexandre Marques
2026-11-28 0:50 ` [wrynose][PATCH 1/2] spdx30_tasks: include the SDK target packages in the SDK SBOM Alexandre Marques
@ 2026-11-28 0:50 ` Alexandre Marques
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Marques @ 2026-11-28 0:50 UTC (permalink / raw)
To: openembedded-core
Cc: yoann.congal, Pascal Eberhard, Mathieu Dubois-Briand,
Richard Purdie, Alexandre Marques
From: Pascal Eberhard <pascal.eberhard@se.com>
The runtime dependsOn relationship entries between software_Package
is missing from the generated SPDX files.
Remove the subpkgdata lookup as the final pkg_name is already resolved
by collect_package_providers().
Rename variables to avoid shadowing the 'dep' variable and to make it
explicit which package/pkg name is being used.
Signed-off-by: Pascal Eberhard <pascal.eberhard@se.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a67f44021f39b19f42791441616ba57d522f1d00)
[Adjusted context: wrynose does not have 28ffcc0653 ("spdx: Reformat")]
Signed-off-by: Alexandre Marques <alexandre.marques@ctw.bmwgroup.com>
---
meta/lib/oe/spdx30_tasks.py | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 953a4ba052..d89763743c 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -1129,9 +1129,13 @@ def create_spdx(d):
def create_package_spdx(d):
deploydir = Path(d.getVar("SPDXRUNTIMEDEPLOY"))
+ pkgdatadir = Path(d.getVar('PKGDATA_DIR'))
direct_deps = oe.spdx_common.collect_direct_deps(d, "do_create_spdx")
+ # providers[package_name] = pkg_name, where:
+ # - package_name is the name in the recipe in PACKAGES/RDEPENDS, and
+ # - pkg_name is the final name given by the package manager.
providers = oe.spdx_common.collect_package_providers(d, direct_deps)
pkg_arch = d.getVar("SSTATE_PKGARCH")
@@ -1185,26 +1189,24 @@ def create_package_spdx(d):
if dep not in providers:
continue
- (dep, _) = providers[dep]
+ dep_pkg_name, _ = providers[dep]
- if not oe.packagedata.packaged(dep, localdata):
+ if not os.path.exists(pkgdatadir / "runtime-reverse" / dep_pkg_name):
+ bb.debug(1, f"pkg_name {dep_pkg_name}, package {dep} missing for {package}")
continue
- dep_pkg_data = oe.packagedata.read_subpkgdata_dict(dep, d)
- dep_pkg = dep_pkg_data["PKG"]
-
- if dep in dep_package_cache:
- dep_spdx_package = dep_package_cache[dep]
+ if dep_pkg_name in dep_package_cache:
+ dep_spdx_package = dep_package_cache[dep_pkg_name]
else:
- bb.debug(1, "Searching for %s" % dep_pkg)
+ bb.debug(1, "Searching for %s" % dep_pkg_name)
dep_spdx_package, _ = oe.sbom30.find_root_obj_in_jsonld(
d,
"packages-staging",
- "package-" + dep_pkg,
+ "package-" + dep_pkg_name,
oe.spdx30.software_Package,
software_primaryPurpose=oe.spdx30.software_SoftwarePurpose.install,
)
- dep_package_cache[dep] = dep_spdx_package
+ dep_package_cache[dep_pkg_name] = dep_spdx_package
runtime_spdx_deps.add(dep_spdx_package)
seen_deps.add(dep)
^ permalink raw reply related [flat|nested] 3+ messages in thread