diff options
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index ac97a35c4c..f7b6fb8998 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -525,43 +525,44 @@ python () { | |||
525 | raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine) | 525 | raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine) |
526 | 526 | ||
527 | 527 | ||
528 | dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', True) | 528 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE', True) or "").split() |
529 | 529 | ||
530 | if dont_want_license and not pn.endswith("-native") and not pn.endswith("-cross") and not pn.endswith("-cross-initial") and not pn.endswith("-cross-intermediate") and not pn.endswith("-crosssdk-intermediate") and not pn.endswith("-crosssdk") and not pn.endswith("-crosssdk-initial") and not pn.endswith("-cross-canadian-%s" % d.getVar('TRANSLATED_TARGET_ARCH', True)) and not pn.startswith("nativesdk-"): | 530 | check_license = False if pn.startswith("nativesdk-") else True |
531 | # Internally, we'll use the license mapping. This way INCOMPATIBLE_LICENSE = "GPLv2" and | 531 | for t in ["-native", "-cross", "-cross-initial", "-cross-intermediate", |
532 | # INCOMPATIBLE_LICENSE = "GPLv2.0" will pick up all variations of GPL-2.0 | 532 | "-crosssdk-intermediate", "-crosssdk", "-crosssdk-initial", |
533 | spdx_license = return_spdx(d, dont_want_license) | 533 | "-cross-canadian-" + d.getVar('TRANSLATED_TARGET_ARCH', True)]: |
534 | hosttools_whitelist = (d.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, True) or d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split() | 534 | if pn.endswith(t): |
535 | lgplv2_whitelist = (d.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, True) or d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split() | 535 | check_license = False |
536 | dont_want_whitelist = (d.getVar('WHITELIST_%s' % dont_want_license, True) or d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split() | 536 | |
537 | if pn not in hosttools_whitelist and pn not in lgplv2_whitelist and pn not in dont_want_whitelist: | 537 | if check_license and bad_licenses: |
538 | this_license = d.getVar('LICENSE', True) | 538 | whitelist = [] |
539 | # At this point we know the recipe contains an INCOMPATIBLE_LICENSE, however it may contain packages that do not. | 539 | for lic in bad_licenses: |
540 | packages = d.getVar('PACKAGES', True).split() | 540 | for w in ["HOSTTOOLS_WHITELIST_", "LGPLv2_WHITELIST_", "WHITELIST_"]: |
541 | dont_skip_recipe = False | 541 | whitelist.extend((d.getVar(w + lic, True) or "").split()) |
542 | skipped_packages = {} | 542 | spdx_license = return_spdx(d, lic) |
543 | unskipped_packages = [] | 543 | if spdx_license: |
544 | for pkg in packages: | 544 | whitelist.extend((d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split()) |
545 | if incompatible_license(d, dont_want_license, pkg): | 545 | if not pn in whitelist: |
546 | skipped_packages[pkg] = this_license | 546 | recipe_license = d.getVar('LICENSE', True) |
547 | dont_skip_recipe = True | 547 | pkgs = d.getVar('PACKAGES', True).split() |
548 | skipped_pkgs = [] | ||
549 | unskipped_pkgs = [] | ||
550 | for pkg in pkgs: | ||
551 | if incompatible_license(d, bad_licenses, pkg): | ||
552 | skipped_pkgs.append(pkg) | ||
548 | else: | 553 | else: |
549 | unskipped_packages.append(pkg) | 554 | unskipped_pkgs.append(pkg) |
550 | if not unskipped_packages: | 555 | some_skipped = skipped_pkgs and unskipped_pkgs |
551 | # if we hit here and have excluded all packages, then we can just exclude the recipe | 556 | all_skipped = skipped_pkgs and not unskipped_pkgs |
552 | dont_skip_recipe = False | 557 | if some_skipped: |
553 | elif skipped_packages and unskipped_packages: | 558 | for pkg in skipped_pkgs: |
554 | for pkg, license in skipped_packages.iteritems(): | 559 | bb.note("SKIPPING the package " + pkg + " at do_rootfs because it's " + recipe_license) |
555 | bb.note("SKIPPING the package " + pkg + " at do_rootfs because it's " + this_license) | ||
556 | d.setVar('LICENSE_EXCLUSION-' + pkg, 1) | 560 | d.setVar('LICENSE_EXCLUSION-' + pkg, 1) |
557 | for index, pkg in enumerate(unskipped_packages): | 561 | for pkg in unskipped_pkgs: |
558 | bb.note("INCLUDING the package " + pkg) | 562 | bb.note("INCLUDING the package " + pkg) |
559 | 563 | elif all_skipped or incompatible_license(d, bad_licenses): | |
560 | if dont_skip_recipe is False and incompatible_license(d, dont_want_license): | 564 | bb.note("SKIPPING recipe %s because it's %s" % (pn, recipe_license)) |
561 | bb.note("SKIPPING recipe %s because it's %s" % (pn, this_license)) | 565 | raise bb.parse.SkipPackage("incompatible with license %s" % recipe_license) |
562 | raise bb.parse.SkipPackage("incompatible with license %s" % this_license) | ||
563 | |||
564 | |||
565 | 566 | ||
566 | srcuri = d.getVar('SRC_URI', True) | 567 | srcuri = d.getVar('SRC_URI', True) |
567 | # Svn packages should DEPEND on subversion-native | 568 | # Svn packages should DEPEND on subversion-native |