summaryrefslogtreecommitdiffstats
path: root/meta/lib
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:31 +0100
commitb2f859ee6173e74a0a66b7f75c55fc774f454a35 (patch)
tree720fa4f6f1d2abe81d2437c652121c7e580cc2b6 /meta/lib
parentc98d05523f0e18788f86014c0cd5359f499f079b (diff)
downloadpoky-b2f859ee6173e74a0a66b7f75c55fc774f454a35.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. (From OE-Core rev: d98585aa89e1d3819f8139a07fb7376ef89b37f8) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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):
196 relatedSpdxElement = _String() 196 relatedSpdxElement = _String()
197 relationshipType = _String() 197 relationshipType = _String()
198 comment = _String() 198 comment = _String()
199 annotations = _ObjectList(SPDXAnnotation)
199 200
200 201
201class SPDXExternalReference(SPDXObject): 202class SPDXExternalReference(SPDXObject):
@@ -300,7 +301,7 @@ class SPDXDocument(SPDXObject):
300 def from_json(cls, f): 301 def from_json(cls, f):
301 return cls(**json.load(f)) 302 return cls(**json.load(f))
302 303
303 def add_relationship(self, _from, relationship, _to, *, comment=None): 304 def add_relationship(self, _from, relationship, _to, *, comment=None, annotation=None):
304 if isinstance(_from, SPDXObject): 305 if isinstance(_from, SPDXObject):
305 from_spdxid = _from.SPDXID 306 from_spdxid = _from.SPDXID
306 else: 307 else:
@@ -320,6 +321,9 @@ class SPDXDocument(SPDXObject):
320 if comment is not None: 321 if comment is not None:
321 r.comment = comment 322 r.comment = comment
322 323
324 if annotation is not None:
325 r.annotations.append(annotation)
326
323 self.relationships.append(r) 327 self.relationships.append(r)
324 328
325 def find_by_spdxid(self, spdxid): 329 def find_by_spdxid(self, spdxid):