summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorEric Bénard <eric@eukrea.com>2012-04-02 20:37:09 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-04 16:17:51 (GMT)
commit029f3c6dec94e6c71d8cdf8352092b1d855cd1f1 (patch)
treed32a7ab83b8785ff8ddc321f61cc887f44250415 /meta/lib
parent1dc560c9d21081bcb73ff1eac0070ea58b4880cd (diff)
downloadpoky-029f3c6dec94e6c71d8cdf8352092b1d855cd1f1.tar.gz
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*. (From OE-Core rev: 987d06447d2eacf2e01f08e29469c00fbb0ef1db) Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/license.py11
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):
86 """ 86 """
87 87
88 def include_license(license): 88 def include_license(license):
89 return (any(fnmatch(license, pattern) for pattern in whitelist) and not 89 return any(fnmatch(license, pattern) for pattern in whitelist)
90 any(fnmatch(license, pattern) for pattern in blacklist)) 90
91 def exclude_license(license):
92 return any(fnmatch(license, pattern) for pattern in blacklist)
91 93
92 def choose_licenses(alpha, beta): 94 def choose_licenses(alpha, beta):
93 """Select the option in an OR which is the 'best' (has the most 95 """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):
106 blacklist = [] 108 blacklist = []
107 109
108 licenses = flattened_licenses(licensestr, choose_licenses) 110 licenses = flattened_licenses(licensestr, choose_licenses)
109 excluded = filter(lambda lic: not include_license(lic), licenses) 111 excluded = filter(lambda lic: exclude_license(lic), licenses)
112 included = filter(lambda lic: include_license(lic), licenses)
110 if excluded: 113 if excluded:
111 return False, excluded 114 return False, excluded
112 else: 115 else:
113 return True, None 116 return True, included