summaryrefslogtreecommitdiffstats
path: root/meta
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-11-08 23:41:00 +0000
commit4c9414b35d88d1551643cc51434025a0267c4e26 (patch)
treefe8b01601b2263a425ed0fa42fd556051b9fe8e3 /meta
parentc7b2db1fa6232d810effff0fcee1aefddbe1d6c5 (diff)
downloadpoky-4c9414b35d88d1551643cc51434025a0267c4e26.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: 37a29bd732cb917da4930ef624da72f5196732cc) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit d98585aa89e1d3819f8139a07fb7376ef89b37f8) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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):