diff options
-rw-r--r-- | meta/classes-global/base.bbclass | 35 | ||||
-rw-r--r-- | meta/lib/oe/license.py | 39 |
2 files changed, 43 insertions, 31 deletions
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 88b932fc3f..5b8663f454 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass | |||
@@ -573,37 +573,10 @@ python () { | |||
573 | 573 | ||
574 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() | 574 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() |
575 | 575 | ||
576 | check_license = False if pn.startswith("nativesdk-") else True | 576 | pkgs = d.getVar('PACKAGES').split() |
577 | for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}", | 577 | if pkgs: |
578 | "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}", | 578 | skipped_pkgs = oe.license.skip_incompatible_package_licenses(d, pkgs) |
579 | "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]: | 579 | unskipped_pkgs = [p for p in pkgs if p not in skipped_pkgs] |
580 | if pn.endswith(d.expand(t)): | ||
581 | check_license = False | ||
582 | if pn.startswith("gcc-source-"): | ||
583 | check_license = False | ||
584 | |||
585 | if check_license and bad_licenses: | ||
586 | bad_licenses = oe.license.expand_wildcard_licenses(d, bad_licenses) | ||
587 | |||
588 | exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() | ||
589 | |||
590 | for lic_exception in exceptions: | ||
591 | if ":" in lic_exception: | ||
592 | lic_exception = lic_exception.split(":")[1] | ||
593 | if lic_exception in oe.license.obsolete_license_list(): | ||
594 | bb.fatal("Obsolete license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception) | ||
595 | |||
596 | pkgs = d.getVar('PACKAGES').split() | ||
597 | skipped_pkgs = {} | ||
598 | unskipped_pkgs = [] | ||
599 | for pkg in pkgs: | ||
600 | remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) | ||
601 | |||
602 | incompatible_lic = oe.license.incompatible_license(d, remaining_bad_licenses, pkg) | ||
603 | if incompatible_lic: | ||
604 | skipped_pkgs[pkg] = incompatible_lic | ||
605 | else: | ||
606 | unskipped_pkgs.append(pkg) | ||
607 | 580 | ||
608 | if unskipped_pkgs: | 581 | if unskipped_pkgs: |
609 | for pkg in skipped_pkgs: | 582 | for pkg in skipped_pkgs: |
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 | ||