summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-28 15:40:32 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 18:41:52 +0000
commit724fc8047cae6ed6197d7deca887b1594871c90e (patch)
treeeff7ec37e59600d4fa0a3dea6e4910181e916d52 /meta/lib/oeqa
parent9379f80f484f94686a4d494e9e237fadfb72a938 (diff)
downloadopenembedded-core-contrib-724fc8047cae6ed6197d7deca887b1594871c90e.tar.gz
license: Rework INCOMPATIBLE_LICENSE wildcard handling
The current wildcard handling is badly documented and inconsistently used and understood. Forcing users to have to use "GPL-3.0-only GPL-3.0-or-later" whilst explict is not very user friendly. Equally, using the current wildcards is ambigious. This supports pre-defined expansions only and at least makes it clear what GPL-3.0* means (it doesn't include the exception licenses). This is hopefully an acceptable compromise between literal meaning and having something usable. Non-SPDX forms of license in this field have been dropped and errors are shown for unsupported expansions and unsupported old style license terms. Users need to carefully consider how to migrate to the new syntax but the meaning should be well defined and clear from here forward. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/incompatible_lic.py86
1 files changed, 50 insertions, 36 deletions
diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
index c68f920555..0794d46e6d 100644
--- a/meta/lib/oeqa/selftest/cases/incompatible_lic.py
+++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
@@ -1,10 +1,11 @@
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import bitbake
-class IncompatibleLicenseTests(OESelftestTestCase):
+class IncompatibleLicenseTestObsolete(OESelftestTestCase):
- def lic_test(self, pn, pn_lic, lic):
- error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has incompatible license(s): %s' % (pn, pn, pn_lic)
+ def lic_test(self, pn, pn_lic, lic, error_msg=None):
+ if not error_msg:
+ error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has incompatible license(s): %s' % (pn, pn, pn_lic)
self.write_config("INCOMPATIBLE_LICENSE += \"%s\"" % (lic))
@@ -13,68 +14,81 @@ class IncompatibleLicenseTests(OESelftestTestCase):
raise AssertionError(result.output)
# Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
- # cannot be built when INCOMPATIBLE_LICENSE contains this SPDX license
- def test_incompatible_spdx_license(self):
- self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPL-3.0-only')
-
- # Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
# cannot be built when INCOMPATIBLE_LICENSE contains an alias (in
# SPDXLICENSEMAP) of this SPDX license
def test_incompatible_alias_spdx_license(self):
- self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPLv3')
-
- # Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
- # cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded license
- # matching this SPDX license
- def test_incompatible_spdx_license_wildcard(self):
- self.lic_test('incompatible-license', 'GPL-3.0-only', '*GPL-3.0-only')
+ self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPLv3', "is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE")
# Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
# cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded alias
# license matching this SPDX license
def test_incompatible_alias_spdx_license_wildcard(self):
- self.lic_test('incompatible-license', 'GPL-3.0-only', '*GPLv3')
-
- # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
- # license cannot be built when INCOMPATIBLE_LICENSE contains this SPDX
- # license
- def test_incompatible_spdx_license_alias(self):
- self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPL-3.0-only')
+ self.lic_test('incompatible-license', 'GPL-3.0-only', '*GPLv3', "*GPLv3 is an invalid license wildcard entry")
# Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
# license cannot be built when INCOMPATIBLE_LICENSE contains this alias
def test_incompatible_alias_spdx_license_alias(self):
- self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPLv3')
+ self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPLv3', "is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE")
# Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
# license cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded
# license matching this SPDX license
def test_incompatible_spdx_license_alias_wildcard(self):
- self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPL-3.0')
+ self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPL-3.0', "*GPL-3.0 is an invalid license wildcard entry")
# Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
# license cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded
# alias license matching the SPDX license
def test_incompatible_alias_spdx_license_alias_wildcard(self):
- self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPLv3')
+ self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPLv3', "*GPLv3 is an invalid license wildcard entry")
- # Verify that a package with multiple SPDX licenses (from
- # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains
- # some of them
- def test_incompatible_spdx_licenses(self):
- self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', 'GPL-3.0-only LGPL-3.0-only')
# Verify that a package with multiple SPDX licenses (from
# AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains a
# wildcard to some of them
def test_incompatible_spdx_licenses_wildcard(self):
- self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', '*GPL-3.0-only')
+ self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', '*GPL-3.0-only', "*GPL-3.0-only is an invalid license wildcard entry")
+
# Verify that a package with multiple SPDX licenses (from
# AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains a
# wildcard matching all licenses
def test_incompatible_all_licenses_wildcard(self):
- self.lic_test('incompatible-licenses', 'GPL-2.0-only GPL-3.0-only LGPL-3.0-only', '*')
+ self.lic_test('incompatible-licenses', 'GPL-2.0-only GPL-3.0-only LGPL-3.0-only', '*', "* is an invalid license wildcard entry")
+
+class IncompatibleLicenseTests(OESelftestTestCase):
+
+ def lic_test(self, pn, pn_lic, lic):
+ error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has incompatible license(s): %s' % (pn, pn, pn_lic)
+
+ self.write_config("INCOMPATIBLE_LICENSE += \"%s\"" % (lic))
+
+ result = bitbake('%s --dry-run' % (pn), ignore_status=True)
+ if error_msg not in result.output:
+ raise AssertionError(result.output)
+
+ # Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
+ # cannot be built when INCOMPATIBLE_LICENSE contains this SPDX license
+ def test_incompatible_spdx_license(self):
+ self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPL-3.0-only')
+
+ # Verify that a package with an SPDX license (from AVAILABLE_LICENSES)
+ # cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded license
+ # matching this SPDX license
+ def test_incompatible_spdx_license_wildcard(self):
+ self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPL-3.0*')
+
+ # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
+ # license cannot be built when INCOMPATIBLE_LICENSE contains this SPDX
+ # license
+ def test_incompatible_spdx_license_alias(self):
+ self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPL-3.0-only')
+
+ # Verify that a package with multiple SPDX licenses (from
+ # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains
+ # some of them
+ def test_incompatible_spdx_licenses(self):
+ self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', 'GPL-3.0-only LGPL-3.0-only')
# Verify that a package with a non-SPDX license (neither in
# AVAILABLE_LICENSES nor in SPDXLICENSEMAP) cannot be built when
@@ -86,7 +100,7 @@ class IncompatibleLicensePerImageTests(OESelftestTestCase):
def default_config(self):
return """
IMAGE_INSTALL:append = " bash"
-INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0"
+INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*"
"""
def test_bash_default(self):
@@ -118,15 +132,15 @@ INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0"
class NoGPL3InImagesTests(OESelftestTestCase):
def test_core_image_minimal(self):
self.write_config("""
-INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0"
+INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*"
""")
bitbake('core-image-minimal')
def test_core_image_full_cmdline_weston(self):
self.write_config("""
INHERIT += "testimage"
-INCOMPATIBLE_LICENSE:pn-core-image-full-cmdline = "GPL-3.0 LGPL-3.0"
-INCOMPATIBLE_LICENSE:pn-core-image-weston = "GPL-3.0 LGPL-3.0"
+INCOMPATIBLE_LICENSE:pn-core-image-full-cmdline = "GPL-3.0* LGPL-3.0*"
+INCOMPATIBLE_LICENSE:pn-core-image-weston = "GPL-3.0* LGPL-3.0*"
# Settings for full-cmdline
RDEPENDS:packagegroup-core-full-cmdline-utils:remove = "bash bc coreutils cpio ed findutils gawk grep mc mc-fish mc-helpers mc-helpers-perl sed tar time"
RDEPENDS:packagegroup-core-full-cmdline-dev-utils:remove = "diffutils m4 make patch"