Patchwork [CONSOLIDATED,PULL,062/113] meta/classes/base.bbclass: base.bbclass should check for multiple (or) licenses in bb files

login
register
mail settings
Submitter Saul Wold
Date Jan. 3, 2012, 6:19 a.m.
Message ID <05a5f6036d4c7ab6ff35be2ecb9c868e4666776a.1325571069.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/18103/
State New
Headers show

Comments

Saul Wold - Jan. 3, 2012, 6:19 a.m.
From: Andrei Gherzan <andrei.gherzan@windriver.com>

base.bbclass modified in order to check if there is an "or" operand, and if it is,
should check further if there are other non-excluded licenses.

[YOCTO #1844]

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
---
 meta/classes/base.bbclass |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index e65a722..4ac809a 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -401,8 +401,21 @@  python () {
                 import re
                 this_license = d.getVar('LICENSE', 1)
                 if this_license and re.search(dont_want_license, this_license):
-                    bb.note("SKIPPING %s because it's %s" % (pn, this_license))
-                    raise bb.parse.SkipPackage("incompatible with license %s" % this_license)
+		    this_license_no_spaces = re.sub(r'\s', '', this_license)
+		    licenses = re.split('[|]', this_license_no_spaces)
+		    if len(licenses) != 0:
+			good_license=""
+		        for onelicense in licenses:
+			    if not re.search(dont_want_license, onelicense):
+				good_license = onelicense
+			if good_license == "":
+			    bb.note("SKIPPING %s because it's %s" % (pn, this_license))
+			    raise bb.parse.SkipPackage("incompatible with license %s" % this_license)
+			else:
+			    bb.note("NOT SKIPPING %s because it's %s which contains %s" % (pn, this_license, good_license))
+		    else:
+			bb.note("SKIPPING %s because it's %s" % (pn, this_license))
+			raise bb.parse.SkipPackage("incompatible with license %s" % this_license)
 
     srcuri = d.getVar('SRC_URI', 1)
     # Svn packages should DEPEND on subversion-native