[oe-commits] Eric Bénard : license.py: fix behaviour of copyleft_compliance

git at git.openembedded.org git at git.openembedded.org
Wed Apr 4 16:22:42 UTC 2012


Module: openembedded-core.git
Branch: master
Commit: 987d06447d2eacf2e01f08e29469c00fbb0ef1db
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=987d06447d2eacf2e01f08e29469c00fbb0ef1db

Author: Eric Bénard <eric at eukrea.com>
Date:   Mon Apr  2 22:37:09 2012 +0200

license.py: fix behaviour of copyleft_compliance

actually if a package has a license in its LICENSE variable
which is not in the whitelist nor in the blacklist and even
if an other license in this variable is in the whitelist,
the package gets excluded and is not taken in account in the
copyleft_compliance.
This patch solves this by excluding a recipe _only_ if the
LICENSE variable includes a pattern from the blacklist and
including a recipe only if it includes a variable from the
whitelist _and_ none from the blacklist.

Example in busybox which has LICENSE="GPLv2 & BSD-4-Clause",
with the actual behaviour (where he blacklist contains only
CLOSED Proprietary) we get :
DEBUG: copyleft: busybox-1.19.4 is excluded: recipe has excluded licenses: BSD-4-Clause
which is not sane because busybox is covered by a copyleft license
which is GPLv2 and should match the default whitelist which is
GPL* LGPL*.

Signed-off-by: Eric Bénard <eric at eukrea.com>

---

 meta/lib/oe/license.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 5914506..173e319 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -86,8 +86,10 @@ def is_included(licensestr, whitelist=None, blacklist=None):
     """
 
     def include_license(license):
-        return (any(fnmatch(license, pattern) for pattern in whitelist) and not
-                any(fnmatch(license, pattern) for pattern in blacklist))
+        return any(fnmatch(license, pattern) for pattern in whitelist)
+
+    def exclude_license(license):
+        return any(fnmatch(license, pattern) for pattern in blacklist)
 
     def choose_licenses(alpha, beta):
         """Select the option in an OR which is the 'best' (has the most
@@ -106,8 +108,9 @@ def is_included(licensestr, whitelist=None, blacklist=None):
         blacklist = []
 
     licenses = flattened_licenses(licensestr, choose_licenses)
-    excluded = filter(lambda lic: not include_license(lic), licenses)
+    excluded = filter(lambda lic: exclude_license(lic), licenses)
+    included = filter(lambda lic: include_license(lic), licenses)
     if excluded:
         return False, excluded
     else:
-        return True, None
+        return True, included





More information about the Openembedded-commits mailing list