<div dir="ltr">Does this obey the whitelist? Can I whitelist a gplv3 package to get it installed, ideally with a warning rather than silent or error? I don't have the code in front of me at the moment. I have a class in meta-mentor that does this sort of check, so wanted to see how the implementations compare. On a related note, <a href="https://github.com/MentorEmbedded/meta-mentor/blob/master/meta-mentor-common/classes/incompatible-recipe-check.bbclass">https://github.com/MentorEmbedded/meta-mentor/blob/master/meta-mentor-common/classes/incompatible-recipe-check.bbclass</a> + <a href="https://github.com/MentorEmbedded/meta-mentor/blob/95d05dcc12651a7b246f91b240120f92d196b0de/meta-mel-support/recipes-core/packagegroups/packagegroup-tools-benchmark.bb#L10">https://github.com/MentorEmbedded/meta-mentor/blob/95d05dcc12651a7b246f91b240120f92d196b0de/meta-mel-support/recipes-core/packagegroups/packagegroup-tools-benchmark.bb#L10</a> might be of interest to you in your gplv2 work, perhaps? Specifically handling the whitelisting.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2019 at 8:45 AM Alexander Kanavin <<a href="mailto:alex.kanavin@gmail.com">alex.kanavin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The use case is setting INCOMPATIBLE_LICENSE per image,<br>
rather than as an awkward, and too strict global setting.<br>
<br>
This for example would allow building development images with gplv3 tools,<br>
but production images without them, and checking that nothing gpl3-licensed<br>
gets into the latter.<br>
<br>
Examples are provided via the selftest: three scenarios are tested:<br>
<br>
- bash is added to the image, with a default gpl3 license; this is rejected<br>
- bash is added to the image, with a "gpl3 & other" license; this is also rejected<br>
- bash is added to the image, with a "gpl3 | other" license; this is accepted, but<br>
only 'other' is added to the license manifest (this was already handled correctly<br>
previously).<br>
<br>
Eventually, this would allow deprecating the meta-gplv2 layer, while still<br>
enforcing the no-gpl3 rule where possible and needed.<br>
<br>
Signed-off-by: Alexander Kanavin <<a href="mailto:alex.kanavin@gmail.com" target="_blank">alex.kanavin@gmail.com</a>><br>
---<br>
meta/classes/license_image.bbclass | 2 ++<br>
.../oeqa/selftest/cases/incompatible_lic.py | 29 +++++++++++++++++++<br>
2 files changed, 31 insertions(+)<br>
<br>
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass<br>
index 3f102d0fbc3..e5cb1b8c77d 100644<br>
--- a/meta/classes/license_image.bbclass<br>
+++ b/meta/classes/license_image.bbclass<br>
@@ -47,6 +47,8 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):<br>
for pkg in sorted(pkg_dic):<br>
if bad_licenses:<br>
try:<br>
+ if incompatible_pkg_license(d, bad_licenses, pkg_dic[pkg]["LICENSE"]):<br>
+ bb.fatal("Package %s has an incompatible license %s and cannot be installed into the image." %(pkg, pkg_dic[pkg]["LICENSE"]))<br>
(pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \<br>
oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],<br>
bad_licenses, canonical_license, d)<br>
diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py<br>
index 8fb93af8a89..e80c9783122 100644<br>
--- a/meta/lib/oeqa/selftest/cases/incompatible_lic.py<br>
+++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py<br>
@@ -39,3 +39,32 @@ class IncompatibleLicenseTests(OESelftestTestCase):<br>
# INCOMPATIBLE_LICENSE contains this license<br>
def test_incompatible_nonspdx_license(self):<br>
self.lic_test('incompatible-nonspdx-license', 'FooLicense', 'FooLicense')<br>
+<br>
+class IncompatibleLicensePerImageTests(OESelftestTestCase):<br>
+ def default_config(self):<br>
+ return """<br>
+IMAGE_INSTALL_append = "bash"<br>
+INCOMPATIBLE_LICENSE_pn-core-image-minimal = "GPL-3.0 LGPL-3.0"<br>
+"""<br>
+<br>
+ def test_bash_default(self):<br>
+ self.write_config(self.default_config())<br>
+ 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."<br>
+<br>
+ result = bitbake('core-image-minimal', ignore_status=True)<br>
+ if error_msg not in result.output:<br>
+ raise AssertionError(result.output)<br>
+<br>
+ def test_bash_and_license(self):<br>
+ self.write_config(self.default_config() + '\nLICENSE_append_pn-bash = " & SomeLicense"')<br>
+ 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."<br>
+<br>
+ result = bitbake('core-image-minimal', ignore_status=True)<br>
+ if error_msg not in result.output:<br>
+ raise AssertionError(result.output)<br>
+<br>
+ def test_bash_or_license(self):<br>
+ self.write_config(self.default_config() + '\nLICENSE_append_pn-bash = " | SomeLicense"')<br>
+<br>
+ bitbake('core-image-minimal')<br>
+<br>
-- <br>
2.17.1<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Senior Software Engineer, Mentor Graphics</div></div></div></div>