summaryrefslogtreecommitdiffstats
path: root/meta/classes/license.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r--meta/classes/license.bbclass14
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):
264 """ 264 """
265 return d.getVarFlag('SPDXLICENSEMAP', license, True) 265 return d.getVarFlag('SPDXLICENSEMAP', license, True)
266 266
267def canonical_license(d, license):
268 """
269 Return the canonical (SPDX) form of the license if available (so GPLv3
270 becomes GPL-3.0), or the passed license if there is no canonical form.
271 """
272 return d.getVarFlag('SPDXLICENSEMAP', license, True) or license
273
267def incompatible_license(d, dont_want_licenses, package=None): 274def incompatible_license(d, dont_want_licenses, package=None):
268 """ 275 """
269 This function checks if a recipe has only incompatible licenses. It also take into consideration 'or' 276 This function checks if a recipe has only incompatible licenses. It also
270 operand. 277 take into consideration 'or' operand. dont_want_licenses should be passed
278 as canonical (SPDX) names.
271 """ 279 """
272 import re 280 import re
273 import oe.license 281 import oe.license
@@ -298,7 +306,7 @@ def incompatible_license(d, dont_want_licenses, package=None):
298 licenses = oe.license.flattened_licenses(license, choose_lic_set) 306 licenses = oe.license.flattened_licenses(license, choose_lic_set)
299 except oe.license.LicenseError as exc: 307 except oe.license.LicenseError as exc:
300 bb.fatal('%s: %s' % (d.getVar('P', True), exc)) 308 bb.fatal('%s: %s' % (d.getVar('P', True), exc))
301 return any(not license_ok(l) for l in licenses) 309 return any(not license_ok(canonical_license(d, l)) for l in licenses)
302 310
303def check_license_flags(d): 311def check_license_flags(d):
304 """ 312 """