diff options
| author | Robert Yang <liezhi.yang@windriver.com> | 2014-01-13 19:06:00 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-21 17:15:27 +0000 |
| commit | 1f44904daea0c6dddde5ece065a95725722274a8 (patch) | |
| tree | 121896b5773e14b9992dfb5126ad64a0f899fe3f | |
| parent | 2c7d20ce3849aba84e0552f0fc4bde649d96faa9 (diff) | |
| download | poky-1f44904daea0c6dddde5ece065a95725722274a8.tar.gz | |
archiver.bbclass: move a few code to copyleft_compliance.bbclass
Move the code which is only used by copyleft_compliance.bbclass from
archiver.bbclassc, and remove the "inherit archiver" from
copyleft_compliance.bbclass.
The archiver.bbclass is used for archiving various types of sources, but
the copyleft_compliance.bbclass is used for analysing the license, they
don't have much relationships.
[YOCTO #4986]
[YOCTO #5113]
(From OE-Core rev: 578830fe2ff279ea620916ea711b80dc1b29a275)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/archiver.bbclass | 19 | ||||
| -rw-r--r-- | meta/classes/copyleft_compliance.bbclass | 55 |
2 files changed, 53 insertions, 21 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 9d4b158a4c..7780c71ade 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass | |||
| @@ -35,25 +35,6 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}" | |||
| 35 | # This is a convenience for the shell script to use it | 35 | # This is a convenience for the shell script to use it |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL*' | ||
| 39 | COPYLEFT_LICENSE_INCLUDE[type] = 'list' | ||
| 40 | COPYLEFT_LICENSE_INCLUDE[doc] = 'Space separated list of globs which include licenses' | ||
| 41 | |||
| 42 | COPYLEFT_LICENSE_EXCLUDE ?= 'CLOSED Proprietary' | ||
| 43 | COPYLEFT_LICENSE_EXCLUDE[type] = 'list' | ||
| 44 | COPYLEFT_LICENSE_EXCLUDE[doc] = 'Space separated list of globs which exclude licenses' | ||
| 45 | |||
| 46 | COPYLEFT_RECIPE_TYPE ?= '${@copyleft_recipe_type(d)}' | ||
| 47 | COPYLEFT_RECIPE_TYPE[doc] = 'The "type" of the current recipe (e.g. target, native, cross)' | ||
| 48 | |||
| 49 | COPYLEFT_RECIPE_TYPES ?= 'target' | ||
| 50 | COPYLEFT_RECIPE_TYPES[type] = 'list' | ||
| 51 | COPYLEFT_RECIPE_TYPES[doc] = 'Space separated list of recipe types to include' | ||
| 52 | |||
| 53 | COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-canadian' | ||
| 54 | COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list' | ||
| 55 | COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types' | ||
| 56 | |||
| 57 | python () { | 38 | python () { |
| 58 | pn = d.getVar('PN', True) | 39 | pn = d.getVar('PN', True) |
| 59 | 40 | ||
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass index 32aa7577f0..b47c2c95ad 100644 --- a/meta/classes/copyleft_compliance.bbclass +++ b/meta/classes/copyleft_compliance.bbclass | |||
| @@ -6,11 +6,62 @@ | |||
| 6 | # | 6 | # |
| 7 | # vi:sts=4:sw=4:et | 7 | # vi:sts=4:sw=4:et |
| 8 | 8 | ||
| 9 | # Need the copyleft_should_include | 9 | COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL*' |
| 10 | inherit archiver | 10 | COPYLEFT_LICENSE_INCLUDE[type] = 'list' |
| 11 | COPYLEFT_LICENSE_INCLUDE[doc] = 'Space separated list of globs which include licenses' | ||
| 12 | |||
| 13 | COPYLEFT_LICENSE_EXCLUDE ?= 'CLOSED Proprietary' | ||
| 14 | COPYLEFT_LICENSE_EXCLUDE[type] = 'list' | ||
| 15 | COPYLEFT_LICENSE_EXCLUDE[doc] = 'Space separated list of globs which exclude licenses' | ||
| 16 | |||
| 17 | COPYLEFT_RECIPE_TYPE ?= '${@copyleft_recipe_type(d)}' | ||
| 18 | COPYLEFT_RECIPE_TYPE[doc] = 'The "type" of the current recipe (e.g. target, native, cross)' | ||
| 19 | |||
| 20 | COPYLEFT_RECIPE_TYPES ?= 'target' | ||
| 21 | COPYLEFT_RECIPE_TYPES[type] = 'list' | ||
| 22 | COPYLEFT_RECIPE_TYPES[doc] = 'Space separated list of recipe types to include' | ||
| 23 | |||
| 24 | COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-canadian' | ||
| 25 | COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list' | ||
| 26 | COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types' | ||
| 11 | 27 | ||
| 12 | COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' | 28 | COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' |
| 13 | 29 | ||
| 30 | def copyleft_recipe_type(d): | ||
| 31 | for recipe_type in oe.data.typed_value('COPYLEFT_AVAILABLE_RECIPE_TYPES', d): | ||
| 32 | if oe.utils.inherits(d, recipe_type): | ||
| 33 | return recipe_type | ||
| 34 | return 'target' | ||
| 35 | |||
| 36 | def copyleft_should_include(d): | ||
| 37 | """ | ||
| 38 | Determine if this recipe's sources should be deployed for compliance | ||
| 39 | """ | ||
| 40 | import ast | ||
| 41 | import oe.license | ||
| 42 | from fnmatch import fnmatchcase as fnmatch | ||
| 43 | |||
| 44 | recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True) | ||
| 45 | if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d): | ||
| 46 | return False, 'recipe type "%s" is excluded' % recipe_type | ||
| 47 | |||
| 48 | include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d) | ||
| 49 | exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d) | ||
| 50 | |||
| 51 | try: | ||
| 52 | is_included, reason = oe.license.is_included(d.getVar('LICENSE', True), include, exclude) | ||
| 53 | except oe.license.LicenseError as exc: | ||
| 54 | bb.fatal('%s: %s' % (d.getVar('PF', True), exc)) | ||
| 55 | else: | ||
| 56 | if is_included: | ||
| 57 | if reason: | ||
| 58 | return True, 'recipe has included licenses: %s' % ', '.join(reason) | ||
| 59 | else: | ||
| 60 | return False, 'recipe does not include a copyleft license' | ||
| 61 | else: | ||
| 62 | return False, 'recipe has excluded licenses: %s' % ', '.join(reason) | ||
| 63 | |||
| 64 | |||
| 14 | python do_prepare_copyleft_sources () { | 65 | python do_prepare_copyleft_sources () { |
| 15 | """Populate a tree of the recipe sources and emit patch series files""" | 66 | """Populate a tree of the recipe sources and emit patch series files""" |
| 16 | import os.path | 67 | import os.path |
