[oe-commits] [openembedded-core] 07/10: selftests: add tests for INCOMPATIBLE_LICENSE

git at git.openembedded.org git at git.openembedded.org
Wed Jun 12 09:58:45 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 6c2ca52218c196e7ccf6b3275bffc3e3a04193c6
Author: Quentin Schulz <quentin.schulz at streamunlimited.com>
AuthorDate: Tue Jun 11 17:11:20 2019 +0200

    selftests: add tests for INCOMPATIBLE_LICENSE
    
    One bug went unnoticed without these selftests: an INCOMPATIBLE_LICENSE
    with a non-SPDX license for a package with that non-SPDX license wasn't
    enforcing the denial of build for said package. See
    4b6ce4604cc15e289a48f8586d58a101b7a70b52 ("meta: license: fix non-SPDX
    license being removed from INCOMPATIBLE_LICENSE")
    
    While adding a test for that particular case, let's add a few more so
    that we cover a handful more use cases of INCOMPATIBLE_LICENSE.
    
    Signed-off-by: Quentin Schulz <quentin.schulz at streamunlimited.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 .../license/incompatible-license-alias.bb          |  3 ++
 .../recipes-test/license/incompatible-license.bb   |  3 ++
 .../license/incompatible-nonspdx-license.bb        |  3 ++
 meta/lib/oeqa/selftest/cases/incompatible_lic.py   | 41 ++++++++++++++++++++++
 4 files changed, 50 insertions(+)

diff --git a/meta-selftest/recipes-test/license/incompatible-license-alias.bb b/meta-selftest/recipes-test/license/incompatible-license-alias.bb
new file mode 100644
index 0000000..e0b4e13
--- /dev/null
+++ b/meta-selftest/recipes-test/license/incompatible-license-alias.bb
@@ -0,0 +1,3 @@
+SUMMARY = "Recipe with an alias of an SPDX license"
+DESCRIPTION = "Is licensed with an alias of an SPDX license to be used for testing"
+LICENSE = "GPLv3"
diff --git a/meta-selftest/recipes-test/license/incompatible-license.bb b/meta-selftest/recipes-test/license/incompatible-license.bb
new file mode 100644
index 0000000..1728ad7
--- /dev/null
+++ b/meta-selftest/recipes-test/license/incompatible-license.bb
@@ -0,0 +1,3 @@
+SUMMARY = "Recipe with an SPDX license"
+DESCRIPTION = "Is licensed with an SPDX license to be used for testing"
+LICENSE = "GPL-3.0"
diff --git a/meta-selftest/recipes-test/license/incompatible-nonspdx-license.bb b/meta-selftest/recipes-test/license/incompatible-nonspdx-license.bb
new file mode 100644
index 0000000..35af096
--- /dev/null
+++ b/meta-selftest/recipes-test/license/incompatible-nonspdx-license.bb
@@ -0,0 +1,3 @@
+SUMMARY = "Recipe with a non-SPDX license"
+DESCRIPTION = "Is licensed with a non-SPDX license to be used for testing"
+LICENSE = "FooLicense"
diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
new file mode 100644
index 0000000..8fb93af
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
@@ -0,0 +1,41 @@
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake
+
+class IncompatibleLicenseTests(OESelftestTestCase):
+
+    def lic_test(self, pn, pn_lic, lic):
+        error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has an incompatible license: %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 SRC_DISTRIBUTE_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', 'GPL-3.0')
+
+    # Verify that a package with an SPDX license (from SRC_DISTRIBUTE_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', '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', 'GPLv3', 'GPL-3.0')
+
+    # 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', 'GPLv3', 'GPLv3')
+
+    # Verify that a package with a non-SPDX license (neither in
+    # SRC_DISTRIBUTE_LICENSES nor in SPDXLICENSEMAP) cannot be built when
+    # INCOMPATIBLE_LICENSE contains this license
+    def test_incompatible_nonspdx_license(self):
+        self.lic_test('incompatible-nonspdx-license', 'FooLicense', 'FooLicense')

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list