utils/generate-cyclonedx: fix hash_file location
PATCH 1/1 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.
--- utils/generate-cyclonedx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/generate-cyclonedx +1 -1
@@ -302,7 +302,7 @@ def cyclonedx_source_hashes(comp, source): 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: line = line.strip() if not line.startswith("#") and line.endswith(f" {source}"):
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 11 lines · Thomas Perale via buildroot
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 externalReferencesSigned-off-by Thomas Perale <[email protected]>
Applied to master, thanks.
Perhaps test_generate_cyclonedx can be updated to check out-of-tree calls?
Regards,
Arnout
Quoted 9 lines
--- utils/generate-cyclonedx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/generate-cyclonedx +0
-0
utils/generate-cyclonedx def cyclonedx_source_hashes(comp, source): · line 308
Quoted 8 lines
utils/generate-cyclonedx +1
-1@@ -302,7 +302,7 @@ def cyclonedx_source_hashes(comp, source): 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: line = line.strip() if not line.startswith("#") and line.endswith(f" {source}"):
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Perale via buildroot
AppliedIn reply of:
Quoted 11 lines
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 externalReferencesSigned-off-by Thomas Perale <[email protected]>
Applied to 2025.02.x & 2026.02.x. Thanks
Quoted 24 lines
--- utils/generate-cyclonedx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/generate-cyclonedx +1
-1@@ -302,7 +302,7 @@ def cyclonedx_source_hashes(comp, source): 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: line = line.strip() if not line.startswith("#") and line.endswith(f" {source}"):Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot