diff options
author | Andy Ross <andy.ross@windriver.com> | 2012-11-29 11:08:47 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-12-11 15:54:26 +0000 |
commit | 8a8d00f4c9f7fe5f9f173b43b86cd18a6c75435c (patch) | |
tree | 35938bce2192959a0b5ca21eab14728a013e7bda /meta/classes/base.bbclass | |
parent | 34baee37caccced13fb26f446b865c9f25edf339 (diff) | |
download | openembedded-core-8a8d00f4c9f7fe5f9f173b43b86cd18a6c75435c.tar.gz openembedded-core-8a8d00f4c9f7fe5f9f173b43b86cd18a6c75435c.tar.bz2 openembedded-core-8a8d00f4c9f7fe5f9f173b43b86cd18a6c75435c.zip |
base/license.bbclass: handle multiple INCOMPATIBLE_LICENSEs
Allow INCOMPATIBLE_LICENSE to be a whitespace-separated list of
incompatible license strings and/or glob patterns.
Also fix wildcarding: the string in INCOMPATIBLE_LICENSE was clearly
intended to match with wildcards (e.g. "*GPLv3" to match both GPLv3
and LGPLv3), but this was broken because of a bug in return_spdx()
which would die with a runtime error when there was no SPDXLICENSEMAP
entry for the string.
Signed-off-by: Andy Ross <andy.ross@windriver.com>
Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
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 () { raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine) - dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', True) - - 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-"): - # Internally, we'll use the license mapping. This way INCOMPATIBLE_LICENSE = "GPLv2" and - # INCOMPATIBLE_LICENSE = "GPLv2.0" will pick up all variations of GPL-2.0 - spdx_license = return_spdx(d, dont_want_license) - hosttools_whitelist = (d.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, True) or d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split() - lgplv2_whitelist = (d.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, True) or d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split() - dont_want_whitelist = (d.getVar('WHITELIST_%s' % dont_want_license, True) or d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split() - if pn not in hosttools_whitelist and pn not in lgplv2_whitelist and pn not in dont_want_whitelist: - this_license = d.getVar('LICENSE', True) - # At this point we know the recipe contains an INCOMPATIBLE_LICENSE, however it may contain packages that do not. - packages = d.getVar('PACKAGES', True).split() - dont_skip_recipe = False - skipped_packages = {} - unskipped_packages = [] - for pkg in packages: - if incompatible_license(d, dont_want_license, pkg): - skipped_packages[pkg] = this_license - dont_skip_recipe = True + bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE', True) or "").split() + + check_license = False if pn.startswith("nativesdk-") else True + for t in ["-native", "-cross", "-cross-initial", "-cross-intermediate", + "-crosssdk-intermediate", "-crosssdk", "-crosssdk-initial", + "-cross-canadian-" + d.getVar('TRANSLATED_TARGET_ARCH', True)]: + if pn.endswith(t): + check_license = False + + if check_license and bad_licenses: + whitelist = [] + for lic in bad_licenses: + for w in ["HOSTTOOLS_WHITELIST_", "LGPLv2_WHITELIST_", "WHITELIST_"]: + whitelist.extend((d.getVar(w + lic, True) or "").split()) + spdx_license = return_spdx(d, lic) + if spdx_license: + whitelist.extend((d.getVar('HOSTTOOLS_WHITELIST_%s' % spdx_license, True) or "").split()) + if not pn in whitelist: + recipe_license = d.getVar('LICENSE', True) + pkgs = d.getVar('PACKAGES', True).split() + skipped_pkgs = [] + unskipped_pkgs = [] + for pkg in pkgs: + if incompatible_license(d, bad_licenses, pkg): + skipped_pkgs.append(pkg) else: - unskipped_packages.append(pkg) - if not unskipped_packages: - # if we hit here and have excluded all packages, then we can just exclude the recipe - dont_skip_recipe = False - elif skipped_packages and unskipped_packages: - for pkg, license in skipped_packages.iteritems(): - bb.note("SKIPPING the package " + pkg + " at do_rootfs because it's " + this_license) + unskipped_pkgs.append(pkg) + some_skipped = skipped_pkgs and unskipped_pkgs + all_skipped = skipped_pkgs and not unskipped_pkgs + if some_skipped: + for pkg in skipped_pkgs: + bb.note("SKIPPING the package " + pkg + " at do_rootfs because it's " + recipe_license) d.setVar('LICENSE_EXCLUSION-' + pkg, 1) - for index, pkg in enumerate(unskipped_packages): + for pkg in unskipped_pkgs: bb.note("INCLUDING the package " + pkg) - - if dont_skip_recipe is False and incompatible_license(d, dont_want_license): - bb.note("SKIPPING recipe %s because it's %s" % (pn, this_license)) - raise bb.parse.SkipPackage("incompatible with license %s" % this_license) - - + elif all_skipped or incompatible_license(d, bad_licenses): + bb.note("SKIPPING recipe %s because it's %s" % (pn, recipe_license)) + raise bb.parse.SkipPackage("incompatible with license %s" % recipe_license) srcuri = d.getVar('SRC_URI', True) # Svn packages should DEPEND on subversion-native |