summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/incompatible_lic.py
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2019-10-10 13:18:48 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-10 16:55:54 +0100
commitfd50395bc0783a3cce7b5b0d7398f22783ebbeca (patch)
treeb6db78f4d15103eb011b491c798daf8c5858d2ad /meta/lib/oeqa/selftest/cases/incompatible_lic.py
parent8a0f342e4fc33b1aa53089b1de583d45d2951476 (diff)
downloadopenembedded-core-fd50395bc0783a3cce7b5b0d7398f22783ebbeca.tar.gz
license_image.bbclass: check and reject packages which have incompatible licenses
The use case is setting INCOMPATIBLE_LICENSE per image, rather than as an awkward, and too strict global setting. This for example would allow building development images with gplv3 tools, but production images without them, and checking that nothing gpl3-licensed gets into the latter. Examples are provided via the selftest: four scenarios are tested: - bash is added to the image, with a default gpl3 license; this is rejected - bash is added to the image, with a "gpl3 & other" license; this is also rejected - bash is added to the image, with a "gpl3 | other" license; this is accepted, but only 'other' is added to the license manifest (this was already handled correctly previously). - bash is added to the image with a default gpl3 license, and is additionally whitelisted for that image; this is accepted. Eventually, this would allow deprecating the meta-gplv2 layer, while still enforcing the no-gpl3 rule where possible and needed. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/incompatible_lic.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/incompatible_lic.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
index 8fb93af8a8..424a9e69c3 100644
--- a/meta/lib/oeqa/selftest/cases/incompatible_lic.py
+++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
@@ -39,3 +39,37 @@ class IncompatibleLicenseTests(OESelftestTestCase):
# INCOMPATIBLE_LICENSE contains this license
def test_incompatible_nonspdx_license(self):
self.lic_test('incompatible-nonspdx-license', 'FooLicense', 'FooLicense')
+
+class IncompatibleLicensePerImageTests(OESelftestTestCase):
+ def default_config(self):
+ return """
+IMAGE_INSTALL_append = "bash"
+INCOMPATIBLE_LICENSE_pn-core-image-minimal = "GPL-3.0 LGPL-3.0"
+"""
+
+ def test_bash_default(self):
+ self.write_config(self.default_config())
+ error_msg = "ERROR: core-image-minimal-1.0-r0 do_rootfs: Package bash has an incompatible license GPLv3+ and cannot be installed into the image."
+
+ result = bitbake('core-image-minimal', ignore_status=True)
+ if error_msg not in result.output:
+ raise AssertionError(result.output)
+
+ def test_bash_and_license(self):
+ self.write_config(self.default_config() + '\nLICENSE_append_pn-bash = " & SomeLicense"')
+ error_msg = "ERROR: core-image-minimal-1.0-r0 do_rootfs: Package bash has an incompatible license GPLv3+ & SomeLicense and cannot be installed into the image."
+
+ result = bitbake('core-image-minimal', ignore_status=True)
+ if error_msg not in result.output:
+ raise AssertionError(result.output)
+
+ def test_bash_or_license(self):
+ self.write_config(self.default_config() + '\nLICENSE_append_pn-bash = " | SomeLicense"')
+
+ bitbake('core-image-minimal')
+
+ def test_bash_whitelist(self):
+ self.write_config(self.default_config() + '\nWHITELIST_GPL-3.0_pn-core-image-minimal = "bash"')
+
+ bitbake('core-image-minimal')
+