aboutsummaryrefslogtreecommitdiffstats
path: root/meta-mentor-common/classes/incompatible-packages-check.bbclass
blob: 2ee0d03c1d31f514339b7bb7cfca4a5b6c718910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# ---------------------------------------------------------------------------------------------------------------------
# SPDX-License-Identifier: MIT
# ---------------------------------------------------------------------------------------------------------------------

def any_incompatible(d, packages, licensestring=None):
    """Return True if any of the specified packages are skipped due to incompatible license.
    
    The user may specify the package's license for cross-recipe checks.
    """
    bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
    if not bad_licenses:
        return False
    bad_licenses = expand_wildcard_licenses(d, bad_licenses)

    if licensestring is None:
        licensestring = d.getVar("LICENSE:%s" % package) if package else None
        if not licensestring:
            licensestring = d.getVar('LICENSE')

    exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split()
    for pkg in packages:
        remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions)

        incompatible_lic = incompatible_pkg_license(d, remaining_bad_licenses, licensestring)
        if incompatible_lic:
            return True
    return False