diff options
author | Ross Burton <ross.burton@intel.com> | 2014-07-17 15:41:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-19 00:08:49 +0100 |
commit | 8998e13fc95f11d15c34fb09d8451a9d4b69f2f1 (patch) | |
tree | 2b2e4f7479e4c0407bf29148a499178e608fdd61 /meta/classes/license.bbclass | |
parent | 32c5b31d8a22bb8ba49db8a5c797ad0f421e67a3 (diff) | |
download | openembedded-core-8998e13fc95f11d15c34fb09d8451a9d4b69f2f1.tar.gz openembedded-core-8998e13fc95f11d15c34fb09d8451a9d4b69f2f1.tar.bz2 openembedded-core-8998e13fc95f11d15c34fb09d8451a9d4b69f2f1.zip |
license.bbclass: canonicalise licenses when dealing with INCOMPATIBLE_LICENSE
If INCOMPATIBLE_LICENSE=GPL-3.0 but the recipe sets LICENSE=GPLv3, the current
code won't trigger because they're different strings.
Fix this by attempting to canonicalise every license name to a SPDX name, so
both names in this example become GPL-3.0.
[ YOCTO #5622 ]
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 2a6e869736..601f5611cc 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass @@ -264,10 +264,18 @@ def return_spdx(d, license): """ return d.getVarFlag('SPDXLICENSEMAP', license, True) +def canonical_license(d, license): + """ + Return the canonical (SPDX) form of the license if available (so GPLv3 + becomes GPL-3.0), or the passed license if there is no canonical form. + """ + return d.getVarFlag('SPDXLICENSEMAP', license, True) or license + def incompatible_license(d, dont_want_licenses, package=None): """ - This function checks if a recipe has only incompatible licenses. It also take into consideration 'or' - operand. + This function checks if a recipe has only incompatible licenses. It also + take into consideration 'or' operand. dont_want_licenses should be passed + as canonical (SPDX) names. """ import re import oe.license @@ -298,7 +306,7 @@ def incompatible_license(d, dont_want_licenses, package=None): licenses = oe.license.flattened_licenses(license, choose_lic_set) except oe.license.LicenseError as exc: bb.fatal('%s: %s' % (d.getVar('P', True), exc)) - return any(not license_ok(l) for l in licenses) + return any(not license_ok(canonical_license(d, l)) for l in licenses) def check_license_flags(d): """ |