[OE-core] [PATCH] base.bbclass: support for or operand in LICENSE and for SPDX license names

Andrei Gherzan andrei at gherzan.ro
Mon Jan 9 15:43:44 UTC 2012


From: Andrei Gherzan <andrei.gherzan at windriver.com>

base.bblass modfied in order to correctly exlude packages where OE-Style licence naming
is used. In this way licenses as GPL-3, GPLv3, GPLv3.0 will be exluded from a non-GPLv3
build.
The second modification was to include in a non-GPLv3 build packages where LICENSE is
GPLv3 or "something else". For example, qt4-embedded has LICENSE = "LGPLv2.1 | GPLv3".
This package should be included in a non-GPLv3 build as it is LGPLv2.1 or GPLv3.

[YOCTO #1884]
[YOCTO #1844]

Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
---
 meta/classes/base.bbclass |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index e65a722..568c5dd 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -392,6 +392,8 @@ python () {
 
 
         dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', 1)
+        spdx_dont_want_license = d.getVarFlag('SPDXLICENSEMAP', dont_want_license)
+
         if dont_want_license and not pn.endswith("-native") and not pn.endswith("-cross") and not pn.endswith("-cross-initial") and not pn.endswith("-cross-intermediate") and not pn.endswith("-crosssdk-intermediate") and not pn.endswith("-crosssdk") and not pn.endswith("-crosssdk-initial"):
             hosttools_whitelist = (d.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, 1) or "").split()
             lgplv2_whitelist = (d.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, 1) or "").split()
@@ -400,10 +402,22 @@ 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_clean=re.sub(r'[+&()*]', '', this_license)
+                or_licenses = re.split('[|]', this_license_clean)
+
+                for one_or_license in or_licenses:
+		    licenses = re.split('[ ]', one_or_license)
+		    good_license=one_or_license
+		    for onelicense in licenses:
+			spdx_onelicense = d.getVarFlag('SPDXLICENSEMAP', onelicense)
+			if ( onelicense and re.search(dont_want_license, onelicense) ) or ( onelicense and re.search(spdx_dont_want_license, onelicense) ) or ( spdx_onelicense and re.search(dont_want_license, spdx_onelicense) ) or ( spdx_onelicense and re.search(spdx_dont_want_license, spdx_onelicense) ):
+				good_license = ""
+				break
+		    if good_license != "":
+			break
+		if good_license == "":
+		    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
     if "svn://" in srcuri:
-- 
1.7.5.4





More information about the Openembedded-core mailing list