]> code.ossystems Code Review - openembedded-core.git/commitdiff
licenses: Fix canonical license for 'or-later' handling
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Feb 2021 15:05:24 +0000 (15:05 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 21 Feb 2021 21:59:52 +0000 (21:59 +0000)
GPLv2 and GPLv2+ are two difference licenses with different meanings
and we can't just pretend they're the same thing. Change the code
to treat them separately.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/license.bbclass
meta/lib/oe/license.py

index dc91118340de8c28bfd630664cad5de1f8ad6b9a..358c716a801e9fb5518d5cc3f6051349bf1152ff 100644 (file)
@@ -252,16 +252,9 @@ def return_spdx(d, license):
 def canonical_license(d, license):
     """
     Return the canonical (SPDX) form of the license if available (so GPLv3
-    becomes GPL-3.0), for the license named 'X+', return canonical form of
-    'X' if available and the tailing '+' (so GPLv3+ becomes GPL-3.0+),
-    or the passed license if there is no canonical form.
+    becomes GPL-3.0) or the passed license if there is no canonical form.
     """
-    lic = d.getVarFlag('SPDXLICENSEMAP', license) or ""
-    if not lic and license.endswith('+'):
-        lic = d.getVarFlag('SPDXLICENSEMAP', license.rstrip('+'))
-        if lic:
-            lic += '+'
-    return lic or license
+    return d.getVarFlag('SPDXLICENSEMAP', license) or license
 
 def available_licenses(d):
     """
index c1274a61decc9fd96d5d8d5b70c65ba14a62eb04..665d32ecbb1a5298011d73204248e5da39fc78fe 100644 (file)
@@ -10,14 +10,7 @@ from fnmatch import fnmatchcase as fnmatch
 def license_ok(license, dont_want_licenses):
     """ Return False if License exist in dont_want_licenses else True """
     for dwl in dont_want_licenses:
-        # If you want to exclude license named generically 'X', we
-        # surely want to exclude 'X+' as well.  In consequence, we
-        # will exclude a trailing '+' character from LICENSE in
-        # case INCOMPATIBLE_LICENSE is not a 'X+' license.
-        lic = license
-        if not re.search(r'\+$', dwl):
-            lic = re.sub(r'\+', '', license)
-        if fnmatch(lic, dwl):
+        if fnmatch(license, dwl):
             return False
     return True