* [PATCH 1/2] license.py: fix behaviour of copyleft_compliance
@ 2012-04-02 20:37 Eric Bénard
2012-04-02 20:37 ` [PATCH 2/2] copyleft_compliance: also print the reason for including a package Eric Bénard
2012-04-04 16:54 ` [PATCH 1/2] license.py: fix behaviour of copyleft_compliance Saul Wold
0 siblings, 2 replies; 3+ messages in thread
From: Eric Bénard @ 2012-04-02 20:37 UTC (permalink / raw)
To: openembedded-core
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@eukrea.com>
---
v2: updated and tested after Kergoth's review on IRC
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
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] copyleft_compliance: also print the reason for including a package
2012-04-02 20:37 [PATCH 1/2] license.py: fix behaviour of copyleft_compliance Eric Bénard
@ 2012-04-02 20:37 ` Eric Bénard
2012-04-04 16:54 ` [PATCH 1/2] license.py: fix behaviour of copyleft_compliance Saul Wold
1 sibling, 0 replies; 3+ messages in thread
From: Eric Bénard @ 2012-04-02 20:37 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
meta/classes/copyleft_compliance.bbclass | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass
index 4082e7e..3ca7337 100644
--- a/meta/classes/copyleft_compliance.bbclass
+++ b/meta/classes/copyleft_compliance.bbclass
@@ -47,14 +47,14 @@ def copyleft_should_include(d):
exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d)
try:
- is_included, excluded = oe.license.is_included(d.getVar('LICENSE', True), include, exclude)
+ is_included, reason = oe.license.is_included(d.getVar('LICENSE', True), include, exclude)
except oe.license.LicenseError as exc:
bb.fatal('%s: %s' % (d.getVar('PF', True), exc))
else:
if is_included:
- return True, None
+ return True, 'recipe has included licenses: %s' % ', '.join(reason)
else:
- return False, 'recipe has excluded licenses: %s' % ', '.join(excluded)
+ return False, 'recipe has excluded licenses: %s' % ', '.join(reason)
python do_prepare_copyleft_sources () {
"""Populate a tree of the recipe sources and emit patch series files"""
@@ -67,7 +67,7 @@ python do_prepare_copyleft_sources () {
bb.debug(1, 'copyleft: %s is excluded: %s' % (p, reason))
return
else:
- bb.debug(1, 'copyleft: %s is included' % p)
+ bb.debug(1, 'copyleft: %s is included: %s' % (p, reason))
sources_dir = d.getVar('COPYLEFT_SOURCES_DIR', True)
src_uri = d.getVar('SRC_URI', True).split()
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] license.py: fix behaviour of copyleft_compliance
2012-04-02 20:37 [PATCH 1/2] license.py: fix behaviour of copyleft_compliance Eric Bénard
2012-04-02 20:37 ` [PATCH 2/2] copyleft_compliance: also print the reason for including a package Eric Bénard
@ 2012-04-04 16:54 ` Saul Wold
1 sibling, 0 replies; 3+ messages in thread
From: Saul Wold @ 2012-04-04 16:54 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On 04/02/2012 01:37 PM, Eric Bénard wrote:
> 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@eukrea.com>
> ---
> v2: updated and tested after Kergoth's review on IRC
>
> 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
Merged both of these into OE-Core
Thanks
Sau!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-04 17:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 20:37 [PATCH 1/2] license.py: fix behaviour of copyleft_compliance Eric Bénard
2012-04-02 20:37 ` [PATCH 2/2] copyleft_compliance: also print the reason for including a package Eric Bénard
2012-04-04 16:54 ` [PATCH 1/2] license.py: fix behaviour of copyleft_compliance Saul Wold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox