Openembedded Core Discussions
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] license.bbclass: split incompatible license check into a helper function
@ 2019-10-09 14:44 Alexander Kanavin
  2019-10-09 14:44 ` [RFC PATCH 2/2] license_image.bbclass: check and reject packages which have incompatible licenses Alexander Kanavin
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Kanavin @ 2019-10-09 14:44 UTC (permalink / raw)
  To: openembedded-core

This would help with checking incompatible licenses at do_rootfs step
in image creation, where it is beneficial to pass the license string
directly to the function.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 meta/classes/license.bbclass | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index adca881c85b..648a4d78922 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -287,17 +287,7 @@ def incompatible_license_contains(license, truevalue, falsevalue, d):
     bad_licenses = expand_wildcard_licenses(d, bad_licenses)
     return truevalue if license in bad_licenses else falsevalue
 
-def incompatible_license(d, dont_want_licenses, package=None):
-    """
-    This function checks if a recipe has only incompatible licenses. It also
-    take into consideration 'or' operand.  dont_want_licenses should be passed
-    as canonical (SPDX) names.
-    """
-    import oe.license
-    license = d.getVar("LICENSE_%s" % package) if package else None
-    if not license:
-        license = d.getVar('LICENSE')
-
+def incompatible_pkg_license(d, dont_want_licenses, license):
     # Handles an "or" or two license sets provided by
     # flattened_licenses(), pick one that works if possible.
     def choose_lic_set(a, b):
@@ -311,6 +301,19 @@ def incompatible_license(d, dont_want_licenses, package=None):
     return any(not oe.license.license_ok(canonical_license(d, l), \
                dont_want_licenses) for l in licenses)
 
+def incompatible_license(d, dont_want_licenses, package=None):
+    """
+    This function checks if a recipe has only incompatible licenses. It also
+    take into consideration 'or' operand.  dont_want_licenses should be passed
+    as canonical (SPDX) names.
+    """
+    import oe.license
+    license = d.getVar("LICENSE_%s" % package) if package else None
+    if not license:
+        license = d.getVar('LICENSE')
+
+    return incompatible_pkg_license(d, dont_want_licenses, license)
+
 def check_license_flags(d):
     """
     This function checks if a recipe has any LICENSE_FLAGS that
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-10  7:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-09 14:44 [RFC PATCH 1/2] license.bbclass: split incompatible license check into a helper function Alexander Kanavin
2019-10-09 14:44 ` [RFC PATCH 2/2] license_image.bbclass: check and reject packages which have incompatible licenses Alexander Kanavin
2019-10-09 18:15   ` Christopher Larson
2019-10-09 19:41     ` Alexander Kanavin
2019-10-10  7:41       ` Mikko.Rapeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox