From 65e7056b110410be895e132cd999a3cc09d62742 Mon Sep 17 00:00:00 2001 From: Marc-Etienne Vargenau Date: Thu, 13 Oct 2022 19:26:36 +0200 Subject: [PATCH 1/3] Fixes #1179 Deprecated SPDX license Fixes #1179 Deprecated SPDX license (GFDL* and BSD-2-Clause-NetBSD) Signed-off-by: Marc-Etienne Vargenau --- internal/spdxlicense/generate/license.go | 57 +++++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/internal/spdxlicense/generate/license.go b/internal/spdxlicense/generate/license.go index 196b77bcecd7..efa3a1afd9a1 100644 --- a/internal/spdxlicense/generate/license.go +++ b/internal/spdxlicense/generate/license.go @@ -25,8 +25,61 @@ func (l License) canReplace(other License) bool { return false } - if l.Name != other.Name { - return false + // Some hacks needed until the licenses.json file is updated + // See https://github.com/spdx/license-list-XML/issues/1676 + if (l.Name == "GNU Lesser General Public License v2.1 or later") && (other.Name == "GNU Library General Public License v2.1 or later") { + return true; + } + + if other.ID == "GFDL-1.1" { + return l.ID == "GFDL-1.1-only"; + } + + if other.ID == "GFDL-1.2" { + return l.ID == "GFDL-1.2-only"; + } + + if other.ID == "GFDL-1.3" { + return l.ID == "GFDL-1.3-only"; + } + + if other.ID == "GPL-1.0+" { + return l.ID == "GPL-1.0-or-later"; + } + + if other.ID == "GPL-2.0+" { + return l.ID == "GPL-2.0-or-later"; + } + + if other.ID == "GPL-3.0+" { + return l.ID == "GPL-3.0-or-later"; + } + if other.ID == "LGPL-2.0+" { + return l.ID == "LGPL-2.0-or-later"; + } + + if other.ID == "LGPL-2.1+" { + return l.ID == "LGPL-2.1-or-later"; + } + + if other.ID == "LGPL-3.0+" { + return l.ID == "LGPL-3.0-or-later"; + } + + if (l.ID == "BSD-2-Clause") && (other.ID == "BSD-2-Clause-NetBSD") { + return true; + } + + if (l.ID == "BSD-2-Clause-Views") && (other.ID == "BSD-2-Clause-FreeBSD") { + return true; + } + + if (l.ID == "bzip2-1.0.6") && (other.ID == "bzip2-1.0.5") { + return true; + } + + if l.Name == other.Name { + return true } if l.OSIApproved != other.OSIApproved { From 6529178bc405752b92511a9d3e0a5e73dbbc00a3 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Fri, 14 Oct 2022 11:46:44 -0400 Subject: [PATCH 2/3] feat: map deprecated SPDX licenses to updated counterparts Signed-off-by: Keith Zantow --- internal/spdxlicense/generate/license.go | 72 ++++++------------------ internal/spdxlicense/license_list.go | 50 ++++++++-------- 2 files changed, 43 insertions(+), 79 deletions(-) diff --git a/internal/spdxlicense/generate/license.go b/internal/spdxlicense/generate/license.go index efa3a1afd9a1..74a309cf3ff5 100644 --- a/internal/spdxlicense/generate/license.go +++ b/internal/spdxlicense/generate/license.go @@ -25,61 +25,25 @@ func (l License) canReplace(other License) bool { return false } - // Some hacks needed until the licenses.json file is updated - // See https://github.com/spdx/license-list-XML/issues/1676 - if (l.Name == "GNU Lesser General Public License v2.1 or later") && (other.Name == "GNU Library General Public License v2.1 or later") { - return true; - } - - if other.ID == "GFDL-1.1" { - return l.ID == "GFDL-1.1-only"; - } - - if other.ID == "GFDL-1.2" { - return l.ID == "GFDL-1.2-only"; - } - - if other.ID == "GFDL-1.3" { - return l.ID == "GFDL-1.3-only"; - } - - if other.ID == "GPL-1.0+" { - return l.ID == "GPL-1.0-or-later"; - } - - if other.ID == "GPL-2.0+" { - return l.ID == "GPL-2.0-or-later"; - } - - if other.ID == "GPL-3.0+" { - return l.ID == "GPL-3.0-or-later"; - } - if other.ID == "LGPL-2.0+" { - return l.ID == "LGPL-2.0-or-later"; - } - - if other.ID == "LGPL-2.1+" { - return l.ID == "LGPL-2.1-or-later"; - } - - if other.ID == "LGPL-3.0+" { - return l.ID == "LGPL-3.0-or-later"; - } - - if (l.ID == "BSD-2-Clause") && (other.ID == "BSD-2-Clause-NetBSD") { - return true; - } - - if (l.ID == "BSD-2-Clause-Views") && (other.ID == "BSD-2-Clause-FreeBSD") { - return true; - } - - if (l.ID == "bzip2-1.0.6") && (other.ID == "bzip2-1.0.5") { - return true; + // We want to replace deprecated licenses with non-deprecated counterparts + // For more information, see: https://github.com/spdx/license-list-XML/issues/1676 + if other.Deprecated { + switch { + case strings.ReplaceAll(l.ID, "-only", "") == other.ID: + return true + case strings.ReplaceAll(l.ID, "-or-later", "+") == other.ID: + return true + case l.ID == "BSD-2-Clause" && other.ID == "BSD-2-Clause-NetBSD": + return true + case l.ID == "BSD-2-Clause-Views" && other.ID == "BSD-2-Clause-FreeBSD": + return true + case l.ID == "bzip2-1.0.6" && other.ID == "bzip2-1.0.5": + return true + } } - if l.Name == other.Name { - return true + if l.Name != other.Name { + return false } if l.OSIApproved != other.OSIApproved { @@ -96,7 +60,7 @@ func (l License) canReplace(other License) bool { } } - return l.ID != other.ID + return l.ID == other.ID } func (ll LicenseList) findReplacementLicense(deprecated License) *License { diff --git a/internal/spdxlicense/license_list.go b/internal/spdxlicense/license_list.go index 65c47f4383fa..442ceb89fd3b 100644 --- a/internal/spdxlicense/license_list.go +++ b/internal/spdxlicense/license_list.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// This file was generated by robots at 2022-08-16 13:37:43.053262 -0400 EDT m=+0.183888850 +// This file was generated by robots at 2022-10-14 11:46:16.097525 -0400 EDT m=+0.276930979 // using data from https://spdx.org/licenses/licenses.json package spdxlicense @@ -28,22 +28,22 @@ var licenseIDs = map[string]string{ "afl-3.0": "AFL-3.0", "afl-3.0.0": "AFL-3.0", "afmparse": "Afmparse", - "agpl-1": "AGPL-1.0", + "agpl-1": "AGPL-1.0-only", "agpl-1-only": "AGPL-1.0-only", "agpl-1-or-later": "AGPL-1.0-or-later", - "agpl-1.0": "AGPL-1.0", + "agpl-1.0": "AGPL-1.0-only", "agpl-1.0-only": "AGPL-1.0-only", "agpl-1.0-or-later": "AGPL-1.0-or-later", - "agpl-1.0.0": "AGPL-1.0", + "agpl-1.0.0": "AGPL-1.0-only", "agpl-1.0.0-only": "AGPL-1.0-only", "agpl-1.0.0-or-later": "AGPL-1.0-or-later", - "agpl-3": "AGPL-3.0", + "agpl-3": "AGPL-3.0-only", "agpl-3-only": "AGPL-3.0-only", "agpl-3-or-later": "AGPL-3.0-or-later", - "agpl-3.0": "AGPL-3.0", + "agpl-3.0": "AGPL-3.0-only", "agpl-3.0-only": "AGPL-3.0-only", "agpl-3.0-or-later": "AGPL-3.0-or-later", - "agpl-3.0.0": "AGPL-3.0", + "agpl-3.0.0": "AGPL-3.0-only", "agpl-3.0.0-only": "AGPL-3.0-only", "agpl-3.0.0-or-later": "AGPL-3.0-or-later", "aladdin": "Aladdin", @@ -109,18 +109,18 @@ var licenseIDs = map[string]string{ "bsd-1.0-clause": "BSD-1-Clause", "bsd-1.0.0-clause": "BSD-1-Clause", "bsd-2-clause": "BSD-2-Clause", - "bsd-2-clause-freebsd": "BSD-2-Clause-FreeBSD", - "bsd-2-clause-netbsd": "BSD-2-Clause-NetBSD", + "bsd-2-clause-freebsd": "BSD-2-Clause-Views", + "bsd-2-clause-netbsd": "BSD-2-Clause", "bsd-2-clause-patent": "BSD-2-Clause-Patent", "bsd-2-clause-views": "BSD-2-Clause-Views", "bsd-2.0-clause": "BSD-2-Clause", - "bsd-2.0-clause-freebsd": "BSD-2-Clause-FreeBSD", - "bsd-2.0-clause-netbsd": "BSD-2-Clause-NetBSD", + "bsd-2.0-clause-freebsd": "BSD-2-Clause-Views", + "bsd-2.0-clause-netbsd": "BSD-2-Clause", "bsd-2.0-clause-patent": "BSD-2-Clause-Patent", "bsd-2.0-clause-views": "BSD-2-Clause-Views", "bsd-2.0.0-clause": "BSD-2-Clause", - "bsd-2.0.0-clause-freebsd": "BSD-2-Clause-FreeBSD", - "bsd-2.0.0-clause-netbsd": "BSD-2-Clause-NetBSD", + "bsd-2.0.0-clause-freebsd": "BSD-2-Clause-Views", + "bsd-2.0.0-clause-netbsd": "BSD-2-Clause", "bsd-2.0.0-clause-patent": "BSD-2-Clause-Patent", "bsd-2.0.0-clause-views": "BSD-2-Clause-Views", "bsd-3-clause": "BSD-3-Clause", @@ -170,9 +170,9 @@ var licenseIDs = map[string]string{ "busl-1": "BUSL-1.1", "busl-1.1": "BUSL-1.1", "busl-1.1.0": "BUSL-1.1", - "bzip2-1": "bzip2-1.0.5", - "bzip2-1.0": "bzip2-1.0.5", - "bzip2-1.0.5": "bzip2-1.0.5", + "bzip2-1": "bzip2-1.0.6", + "bzip2-1.0": "bzip2-1.0.6", + "bzip2-1.0.5": "bzip2-1.0.6", "bzip2-1.0.6": "bzip2-1.0.6", "c-uda-1": "C-UDA-1.0", "c-uda-1.0": "C-UDA-1.0", @@ -472,49 +472,49 @@ var licenseIDs = map[string]string{ "fsfullr": "FSFULLR", "ftl": "FTL", "gd": "GD", - "gfdl-1": "GFDL-1.1", + "gfdl-1": "GFDL-1.1-only", "gfdl-1-invariants-only": "GFDL-1.1-invariants-only", "gfdl-1-invariants-or-later": "GFDL-1.1-invariants-or-later", "gfdl-1-no-invariants-only": "GFDL-1.1-no-invariants-only", "gfdl-1-no-invariants-or-later": "GFDL-1.1-no-invariants-or-later", "gfdl-1-only": "GFDL-1.1-only", "gfdl-1-or-later": "GFDL-1.1-or-later", - "gfdl-1.1": "GFDL-1.1", + "gfdl-1.1": "GFDL-1.1-only", "gfdl-1.1-invariants-only": "GFDL-1.1-invariants-only", "gfdl-1.1-invariants-or-later": "GFDL-1.1-invariants-or-later", "gfdl-1.1-no-invariants-only": "GFDL-1.1-no-invariants-only", "gfdl-1.1-no-invariants-or-later": "GFDL-1.1-no-invariants-or-later", "gfdl-1.1-only": "GFDL-1.1-only", "gfdl-1.1-or-later": "GFDL-1.1-or-later", - "gfdl-1.1.0": "GFDL-1.1", + "gfdl-1.1.0": "GFDL-1.1-only", "gfdl-1.1.0-invariants-only": "GFDL-1.1-invariants-only", "gfdl-1.1.0-invariants-or-later": "GFDL-1.1-invariants-or-later", "gfdl-1.1.0-no-invariants-only": "GFDL-1.1-no-invariants-only", "gfdl-1.1.0-no-invariants-or-later": "GFDL-1.1-no-invariants-or-later", "gfdl-1.1.0-only": "GFDL-1.1-only", "gfdl-1.1.0-or-later": "GFDL-1.1-or-later", - "gfdl-1.2": "GFDL-1.2", + "gfdl-1.2": "GFDL-1.2-only", "gfdl-1.2-invariants-only": "GFDL-1.2-invariants-only", "gfdl-1.2-invariants-or-later": "GFDL-1.2-invariants-or-later", "gfdl-1.2-no-invariants-only": "GFDL-1.2-no-invariants-only", "gfdl-1.2-no-invariants-or-later": "GFDL-1.2-no-invariants-or-later", "gfdl-1.2-only": "GFDL-1.2-only", "gfdl-1.2-or-later": "GFDL-1.2-or-later", - "gfdl-1.2.0": "GFDL-1.2", + "gfdl-1.2.0": "GFDL-1.2-only", "gfdl-1.2.0-invariants-only": "GFDL-1.2-invariants-only", "gfdl-1.2.0-invariants-or-later": "GFDL-1.2-invariants-or-later", "gfdl-1.2.0-no-invariants-only": "GFDL-1.2-no-invariants-only", "gfdl-1.2.0-no-invariants-or-later": "GFDL-1.2-no-invariants-or-later", "gfdl-1.2.0-only": "GFDL-1.2-only", "gfdl-1.2.0-or-later": "GFDL-1.2-or-later", - "gfdl-1.3": "GFDL-1.3", + "gfdl-1.3": "GFDL-1.3-only", "gfdl-1.3-invariants-only": "GFDL-1.3-invariants-only", "gfdl-1.3-invariants-or-later": "GFDL-1.3-invariants-or-later", "gfdl-1.3-no-invariants-only": "GFDL-1.3-no-invariants-only", "gfdl-1.3-no-invariants-or-later": "GFDL-1.3-no-invariants-or-later", "gfdl-1.3-only": "GFDL-1.3-only", "gfdl-1.3-or-later": "GFDL-1.3-or-later", - "gfdl-1.3.0": "GFDL-1.3", + "gfdl-1.3.0": "GFDL-1.3-only", "gfdl-1.3.0-invariants-only": "GFDL-1.3-invariants-only", "gfdl-1.3.0-invariants-or-later": "GFDL-1.3-invariants-or-later", "gfdl-1.3.0-no-invariants-only": "GFDL-1.3-no-invariants-only", @@ -637,11 +637,11 @@ var licenseIDs = map[string]string{ "lgpl-2.0.0-only": "LGPL-2.0-only", "lgpl-2.0.0-or-later": "LGPL-2.0-or-later", "lgpl-2.1": "LGPL-2.1-only", - "lgpl-2.1+": "LGPL-2.1+", + "lgpl-2.1+": "LGPL-2.1-or-later", "lgpl-2.1-only": "LGPL-2.1-only", "lgpl-2.1-or-later": "LGPL-2.1-or-later", "lgpl-2.1.0": "LGPL-2.1-only", - "lgpl-2.1.0+": "LGPL-2.1+", + "lgpl-2.1.0+": "LGPL-2.1-or-later", "lgpl-2.1.0-only": "LGPL-2.1-only", "lgpl-2.1.0-or-later": "LGPL-2.1-or-later", "lgpl-3": "LGPL-3.0-only", From a56f14581f631b33ed9cde3fa2d8814e0fdf363b Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Fri, 14 Oct 2022 12:29:22 -0400 Subject: [PATCH 3/3] chore: update tests Signed-off-by: Keith Zantow --- .../generate/generate_license_list_test.go | 72 +++++++++---------- internal/spdxlicense/generate/license_test.go | 8 ++- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/internal/spdxlicense/generate/generate_license_list_test.go b/internal/spdxlicense/generate/generate_license_list_test.go index 08a4ae33763f..16daea031bb4 100644 --- a/internal/spdxlicense/generate/generate_license_list_test.go +++ b/internal/spdxlicense/generate/generate_license_list_test.go @@ -22,18 +22,18 @@ func TestReplaceDeprecatedLicenses(t *testing.T) { } expected := map[string]string{ - "abc-1": "ABC-1.0-Only", - "abc-1-only": "ABC-1.0-Only", - "abc-1.0": "ABC-1.0-Only", - "abc-1.0.0": "ABC-1.0-Only", - "abc-1.0-only": "ABC-1.0-Only", - "abc-1.0.0-only": "ABC-1.0-Only", - "abc-1+": "ABC-1.0-Or-later", - "abc-1.0+": "ABC-1.0-Or-later", - "abc-1.0.0+": "ABC-1.0-Or-later", - "abc-1-or-later": "ABC-1.0-Or-later", - "abc-1.0-or-later": "ABC-1.0-Or-later", - "abc-1.0.0-or-later": "ABC-1.0-Or-later", + "abc-1": "ABC-1.0-only", + "abc-1-only": "ABC-1.0-only", + "abc-1.0": "ABC-1.0-only", + "abc-1.0.0": "ABC-1.0-only", + "abc-1.0-only": "ABC-1.0-only", + "abc-1.0.0-only": "ABC-1.0-only", + "abc-1+": "ABC-1.0-or-later", + "abc-1.0+": "ABC-1.0-or-later", + "abc-1.0.0+": "ABC-1.0-or-later", + "abc-1-or-later": "ABC-1.0-or-later", + "abc-1.0-or-later": "ABC-1.0-or-later", + "abc-1.0.0-or-later": "ABC-1.0-or-later", "duh-1": "Duh-1.0", "duh-1.0": "Duh-1.0", "duh-1.0.0": "Duh-1.0", @@ -79,22 +79,22 @@ func Test_processSPDXLicense(t *testing.T) { "afl-3.0": "AFL-3.0", "afl-3.0.0": "AFL-3.0", "afmparse": "Afmparse", - "agpl-1": "AGPL-1.0", + "agpl-1": "AGPL-1.0-only", "agpl-1-only": "AGPL-1.0-only", "agpl-1-or-later": "AGPL-1.0-or-later", - "agpl-1.0": "AGPL-1.0", + "agpl-1.0": "AGPL-1.0-only", "agpl-1.0-only": "AGPL-1.0-only", "agpl-1.0-or-later": "AGPL-1.0-or-later", - "agpl-1.0.0": "AGPL-1.0", + "agpl-1.0.0": "AGPL-1.0-only", "agpl-1.0.0-only": "AGPL-1.0-only", "agpl-1.0.0-or-later": "AGPL-1.0-or-later", - "agpl-3": "AGPL-3.0", + "agpl-3": "AGPL-3.0-only", "agpl-3-only": "AGPL-3.0-only", "agpl-3-or-later": "AGPL-3.0-or-later", - "agpl-3.0": "AGPL-3.0", + "agpl-3.0": "AGPL-3.0-only", "agpl-3.0-only": "AGPL-3.0-only", "agpl-3.0-or-later": "AGPL-3.0-or-later", - "agpl-3.0.0": "AGPL-3.0", + "agpl-3.0.0": "AGPL-3.0-only", "agpl-3.0.0-only": "AGPL-3.0-only", "agpl-3.0.0-or-later": "AGPL-3.0-or-later", "aladdin": "Aladdin", @@ -160,18 +160,18 @@ func Test_processSPDXLicense(t *testing.T) { "bsd-1.0-clause": "BSD-1-Clause", "bsd-1.0.0-clause": "BSD-1-Clause", "bsd-2-clause": "BSD-2-Clause", - "bsd-2-clause-freebsd": "BSD-2-Clause-FreeBSD", - "bsd-2-clause-netbsd": "BSD-2-Clause-NetBSD", + "bsd-2-clause-freebsd": "BSD-2-Clause-Views", + "bsd-2-clause-netbsd": "BSD-2-Clause", "bsd-2-clause-patent": "BSD-2-Clause-Patent", "bsd-2-clause-views": "BSD-2-Clause-Views", "bsd-2.0-clause": "BSD-2-Clause", - "bsd-2.0-clause-freebsd": "BSD-2-Clause-FreeBSD", - "bsd-2.0-clause-netbsd": "BSD-2-Clause-NetBSD", + "bsd-2.0-clause-freebsd": "BSD-2-Clause-Views", + "bsd-2.0-clause-netbsd": "BSD-2-Clause", "bsd-2.0-clause-patent": "BSD-2-Clause-Patent", "bsd-2.0-clause-views": "BSD-2-Clause-Views", "bsd-2.0.0-clause": "BSD-2-Clause", - "bsd-2.0.0-clause-freebsd": "BSD-2-Clause-FreeBSD", - "bsd-2.0.0-clause-netbsd": "BSD-2-Clause-NetBSD", + "bsd-2.0.0-clause-freebsd": "BSD-2-Clause-Views", + "bsd-2.0.0-clause-netbsd": "BSD-2-Clause", "bsd-2.0.0-clause-patent": "BSD-2-Clause-Patent", "bsd-2.0.0-clause-views": "BSD-2-Clause-Views", "bsd-3-clause": "BSD-3-Clause", @@ -221,9 +221,9 @@ func Test_processSPDXLicense(t *testing.T) { "busl-1": "BUSL-1.1", "busl-1.1": "BUSL-1.1", "busl-1.1.0": "BUSL-1.1", - "bzip2-1": "bzip2-1.0.5", - "bzip2-1.0": "bzip2-1.0.5", - "bzip2-1.0.5": "bzip2-1.0.5", + "bzip2-1": "bzip2-1.0.6", + "bzip2-1.0": "bzip2-1.0.6", + "bzip2-1.0.5": "bzip2-1.0.6", "bzip2-1.0.6": "bzip2-1.0.6", "c-uda-1": "C-UDA-1.0", "c-uda-1.0": "C-UDA-1.0", @@ -520,49 +520,49 @@ func Test_processSPDXLicense(t *testing.T) { "fsfullr": "FSFULLR", "ftl": "FTL", "gd": "GD", - "gfdl-1": "GFDL-1.1", + "gfdl-1": "GFDL-1.1-only", "gfdl-1-invariants-only": "GFDL-1.1-invariants-only", "gfdl-1-invariants-or-later": "GFDL-1.1-invariants-or-later", "gfdl-1-no-invariants-only": "GFDL-1.1-no-invariants-only", "gfdl-1-no-invariants-or-later": "GFDL-1.1-no-invariants-or-later", "gfdl-1-only": "GFDL-1.1-only", "gfdl-1-or-later": "GFDL-1.1-or-later", - "gfdl-1.1": "GFDL-1.1", + "gfdl-1.1": "GFDL-1.1-only", "gfdl-1.1-invariants-only": "GFDL-1.1-invariants-only", "gfdl-1.1-invariants-or-later": "GFDL-1.1-invariants-or-later", "gfdl-1.1-no-invariants-only": "GFDL-1.1-no-invariants-only", "gfdl-1.1-no-invariants-or-later": "GFDL-1.1-no-invariants-or-later", "gfdl-1.1-only": "GFDL-1.1-only", "gfdl-1.1-or-later": "GFDL-1.1-or-later", - "gfdl-1.1.0": "GFDL-1.1", + "gfdl-1.1.0": "GFDL-1.1-only", "gfdl-1.1.0-invariants-only": "GFDL-1.1-invariants-only", "gfdl-1.1.0-invariants-or-later": "GFDL-1.1-invariants-or-later", "gfdl-1.1.0-no-invariants-only": "GFDL-1.1-no-invariants-only", "gfdl-1.1.0-no-invariants-or-later": "GFDL-1.1-no-invariants-or-later", "gfdl-1.1.0-only": "GFDL-1.1-only", "gfdl-1.1.0-or-later": "GFDL-1.1-or-later", - "gfdl-1.2": "GFDL-1.2", + "gfdl-1.2": "GFDL-1.2-only", "gfdl-1.2-invariants-only": "GFDL-1.2-invariants-only", "gfdl-1.2-invariants-or-later": "GFDL-1.2-invariants-or-later", "gfdl-1.2-no-invariants-only": "GFDL-1.2-no-invariants-only", "gfdl-1.2-no-invariants-or-later": "GFDL-1.2-no-invariants-or-later", "gfdl-1.2-only": "GFDL-1.2-only", "gfdl-1.2-or-later": "GFDL-1.2-or-later", - "gfdl-1.2.0": "GFDL-1.2", + "gfdl-1.2.0": "GFDL-1.2-only", "gfdl-1.2.0-invariants-only": "GFDL-1.2-invariants-only", "gfdl-1.2.0-invariants-or-later": "GFDL-1.2-invariants-or-later", "gfdl-1.2.0-no-invariants-only": "GFDL-1.2-no-invariants-only", "gfdl-1.2.0-no-invariants-or-later": "GFDL-1.2-no-invariants-or-later", "gfdl-1.2.0-only": "GFDL-1.2-only", "gfdl-1.2.0-or-later": "GFDL-1.2-or-later", - "gfdl-1.3": "GFDL-1.3", + "gfdl-1.3": "GFDL-1.3-only", "gfdl-1.3-invariants-only": "GFDL-1.3-invariants-only", "gfdl-1.3-invariants-or-later": "GFDL-1.3-invariants-or-later", "gfdl-1.3-no-invariants-only": "GFDL-1.3-no-invariants-only", "gfdl-1.3-no-invariants-or-later": "GFDL-1.3-no-invariants-or-later", "gfdl-1.3-only": "GFDL-1.3-only", "gfdl-1.3-or-later": "GFDL-1.3-or-later", - "gfdl-1.3.0": "GFDL-1.3", + "gfdl-1.3.0": "GFDL-1.3-only", "gfdl-1.3.0-invariants-only": "GFDL-1.3-invariants-only", "gfdl-1.3.0-invariants-or-later": "GFDL-1.3-invariants-or-later", "gfdl-1.3.0-no-invariants-only": "GFDL-1.3-no-invariants-only", @@ -686,11 +686,11 @@ func Test_processSPDXLicense(t *testing.T) { "lgpl-2.0.0-only": "LGPL-2.0-only", "lgpl-2.0.0-or-later": "LGPL-2.0-or-later", "lgpl-2.1": "LGPL-2.1-only", - "lgpl-2.1+": "LGPL-2.1+", + "lgpl-2.1+": "LGPL-2.1-or-later", "lgpl-2.1-only": "LGPL-2.1-only", "lgpl-2.1-or-later": "LGPL-2.1-or-later", "lgpl-2.1.0": "LGPL-2.1-only", - "lgpl-2.1.0+": "LGPL-2.1+", + "lgpl-2.1.0+": "LGPL-2.1-or-later", "lgpl-2.1.0-only": "LGPL-2.1-only", "lgpl-2.1.0-or-later": "LGPL-2.1-or-later", "lgpl-3": "LGPL-3.0-only", diff --git a/internal/spdxlicense/generate/license_test.go b/internal/spdxlicense/generate/license_test.go index 81de2406d7d5..02754630bbe4 100644 --- a/internal/spdxlicense/generate/license_test.go +++ b/internal/spdxlicense/generate/license_test.go @@ -15,7 +15,7 @@ var ( } license2 = License{ - ID: "ABC-1.0-Or-later", + ID: "ABC-1.0-or-later", Name: "The ABC License 1.0", } @@ -26,7 +26,7 @@ var ( } license4 = License{ - ID: "ABC-1.0-Only", + ID: "ABC-1.0-only", Name: "The ABC License 1.0 Only", } license5 = License{ @@ -53,7 +53,9 @@ func TestLicense_canReplace(t *testing.T) { } for _, tt := range tests { - assert.Equal(t, tt.expected, tt.l1.canReplace(tt.l2)) + t.Run(tt.l1.ID+" - "+tt.l2.ID, func(t *testing.T) { + assert.Equal(t, tt.expected, tt.l1.canReplace(tt.l2)) + }) } }