spdx30_tasks: Fix SPDX_CUSTOM_ANNOTATION_VARS implementation
PATCH v3 1/1 spdx30_tasks: Fix SPDX_CUSTOM_ANNOTATION_VARS implementation
From: Stefano Tondo <[email protected]>
Fix incorrect function call when processing SPDX_CUSTOM_ANNOTATION_VARS. The code was calling new_annotation() as a standalone function, but it should be called as a method on the build_objset object.
Error:
new_annotation(d, build_objset, build, ...)
Corrected to:
build_objset.new_annotation(d, build_objset, build, ...)
This bug would cause a NameError at runtime if SPDX_CUSTOM_ANNOTATION_VARS was set to a non-empty value, preventing SPDX document generation.
The fix aligns with how new_annotation() is called elsewhere in the codebase and matches the SBOMObjset class method signature.
---
Changes in v3:
- Fixed test bugs identified in v2 review:
- Corrected SPDX file path from packages/package-base-files.spdx.json to recipes/recipe-base-files.spdx.json
- Fixed objset.objects() to objset.objects (removed incorrect parentheses)
- Fixed whitespace formatting in test code
Changes in v2:
- Added regression test to prevent future occurrences
--- meta/lib/oe/spdx30_tasks.py | 4 +- meta/lib/oeqa/selftest/cases/spdx.py | 85 +++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 10 deletions(-)
meta/lib/oe/spdx30_tasks.py +1 -3
@@ -498,9 +498,7 @@ def create_spdx(d): build_objset.set_is_native(is_native) for var in (d.getVar("SPDX_CUSTOM_ANNOTATION_VARS") or "").split(): - new_annotation( - d, - build_objset, + build_objset.new_annotation( build, "%s=%s" % (var, d.getVar(var)), oe.spdx30.AnnotationType.other,
meta/lib/oeqa/selftest/cases/spdx.py +78 -7
103 lines not on this page · raw message
Signature · 1 line
2.51.1