diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/incompatible_lic.py | 86 |
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 @@ | |||
1 | from oeqa.selftest.case import OESelftestTestCase | 1 | from oeqa.selftest.case import OESelftestTestCase |
2 | from oeqa.utils.commands import bitbake | 2 | from oeqa.utils.commands import bitbake |
3 | 3 | ||
4 | class IncompatibleLicenseTests(OESelftestTestCase): | 4 | class IncompatibleLicenseTestObsolete(OESelftestTestCase): |
5 | 5 | ||
6 | def lic_test(self, pn, pn_lic, lic): | 6 | def lic_test(self, pn, pn_lic, lic, error_msg=None): |
7 | error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has incompatible license(s): %s' % (pn, pn, pn_lic) | 7 | if not error_msg: |
8 | error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has incompatible license(s): %s' % (pn, pn, pn_lic) | ||
8 | 9 | ||
9 | self.write_config("INCOMPATIBLE_LICENSE += \"%s\"" % (lic)) | 10 | self.write_config("INCOMPATIBLE_LICENSE += \"%s\"" % (lic)) |
10 | 11 | ||
@@ -13,68 +14,81 @@ class IncompatibleLicenseTests(OESelftestTestCase): | |||
13 | raise AssertionError(result.output) | 14 | raise AssertionError(result.output) |
14 | 15 | ||
15 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) | 16 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) |
16 | # cannot be built when INCOMPATIBLE_LICENSE contains this SPDX license | ||
17 | def test_incompatible_spdx_license(self): | ||
18 | self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPL-3.0-only') | ||
19 | |||
20 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) | ||
21 | # cannot be built when INCOMPATIBLE_LICENSE contains an alias (in | 17 | # cannot be built when INCOMPATIBLE_LICENSE contains an alias (in |
22 | # SPDXLICENSEMAP) of this SPDX license | 18 | # SPDXLICENSEMAP) of this SPDX license |
23 | def test_incompatible_alias_spdx_license(self): | 19 | def test_incompatible_alias_spdx_license(self): |
24 | self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPLv3') | 20 | self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPLv3', "is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE") |
25 | |||
26 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) | ||
27 | # cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded license | ||
28 | # matching this SPDX license | ||
29 | def test_incompatible_spdx_license_wildcard(self): | ||
30 | self.lic_test('incompatible-license', 'GPL-3.0-only', '*GPL-3.0-only') | ||
31 | 21 | ||
32 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) | 22 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) |
33 | # cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded alias | 23 | # cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded alias |
34 | # license matching this SPDX license | 24 | # license matching this SPDX license |
35 | def test_incompatible_alias_spdx_license_wildcard(self): | 25 | def test_incompatible_alias_spdx_license_wildcard(self): |
36 | self.lic_test('incompatible-license', 'GPL-3.0-only', '*GPLv3') | 26 | self.lic_test('incompatible-license', 'GPL-3.0-only', '*GPLv3', "*GPLv3 is an invalid license wildcard entry") |
37 | |||
38 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX | ||
39 | # license cannot be built when INCOMPATIBLE_LICENSE contains this SPDX | ||
40 | # license | ||
41 | def test_incompatible_spdx_license_alias(self): | ||
42 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPL-3.0-only') | ||
43 | 27 | ||
44 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX | 28 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX |
45 | # license cannot be built when INCOMPATIBLE_LICENSE contains this alias | 29 | # license cannot be built when INCOMPATIBLE_LICENSE contains this alias |
46 | def test_incompatible_alias_spdx_license_alias(self): | 30 | def test_incompatible_alias_spdx_license_alias(self): |
47 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPLv3') | 31 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPLv3', "is an obsolete license, please use an SPDX reference in INCOMPATIBLE_LICENSE") |
48 | 32 | ||
49 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX | 33 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX |
50 | # license cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded | 34 | # license cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded |
51 | # license matching this SPDX license | 35 | # license matching this SPDX license |
52 | def test_incompatible_spdx_license_alias_wildcard(self): | 36 | def test_incompatible_spdx_license_alias_wildcard(self): |
53 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPL-3.0') | 37 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPL-3.0', "*GPL-3.0 is an invalid license wildcard entry") |
54 | 38 | ||
55 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX | 39 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX |
56 | # license cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded | 40 | # license cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded |
57 | # alias license matching the SPDX license | 41 | # alias license matching the SPDX license |
58 | def test_incompatible_alias_spdx_license_alias_wildcard(self): | 42 | def test_incompatible_alias_spdx_license_alias_wildcard(self): |
59 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPLv3') | 43 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', '*GPLv3', "*GPLv3 is an invalid license wildcard entry") |
60 | 44 | ||
61 | # Verify that a package with multiple SPDX licenses (from | ||
62 | # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains | ||
63 | # some of them | ||
64 | def test_incompatible_spdx_licenses(self): | ||
65 | self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', 'GPL-3.0-only LGPL-3.0-only') | ||
66 | 45 | ||
67 | # Verify that a package with multiple SPDX licenses (from | 46 | # Verify that a package with multiple SPDX licenses (from |
68 | # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains a | 47 | # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains a |
69 | # wildcard to some of them | 48 | # wildcard to some of them |
70 | def test_incompatible_spdx_licenses_wildcard(self): | 49 | def test_incompatible_spdx_licenses_wildcard(self): |
71 | self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', '*GPL-3.0-only') | 50 | 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") |
51 | |||
72 | 52 | ||
73 | # Verify that a package with multiple SPDX licenses (from | 53 | # Verify that a package with multiple SPDX licenses (from |
74 | # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains a | 54 | # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains a |
75 | # wildcard matching all licenses | 55 | # wildcard matching all licenses |
76 | def test_incompatible_all_licenses_wildcard(self): | 56 | def test_incompatible_all_licenses_wildcard(self): |
77 | self.lic_test('incompatible-licenses', 'GPL-2.0-only GPL-3.0-only LGPL-3.0-only', '*') | 57 | self.lic_test('incompatible-licenses', 'GPL-2.0-only GPL-3.0-only LGPL-3.0-only', '*', "* is an invalid license wildcard entry") |
58 | |||
59 | class IncompatibleLicenseTests(OESelftestTestCase): | ||
60 | |||
61 | def lic_test(self, pn, pn_lic, lic): | ||
62 | error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has incompatible license(s): %s' % (pn, pn, pn_lic) | ||
63 | |||
64 | self.write_config("INCOMPATIBLE_LICENSE += \"%s\"" % (lic)) | ||
65 | |||
66 | result = bitbake('%s --dry-run' % (pn), ignore_status=True) | ||
67 | if error_msg not in result.output: | ||
68 | raise AssertionError(result.output) | ||
69 | |||
70 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) | ||
71 | # cannot be built when INCOMPATIBLE_LICENSE contains this SPDX license | ||
72 | def test_incompatible_spdx_license(self): | ||
73 | self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPL-3.0-only') | ||
74 | |||
75 | # Verify that a package with an SPDX license (from AVAILABLE_LICENSES) | ||
76 | # cannot be built when INCOMPATIBLE_LICENSE contains a wildcarded license | ||
77 | # matching this SPDX license | ||
78 | def test_incompatible_spdx_license_wildcard(self): | ||
79 | self.lic_test('incompatible-license', 'GPL-3.0-only', 'GPL-3.0*') | ||
80 | |||
81 | # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX | ||
82 | # license cannot be built when INCOMPATIBLE_LICENSE contains this SPDX | ||
83 | # license | ||
84 | def test_incompatible_spdx_license_alias(self): | ||
85 | self.lic_test('incompatible-license-alias', 'GPL-3.0-only', 'GPL-3.0-only') | ||
86 | |||
87 | # Verify that a package with multiple SPDX licenses (from | ||
88 | # AVAILABLE_LICENSES) cannot be built when INCOMPATIBLE_LICENSE contains | ||
89 | # some of them | ||
90 | def test_incompatible_spdx_licenses(self): | ||
91 | self.lic_test('incompatible-licenses', 'GPL-3.0-only LGPL-3.0-only', 'GPL-3.0-only LGPL-3.0-only') | ||
78 | 92 | ||
79 | # Verify that a package with a non-SPDX license (neither in | 93 | # Verify that a package with a non-SPDX license (neither in |
80 | # AVAILABLE_LICENSES nor in SPDXLICENSEMAP) cannot be built when | 94 | # AVAILABLE_LICENSES nor in SPDXLICENSEMAP) cannot be built when |
@@ -86,7 +100,7 @@ class IncompatibleLicensePerImageTests(OESelftestTestCase): | |||
86 | def default_config(self): | 100 | def default_config(self): |
87 | return """ | 101 | return """ |
88 | IMAGE_INSTALL:append = " bash" | 102 | IMAGE_INSTALL:append = " bash" |
89 | INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0" | 103 | INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*" |
90 | """ | 104 | """ |
91 | 105 | ||
92 | def test_bash_default(self): | 106 | def test_bash_default(self): |
@@ -118,15 +132,15 @@ INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0" | |||
118 | class NoGPL3InImagesTests(OESelftestTestCase): | 132 | class NoGPL3InImagesTests(OESelftestTestCase): |
119 | def test_core_image_minimal(self): | 133 | def test_core_image_minimal(self): |
120 | self.write_config(""" | 134 | self.write_config(""" |
121 | INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0 LGPL-3.0" | 135 | INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*" |
122 | """) | 136 | """) |
123 | bitbake('core-image-minimal') | 137 | bitbake('core-image-minimal') |
124 | 138 | ||
125 | def test_core_image_full_cmdline_weston(self): | 139 | def test_core_image_full_cmdline_weston(self): |
126 | self.write_config(""" | 140 | self.write_config(""" |
127 | INHERIT += "testimage" | 141 | INHERIT += "testimage" |
128 | INCOMPATIBLE_LICENSE:pn-core-image-full-cmdline = "GPL-3.0 LGPL-3.0" | 142 | INCOMPATIBLE_LICENSE:pn-core-image-full-cmdline = "GPL-3.0* LGPL-3.0*" |
129 | INCOMPATIBLE_LICENSE:pn-core-image-weston = "GPL-3.0 LGPL-3.0" | 143 | INCOMPATIBLE_LICENSE:pn-core-image-weston = "GPL-3.0* LGPL-3.0*" |
130 | # Settings for full-cmdline | 144 | # Settings for full-cmdline |
131 | 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" | 145 | 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" |
132 | RDEPENDS:packagegroup-core-full-cmdline-dev-utils:remove = "diffutils m4 make patch" | 146 | RDEPENDS:packagegroup-core-full-cmdline-dev-utils:remove = "diffutils m4 make patch" |