utils/generate-cyclonedx: fix hash_file location

The 'show-info' output always the location relative to the Buildroot
root directory.
When running 'generate-cyclonedx' outside of the Buildroot root
directory the hash file locations are not correct. Only using the
'hash_file' variable coming from 'show-info' doesn't guarantee the
script to succeed.

Use the 'brpath' variable to correctly reference the absolute path.

Fixes: 1791b79422 utils/generate-cyclonedx: add hashes from .hash files to externalReferences
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
This commit is contained in:
Thomas Perale
2026-06-01 11:41:57 +02:00
committed by Arnout Vandecappelle
parent 92cdec5a54
commit 2df4f1d573

View File

@@ -302,7 +302,7 @@ def cyclonedx_source_hashes(comp, source):
hashes = [] hashes = []
for hash_file in comp.get("hashes", []): for hash_file in comp.get("hashes", []):
with Path(hash_file).open() as f: with (brpath / hash_file).open() as f:
for line in f: for line in f:
line = line.strip() line = line.strip()
if not line.startswith("#") and line.endswith(f" {source}"): if not line.startswith("#") and line.endswith(f" {source}"):