diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2019-10-10 13:18:47 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-15 14:16:10 +0100 |
commit | f46b73658ee6697338d0431efa9cc33fd2c9b914 (patch) | |
tree | 87a5c87d10d960be36223ae5fd00a84c2bcd9eb8 /meta/classes/license.bbclass | |
parent | 1d3ef1b9daae9634a6c7b45373031cf81e8e08c9 (diff) | |
download | poky-f46b73658ee6697338d0431efa9cc33fd2c9b914.tar.gz |
license.bbclass: split incompatible license check into a helper function
This would help with checking incompatible licenses at do_rootfs step
in image creation, where it is beneficial to pass the license string
directly to the function.
(From OE-Core rev: 8a0f342e4fc33b1aa53089b1de583d45d2951476)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r-- | meta/classes/license.bbclass | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index adca881c85..648a4d7892 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
@@ -287,17 +287,7 @@ def incompatible_license_contains(license, truevalue, falsevalue, d): | |||
287 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | 287 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) |
288 | return truevalue if license in bad_licenses else falsevalue | 288 | return truevalue if license in bad_licenses else falsevalue |
289 | 289 | ||
290 | def incompatible_license(d, dont_want_licenses, package=None): | 290 | def incompatible_pkg_license(d, dont_want_licenses, license): |
291 | """ | ||
292 | This function checks if a recipe has only incompatible licenses. It also | ||
293 | take into consideration 'or' operand. dont_want_licenses should be passed | ||
294 | as canonical (SPDX) names. | ||
295 | """ | ||
296 | import oe.license | ||
297 | license = d.getVar("LICENSE_%s" % package) if package else None | ||
298 | if not license: | ||
299 | license = d.getVar('LICENSE') | ||
300 | |||
301 | # Handles an "or" or two license sets provided by | 291 | # Handles an "or" or two license sets provided by |
302 | # flattened_licenses(), pick one that works if possible. | 292 | # flattened_licenses(), pick one that works if possible. |
303 | def choose_lic_set(a, b): | 293 | def choose_lic_set(a, b): |
@@ -311,6 +301,19 @@ def incompatible_license(d, dont_want_licenses, package=None): | |||
311 | return any(not oe.license.license_ok(canonical_license(d, l), \ | 301 | return any(not oe.license.license_ok(canonical_license(d, l), \ |
312 | dont_want_licenses) for l in licenses) | 302 | dont_want_licenses) for l in licenses) |
313 | 303 | ||
304 | def incompatible_license(d, dont_want_licenses, package=None): | ||
305 | """ | ||
306 | This function checks if a recipe has only incompatible licenses. It also | ||
307 | take into consideration 'or' operand. dont_want_licenses should be passed | ||
308 | as canonical (SPDX) names. | ||
309 | """ | ||
310 | import oe.license | ||
311 | license = d.getVar("LICENSE_%s" % package) if package else None | ||
312 | if not license: | ||
313 | license = d.getVar('LICENSE') | ||
314 | |||
315 | return incompatible_pkg_license(d, dont_want_licenses, license) | ||
316 | |||
314 | def check_license_flags(d): | 317 | def check_license_flags(d): |
315 | """ | 318 | """ |
316 | This function checks if a recipe has any LICENSE_FLAGS that | 319 | This function checks if a recipe has any LICENSE_FLAGS that |