Message ID | 20240701144152.1018433-1-JPEWhacker@gmail.com |
---|---|
State | Accepted, archived |
Commit | 8757a5eaeaf2b9d7345212d003e5622289b123e6 |
Headers | show |
Series | classes/create-spdx-2.2: Handle SemVer License List Versions | expand |
Hang on, apparently we call this a lot of places, V2 coming soon On Mon, Jul 1, 2024 at 8:42 AM Joshua Watt <jpewhacker@gmail.com> wrote: > > SPDX transitioned the license list to use SemVer visioning, (e.g. > "MAJOR.MINOR.MICRO"), but SPDX 2 only allows "MAJOR.MINOR". For maximum > compatibility, only keep the first two version numbers and discard the > rest which allows it to work with either scheme > > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> > --- > meta/classes/create-spdx-2.2.bbclass | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass > index 99061320e53..6c568d9dbb1 100644 > --- a/meta/classes/create-spdx-2.2.bbclass > +++ b/meta/classes/create-spdx-2.2.bbclass > @@ -417,7 +417,9 @@ python do_create_spdx() { > doc.documentNamespace = get_namespace(d, doc.name) > doc.creationInfo.created = creation_time > doc.creationInfo.comment = "This document was created by analyzing recipe files during the build." > - doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"] > + # Newer versions of the SPDX license list are SemVer ("MAJOR.MINOR.MICRO"), > + # but SPDX 2 only uses "MAJOR.MINOR". > + doc.creationInfo.licenseListVersion = ".".join(d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"].split(".")[:2]) > doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") > doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) > doc.creationInfo.creators.append("Person: N/A ()") > -- > 2.45.2 >
diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass index 99061320e53..6c568d9dbb1 100644 --- a/meta/classes/create-spdx-2.2.bbclass +++ b/meta/classes/create-spdx-2.2.bbclass @@ -417,7 +417,9 @@ python do_create_spdx() { doc.documentNamespace = get_namespace(d, doc.name) doc.creationInfo.created = creation_time doc.creationInfo.comment = "This document was created by analyzing recipe files during the build." - doc.creationInfo.licenseListVersion = d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"] + # Newer versions of the SPDX license list are SemVer ("MAJOR.MINOR.MICRO"), + # but SPDX 2 only uses "MAJOR.MINOR". + doc.creationInfo.licenseListVersion = ".".join(d.getVar("SPDX_LICENSE_DATA")["licenseListVersion"].split(".")[:2]) doc.creationInfo.creators.append("Tool: OpenEmbedded Core create-spdx.bbclass") doc.creationInfo.creators.append("Organization: %s" % d.getVar("SPDX_ORG")) doc.creationInfo.creators.append("Person: N/A ()")
SPDX transitioned the license list to use SemVer visioning, (e.g. "MAJOR.MINOR.MICRO"), but SPDX 2 only allows "MAJOR.MINOR". For maximum compatibility, only keep the first two version numbers and discard the rest which allows it to work with either scheme Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> --- meta/classes/create-spdx-2.2.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)