summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorKamel Bouhara (Schneider Electric) <kamel.bouhara@bootlin.com>2025-12-15 16:54:23 +0100
committerSteve Sakoman <steve@sakoman.com>2025-12-31 07:49:31 -0800
commit707dce4f01527b23e775ec31282e94c3a74e71da (patch)
tree7f68abc88ad47399689d7c9571dd504abf3da3ee /meta/lib
parent6d222750d5c3254c200259a1ff6ac7c691a7cd7d (diff)
downloadpoky-707dce4f01527b23e775ec31282e94c3a74e71da.tar.gz
spdx30_tasks: Add support for exporting PACKAGECONFIG to SPDX
Introduce the SPDX_INCLUDE_PACKAGECONFIG variable, which when enabled causes PACKAGECONFIG features to be recorded in the SPDX document as build parameters. Each feature is recorded as a DictionaryEntry with key PACKAGECONFIG:<feature> and value enabled or disabled, depending on whether the feature is active in the current build. This makes the build-time configuration more transparent in SPDX output and improves reproducibility tracking. This makes the build-time configuration more transparent in SPDX output and improves reproducibility tracking. In particular, it allows consumers of the SBOM to identify enabled/disabled features that may affect security posture or feature set. Reviewed-by: Joshua Watt <JPEWhacker@gmail.com> (From OE-Core rev: 5cfd0690f819379d9f97c86d2078c3e529efe385) Signed-off-by: Kamel Bouhara (Schneider Electric) <kamel.bouhara@bootlin.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 7ec61ac40345a5c0ef1ce20513a4596989c91ef4) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/spdx30_tasks.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index e425958991..a3d848ceb1 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -809,6 +809,26 @@ def create_spdx(d):
809 sorted(list(build_inputs)) + sorted(list(debug_source_ids)), 809 sorted(list(build_inputs)) + sorted(list(debug_source_ids)),
810 ) 810 )
811 811
812 if d.getVar("SPDX_INCLUDE_PACKAGECONFIG", True) != "0":
813 packageconfig = (d.getVar("PACKAGECONFIG") or "").split()
814 all_features = (d.getVarFlags("PACKAGECONFIG") or {}).keys()
815
816 if all_features:
817 enabled = set(packageconfig)
818 all_features_set = set(all_features)
819 disabled = all_features_set - enabled
820
821 for feature in sorted(all_features):
822 status = "enabled" if feature in enabled else "disabled"
823 build.build_parameter.append(
824 oe.spdx30.DictionaryEntry(
825 key=f"PACKAGECONFIG:{feature}",
826 value=status
827 )
828 )
829
830 bb.note(f"Added PACKAGECONFIG entries: {len(enabled)} enabled, {len(disabled)} disabled")
831
812 oe.sbom30.write_recipe_jsonld_doc(d, build_objset, "recipes", deploydir) 832 oe.sbom30.write_recipe_jsonld_doc(d, build_objset, "recipes", deploydir)
813 833
814 834