Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Eric Bénard" <eric@eukrea.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/2] license.py: fix behaviour of copyleft_compliance
Date: Mon,  2 Apr 2012 22:37:09 +0200	[thread overview]
Message-ID: <1333399030-28619-1-git-send-email-eric@eukrea.com> (raw)

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




             reply	other threads:[~2012-04-02 20:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 20:37 Eric Bénard [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1333399030-28619-1-git-send-email-eric@eukrea.com \
    --to=eric@eukrea.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox