diff options
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 14d3107c4a..ea4c8801e9 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -285,6 +285,31 @@ def canonical_license(d, license): | |||
285 | lic += '+' | 285 | lic += '+' |
286 | return lic or license | 286 | return lic or license |
287 | 287 | ||
288 | def expand_wildcard_licenses(d, wildcard_licenses): | ||
289 | """ | ||
290 | Return actual spdx format license names if wildcard used. We expand | ||
291 | wildcards from SPDXLICENSEMAP flags and SRC_DISTRIBUTE_LICENSES values. | ||
292 | """ | ||
293 | import fnmatch | ||
294 | licenses = [] | ||
295 | spdxmapkeys = d.getVarFlags('SPDXLICENSEMAP').keys() | ||
296 | for wld_lic in wildcard_licenses: | ||
297 | spdxflags = fnmatch.filter(spdxmapkeys, wld_lic) | ||
298 | licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags] | ||
299 | |||
300 | spdx_lics = (d.getVar('SRC_DISTRIBUTE_LICENSES') or '').split() | ||
301 | for wld_lic in wildcard_licenses: | ||
302 | licenses += fnmatch.filter(spdx_lics, wld_lic) | ||
303 | |||
304 | licenses = list(set(licenses)) | ||
305 | return licenses | ||
306 | |||
307 | def incompatible_license_contains(license, truevalue, falsevalue, d): | ||
308 | license = canonical_license(d, license) | ||
309 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE', True) or "").split() | ||
310 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | ||
311 | return truevalue if license in bad_licenses else falsevalue | ||
312 | |||
288 | def incompatible_license(d, dont_want_licenses, package=None): | 313 | def incompatible_license(d, dont_want_licenses, package=None): |
289 | """ | 314 | """ |
290 | This function checks if a recipe has only incompatible licenses. It also | 315 | This function checks if a recipe has only incompatible licenses. It also |