diff options
author | Christopher Larson <chris_larson@mentor.com> | 2012-01-09 15:01:57 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-17 14:52:59 +0000 |
commit | 02101bbe08a5cd6e5eecb21f2095c15ebfe9287f (patch) | |
tree | 4944d2d189d90a45b59192014f466fcc2586c87e /meta/classes/copyleft_compliance.bbclass | |
parent | 045e8a409ffe23d4f562b2982bfeee6e45f3c0d9 (diff) | |
download | openembedded-core-02101bbe08a5cd6e5eecb21f2095c15ebfe9287f.tar.gz openembedded-core-02101bbe08a5cd6e5eecb21f2095c15ebfe9287f.tar.bz2 openembedded-core-02101bbe08a5cd6e5eecb21f2095c15ebfe9287f.zip |
copyleft_compliance: add debug message with the reason for exclusion
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Diffstat (limited to 'meta/classes/copyleft_compliance.bbclass')
-rw-r--r-- | meta/classes/copyleft_compliance.bbclass | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass index 37ed09e955..fd046381b6 100644 --- a/meta/classes/copyleft_compliance.bbclass +++ b/meta/classes/copyleft_compliance.bbclass @@ -39,8 +39,9 @@ def copyleft_should_include(d): import oe.license from fnmatch import fnmatchcase as fnmatch - if d.getVar('COPYLEFT_RECIPE_TYPE', True) not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d): - return False + recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True) + if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d): + return False, 'recipe type "%s" is excluded' % recipe_type include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d) exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d) @@ -63,18 +64,27 @@ def copyleft_should_include(d): licenses = oe.license.flattened_licenses(d.getVar('LICENSE', True), choose_licenses) except oe.license.InvalidLicense as exc: bb.fatal('%s: %s' % (d.getVar('PF', True), exc)) - except SyntaxError: - bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF', True))) - - return all(include_license(lic) for lic in licenses) + except SyntaxError as exc: + bb.warn('%s: error when parsing the LICENSE variable: %s' % (d.getVar('P', True), exc)) + else: + excluded = filter(lambda lic: not include_license(lic), licenses) + if excluded: + return False, 'recipe has excluded licenses: %s' % ', '.join(excluded) + else: + return True, None python do_prepare_copyleft_sources () { """Populate a tree of the recipe sources and emit patch series files""" import os.path import shutil - if not copyleft_should_include(d): + p = d.getVar('P', True) + included, reason = copyleft_should_include(d) + if not included: + bb.debug(1, 'copyleft: %s is excluded: %s' % (p, reason)) return + else: + bb.debug(1, 'copyleft: %s is included' % p) sources_dir = d.getVar('COPYLEFT_SOURCES_DIR', 1) src_uri = d.getVar('SRC_URI', 1).split() |