All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [OE-core][PATCH] spdx: Add custom annotations to recipe packages
Date: Mon, 22 Jun 2026 10:01:24 -0600	[thread overview]
Message-ID: <20260622160124.254101-1-JPEWhacker@gmail.com> (raw)

In addition to adding custom annotations to the build, add them to the
recipe as well.

Historically in the SPDX 2.2 implementation, there was no concept of a
"build" and instead just a "recipe" SPDX package that represented both
the recipe itself and the build that produced the runtime packages. The
custom annotations were attached to this package. When SPDX 3 was first
introduced, this unified recipe package was not kept and instead only a
build object was created to represent the production of the runtime
packages; as such the custom annotations were attached to this build.
Later, it was desired to re-introduce a package to represent the recipe
itself for various reasons, however the custom annotations were not
attached to the recipe object at that time.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/lib/oe/spdx30_tasks.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 72d17aade6..79e18db11d 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -588,6 +588,15 @@ def set_purposes(d, element, *var_names, force_purposes=[]):
     ]
 
 
+def add_custom_annotations(d, objset, obj):
+    for var in (d.getVar("SPDX_CUSTOM_ANNOTATION_VARS") or "").split():
+        objset.new_annotation(
+            obj,
+            "%s=%s" % (var, d.getVar(var)),
+            oe.spdx30.AnnotationType.other,
+        )
+
+
 def set_purls(spdx_package, purls):
     if purls:
         spdx_package.software_packageUrl = purls[0]
@@ -639,6 +648,8 @@ def create_recipe_spdx(d):
         ext.is_native = True
         recipe.extension.append(ext)
 
+    add_custom_annotations(d, recipe_objset, recipe)
+
     set_purls(recipe, (d.getVar("SPDX_PACKAGE_URLS") or "").split())
 
     # TODO: This doesn't work before do_unpack because the license text has to
@@ -839,12 +850,7 @@ def create_spdx(d):
 
     build_objset.set_is_native(is_native)
 
-    for var in (d.getVar("SPDX_CUSTOM_ANNOTATION_VARS") or "").split():
-        build_objset.new_annotation(
-            build,
-            "%s=%s" % (var, d.getVar(var)),
-            oe.spdx30.AnnotationType.other,
-        )
+    add_custom_annotations(d, build_objset, build)
 
     build_inputs = set()
 
-- 
2.54.0



                 reply	other threads:[~2026-06-22 16:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260622160124.254101-1-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.