mirror of
https://git.yoctoproject.org/poky
synced 2026-09-20 03:49:32 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
1d3ef1b9da
commit
f46b73658e
@@ -287,17 +287,7 @@ def incompatible_license_contains(license, truevalue, falsevalue, d):
|
|||||||
bad_licenses = expand_wildcard_licenses(d, bad_licenses)
|
bad_licenses = expand_wildcard_licenses(d, bad_licenses)
|
||||||
return truevalue if license in bad_licenses else falsevalue
|
return truevalue if license in bad_licenses else falsevalue
|
||||||
|
|
||||||
def incompatible_license(d, dont_want_licenses, package=None):
|
def incompatible_pkg_license(d, dont_want_licenses, license):
|
||||||
"""
|
|
||||||
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 oe.license
|
|
||||||
license = d.getVar("LICENSE_%s" % package) if package else None
|
|
||||||
if not license:
|
|
||||||
license = d.getVar('LICENSE')
|
|
||||||
|
|
||||||
# Handles an "or" or two license sets provided by
|
# Handles an "or" or two license sets provided by
|
||||||
# flattened_licenses(), pick one that works if possible.
|
# flattened_licenses(), pick one that works if possible.
|
||||||
def choose_lic_set(a, b):
|
def choose_lic_set(a, b):
|
||||||
@@ -311,6 +301,19 @@ def incompatible_license(d, dont_want_licenses, package=None):
|
|||||||
return any(not oe.license.license_ok(canonical_license(d, l), \
|
return any(not oe.license.license_ok(canonical_license(d, l), \
|
||||||
dont_want_licenses) for l in licenses)
|
dont_want_licenses) for l in licenses)
|
||||||
|
|
||||||
|
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. dont_want_licenses should be passed
|
||||||
|
as canonical (SPDX) names.
|
||||||
|
"""
|
||||||
|
import oe.license
|
||||||
|
license = d.getVar("LICENSE_%s" % package) if package else None
|
||||||
|
if not license:
|
||||||
|
license = d.getVar('LICENSE')
|
||||||
|
|
||||||
|
return incompatible_pkg_license(d, dont_want_licenses, license)
|
||||||
|
|
||||||
def check_license_flags(d):
|
def check_license_flags(d):
|
||||||
"""
|
"""
|
||||||
This function checks if a recipe has any LICENSE_FLAGS that
|
This function checks if a recipe has any LICENSE_FLAGS that
|
||||||
|
|||||||
Reference in New Issue
Block a user