diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2024-10-24 13:03:08 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-25 15:37:10 +0100 |
| commit | f8f7e53641955f6fc70dcb1d30777fc82060eb24 (patch) | |
| tree | 6abc86b4419402e8fe8729489816925a5c16f8c5 /meta/lib | |
| parent | 71760081f782cdf1e53c3ff03a6376fac3605196 (diff) | |
| download | poky-f8f7e53641955f6fc70dcb1d30777fc82060eb24.tar.gz | |
lib/license: Move package license skip to library
Moves the code that skips packages with incompatible licenses to the
library code so that it can be called in other locations
(From OE-Core rev: 86eb409e3c1b30110869ec5a0027ae2d48bbfe7f)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/license.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index 7739697c40..32c77fa204 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py | |||
| @@ -422,3 +422,42 @@ def check_license_format(d): | |||
| 422 | '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \ | 422 | '%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \ |
| 423 | 'in the valid list of separators (%s)' % | 423 | 'in the valid list of separators (%s)' % |
| 424 | (pn, licenses, element, license_operator_chars), d) | 424 | (pn, licenses, element, license_operator_chars), d) |
| 425 | |||
| 426 | def skip_incompatible_package_licenses(d, pkgs): | ||
| 427 | if not pkgs: | ||
| 428 | return {} | ||
| 429 | |||
| 430 | pn = d.getVar("PN") | ||
| 431 | |||
| 432 | check_license = False if pn.startswith("nativesdk-") else True | ||
| 433 | for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}", | ||
| 434 | "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}", | ||
| 435 | "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]: | ||
| 436 | if pn.endswith(d.expand(t)): | ||
| 437 | check_license = False | ||
| 438 | if pn.startswith("gcc-source-"): | ||
| 439 | check_license = False | ||
| 440 | |||
| 441 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() | ||
| 442 | if not check_license or not bad_licenses: | ||
| 443 | return {} | ||
| 444 | |||
| 445 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | ||
| 446 | |||
| 447 | exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() | ||
| 448 | |||
| 449 | for lic_exception in exceptions: | ||
| 450 | if ":" in lic_exception: | ||
| 451 | lic_exception = lic_exception.split(":")[1] | ||
| 452 | if lic_exception in obsolete_license_list(): | ||
| 453 | bb.fatal("Obsolete license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception) | ||
| 454 | |||
| 455 | skipped_pkgs = {} | ||
| 456 | for pkg in pkgs: | ||
| 457 | remaining_bad_licenses = apply_pkg_license_exception(pkg, bad_licenses, exceptions) | ||
| 458 | |||
| 459 | incompatible_lic = incompatible_license(d, remaining_bad_licenses, pkg) | ||
| 460 | if incompatible_lic: | ||
| 461 | skipped_pkgs[pkg] = incompatible_lic | ||
| 462 | |||
| 463 | return skipped_pkgs | ||
