summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2021-10-26 18:30:48 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-28 14:16:26 +0100
commitd98585aa89e1d3819f8139a07fb7376ef89b37f8 (patch)
tree0b47cf1fa8d4fd67016dff489d6554246647f447
parentd651eea3dce926399cd42c62494e4ce1940bcf06 (diff)
downloadopenembedded-core-contrib-d98585aa89e1d3819f8139a07fb7376ef89b37f8.tar.gz
spdx.py: Add annotation to relationship
Having annotations on relationship can provide additional information about the relationship such as how it was derived. Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--meta/lib/oe/spdx.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/lib/oe/spdx.py b/meta/lib/oe/spdx.py
index 4416194e06..9e7ced5a15 100644
--- a/meta/lib/oe/spdx.py
+++ b/meta/lib/oe/spdx.py
@@ -196,6 +196,7 @@ class SPDXRelationship(SPDXObject):
relatedSpdxElement = _String()
relationshipType = _String()
comment = _String()
+ annotations = _ObjectList(SPDXAnnotation)
class SPDXExternalReference(SPDXObject):
@@ -300,7 +301,7 @@ class SPDXDocument(SPDXObject):
def from_json(cls, f):
return cls(**json.load(f))
- def add_relationship(self, _from, relationship, _to, *, comment=None):
+ def add_relationship(self, _from, relationship, _to, *, comment=None, annotation=None):
if isinstance(_from, SPDXObject):
from_spdxid = _from.SPDXID
else:
@@ -320,6 +321,9 @@ class SPDXDocument(SPDXObject):
if comment is not None:
r.comment = comment
+ if annotation is not None:
+ r.annotations.append(annotation)
+
self.relationships.append(r)
def find_by_spdxid(self, spdxid):