summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2022-02-23 17:26:59 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 18:43:25 +0000
commitd6449581c998a24145e527c571b3baf90a9f2518 (patch)
treef20a0fd2e91dd9fb294e5243f28b1533fc8ec21c /meta/lib
parent9ead8e762e977d41b0107553b4827f9a7edc252f (diff)
downloadpoky-d6449581c998a24145e527c571b3baf90a9f2518.tar.gz
base/license: Rework INCOMPATIBLE_LICENSE variable handling
This re-writes the INCOMPATIBLE_LICENSE checking code to replace the WHITELIST_<lic> with INCOMPATIBLE_LICENSE_EXCEPTIONS = '<pkg>:<lic> <pkg>:<lic> ...' This initial change leaves most of the code structure in place, but the code in base.bbclass needs to be re-written to make the check more consistent around packages (PKGS) and not recipe names (PN). This also is taking into account the changes for SPDX licenses. The aim is to provide a mode consistent variable where the variable name is known and can easily be queried. (From OE-Core rev: 0d19c45ba6cf43518f380ca5afe9753a2eda0691) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/license.py5
-rw-r--r--meta/lib/oeqa/selftest/cases/incompatible_lic.py4
2 files changed, 7 insertions, 2 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 8955cbdeb2..29412dfe46 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -242,3 +242,8 @@ def list_licenses(licensestr):
242 except SyntaxError as exc: 242 except SyntaxError as exc:
243 raise LicenseSyntaxError(licensestr, exc) 243 raise LicenseSyntaxError(licensestr, exc)
244 return visitor.licenses 244 return visitor.licenses
245
246def apply_pkg_license_exception(pkg, bad_licenses, exceptions):
247 """Return remaining bad licenses after removing any package exceptions"""
248
249 return [lic for lic in bad_licenses if pkg + ':' + lic not in exceptions]
diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
index fd3b3f409e..c68f920555 100644
--- a/meta/lib/oeqa/selftest/cases/incompatible_lic.py
+++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
@@ -110,8 +110,8 @@ INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0"
110 110
111 bitbake('core-image-minimal') 111 bitbake('core-image-minimal')
112 112
113 def test_bash_whitelist(self): 113 def test_bash_license_exceptions(self):
114 self.write_config(self.default_config() + '\nWHITELIST_GPL-3.0:pn-core-image-minimal = "bash"') 114 self.write_config(self.default_config() + '\nINCOMPATIBLE_LICENSE_EXCEPTIONS:pn-core-image-minimal = "bash:GPL-3.0-or-later"')
115 115
116 bitbake('core-image-minimal') 116 bitbake('core-image-minimal')
117 117