mirror of
https://git.yoctoproject.org/poky
synced 2026-05-01 15:32:12 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
c98d05523f
commit
b2f859ee61
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user