This adds a check to ensure we that if a variable is
empty it gets an empty string, this also adds quotes
to indicate the variable contents.

          "comment": "CUSTOM_SPECIAL=''"
or
          "comment": "CUSTOM_SPECIAL= 'variable contents'"

Signed-off-by: Saul Wold <[email protected]>
---
 meta/classes/create-spdx-2.2.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/classes/create-spdx-2.2.bbclass 
b/meta/classes/create-spdx-2.2.bbclass
index 28a42e009f6..8b18ada40a4 100644
--- a/meta/classes/create-spdx-2.2.bbclass
+++ b/meta/classes/create-spdx-2.2.bbclass
@@ -484,7 +484,10 @@ python do_create_spdx() {
 
     if d.getVar("SPDX_CUSTOM_ANNOTATION_VARS"):
         for var in d.getVar('SPDX_CUSTOM_ANNOTATION_VARS').split():
-            recipe.annotations.append(create_annotation(d, var + "=" + 
d.getVar(var)))
+            if d.getVar(var):
+                recipe.annotations.append(create_annotation(d, var + "= '" + 
d.getVar(var) + "'"))
+            else:
+                recipe.annotations.append(create_annotation(d, var + "=''"))
 
     # Some CVEs may be patched during the build process without incrementing 
the version number,
     # so querying for CVEs based on the CPE id can lead to false positives. To 
account for this,
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177224): 
https://lists.openembedded.org/g/openembedded-core/message/177224
Mute This Topic: https://lists.openembedded.org/mt/96996669/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to