From 902480107dd0db7b77ada4654d2e0f061a04765d Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 1 Sep 2021 08:44:50 -0500 Subject: classes/create-spdx: Fix up license reporting Licenses reported in the SPDX documents should be either: A) A valid SPDX identifier cross referenced from the SPDX license database B) A "LicenseRef" to a license described in the SPDX document The licensing code will now add a placeholder extracted license with corresponding "LicenseRef" for any licenses that are not matched to the SPDX database Parenthesis in the license expression are now handled correctly (From OE-Core rev: 28d9d035c0ff8fcaf28bc96a976a43a602a47e94) Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- meta/lib/oe/spdx.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'meta/lib') diff --git a/meta/lib/oe/spdx.py b/meta/lib/oe/spdx.py index 3f569c6862..9814fbfd66 100644 --- a/meta/lib/oe/spdx.py +++ b/meta/lib/oe/spdx.py @@ -189,6 +189,13 @@ class SPDXExternalDocumentRef(SPDXObject): checksum = _Object(SPDXChecksum) +class SPDXExtractedLicensingInfo(SPDXObject): + name = _String() + comment = _String() + licenseId = _String() + extractedText = _String() + + class SPDXDocument(SPDXObject): spdxVersion = _String(default="SPDX-" + SPDX_VERSION) dataLicense = _String(default="CC0-1.0") @@ -200,6 +207,7 @@ class SPDXDocument(SPDXObject): files = _ObjectList(SPDXFile) relationships = _ObjectList(SPDXRelationship) externalDocumentRefs = _ObjectList(SPDXExternalDocumentRef) + hasExtractedLicensingInfos = _ObjectList(SPDXExtractedLicensingInfo) def __init__(self, **d): super().__init__(**d) -- cgit v1.2.3-54-g00ecf