diff options
| -rw-r--r-- | meta/classes/create-spdx.bbclass | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass index 739b46e9b3..aa9514121d 100644 --- a/meta/classes/create-spdx.bbclass +++ b/meta/classes/create-spdx.bbclass | |||
| @@ -35,6 +35,17 @@ def get_doc_namespace(d, doc): | |||
| 35 | namespace_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, d.getVar("SPDX_UUID_NAMESPACE")) | 35 | namespace_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, d.getVar("SPDX_UUID_NAMESPACE")) |
| 36 | return "%s/%s-%s" % (d.getVar("SPDX_NAMESPACE_PREFIX"), doc.name, str(uuid.uuid5(namespace_uuid, doc.name))) | 36 | return "%s/%s-%s" % (d.getVar("SPDX_NAMESPACE_PREFIX"), doc.name, str(uuid.uuid5(namespace_uuid, doc.name))) |
| 37 | 37 | ||
| 38 | def create_annotation(d, comment): | ||
| 39 | from datetime import datetime, timezone | ||
| 40 | |||
| 41 | creation_time = datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") | ||
| 42 | annotation = oe.spdx.SPDXAnnotation() | ||
| 43 | annotation.annotationDate = creation_time | ||
| 44 | annotation.annotationType = "OTHER" | ||
| 45 | annotation.annotator = "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) | ||
| 46 | annotation.comment = comment | ||
| 47 | return annotation | ||
| 48 | |||
| 38 | def recipe_spdx_is_native(d, recipe): | 49 | def recipe_spdx_is_native(d, recipe): |
| 39 | return any(a.annotationType == "OTHER" and | 50 | return any(a.annotationType == "OTHER" and |
| 40 | a.annotator == "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) and | 51 | a.annotator == "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) and |
| @@ -412,12 +423,7 @@ python do_create_spdx() { | |||
| 412 | recipe.versionInfo = d.getVar("PV") | 423 | recipe.versionInfo = d.getVar("PV") |
| 413 | recipe.SPDXID = oe.sbom.get_recipe_spdxid(d) | 424 | recipe.SPDXID = oe.sbom.get_recipe_spdxid(d) |
| 414 | if bb.data.inherits_class("native", d): | 425 | if bb.data.inherits_class("native", d): |
| 415 | annotation = oe.spdx.SPDXAnnotation() | 426 | recipe.annotations.append(create_annotation(d, "isNative")) |
| 416 | annotation.annotationDate = creation_time | ||
| 417 | annotation.annotationType = "OTHER" | ||
| 418 | annotation.annotator = "Tool: %s - %s" % (d.getVar("SPDX_TOOL_NAME"), d.getVar("SPDX_TOOL_VERSION")) | ||
| 419 | annotation.comment = "isNative" | ||
| 420 | recipe.annotations.append(annotation) | ||
| 421 | 427 | ||
| 422 | for s in d.getVar('SRC_URI').split(): | 428 | for s in d.getVar('SRC_URI').split(): |
| 423 | if not s.startswith("file://"): | 429 | if not s.startswith("file://"): |
