utils/generate-cyclonedx: fix 'project' dependency

The definition of the project name & version is stored under the
`metadata:component` CycloneDX property.

Since the introduction of the `generate-cyclonedx` script [1] a
'buildroot' dependency entry that depends on every components has been
part of the generated SBOM.
Tools such as 'DependencyTrack' relies on such entry to create graph of
the entire project.

With the commit [2] that introduced the option to pass a custom project
name and version, this dependency reference was not updated to match the
custom 'bom-ref'.

This patch fixes the reference to match the custom project name.

[1] dbab39e2d9 support/scripts/generate-cyclonedx.py: add script to generate CycloneDX-style SBOM
[2] 9cbbc47762 utils/generate-cyclonedx: add project name and version options

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Thomas Perale
2026-01-26 14:04:11 +01:00
committed by Peter Korsgaard
parent 191367ad12
commit 189a983c7d

View File

@@ -428,7 +428,7 @@ def main():
cyclonedx_component(name, comp) for name, comp in filtered_show_info_dict.items() cyclonedx_component(name, comp) for name, comp in filtered_show_info_dict.items()
], ],
"dependencies": [ "dependencies": [
cyclonedx_dependency("buildroot", list(filtered_show_info_dict)), cyclonedx_dependency(args.project_name, list(filtered_show_info_dict)),
*[cyclonedx_dependency(ref, br2_parse_deps_recursively(ref, show_info_dict, args.virtual)) *[cyclonedx_dependency(ref, br2_parse_deps_recursively(ref, show_info_dict, args.virtual))
for ref in filtered_show_info_dict], for ref in filtered_show_info_dict],
], ],