diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-08-23 14:08:09 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-29 16:02:08 -0700 |
commit | 4396677ade349c01c8cd0d42b12618723099fbf8 (patch) | |
tree | 875aa3aba71c0891ab2a9ba02ae57ee5b17c40b6 | |
parent | 436211f0525dbeab4d701a59093b6597ca72400c (diff) | |
download | poky-4396677ade349c01c8cd0d42b12618723099fbf8.tar.gz |
copyleft_compliance.bbclass: remove the duplicated code
A part of the code in copyleft_compliance.bbclass is duplicated to
archiver.bbclass, remove the duplicated lines.
[YOCTO #2619]
(From OE-Core rev: 731e1171d6c35ed086b36c081f48dba2015319f8)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/copyleft_compliance.bbclass | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass index c59cb7ad91..e68942d84c 100644 --- a/meta/classes/copyleft_compliance.bbclass +++ b/meta/classes/copyleft_compliance.bbclass | |||
@@ -6,55 +6,10 @@ | |||
6 | # | 6 | # |
7 | # vi:sts=4:sw=4:et | 7 | # vi:sts=4:sw=4:et |
8 | 8 | ||
9 | COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' | 9 | # Need the copyleft_should_include |
10 | 10 | inherit archiver | |
11 | COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL*' | ||
12 | COPYLEFT_LICENSE_INCLUDE[type] = 'list' | ||
13 | COPYLEFT_LICENSE_INCLUDE[doc] = 'Space separated list of globs which include licenses' | ||
14 | |||
15 | COPYLEFT_LICENSE_EXCLUDE ?= 'CLOSED Proprietary' | ||
16 | COPYLEFT_LICENSE_EXCLUDE[type] = 'list' | ||
17 | COPYLEFT_LICENSE_INCLUDE[doc] = 'Space separated list of globs which exclude licenses' | ||
18 | |||
19 | COPYLEFT_RECIPE_TYPE ?= '${@copyleft_recipe_type(d)}' | ||
20 | COPYLEFT_RECIPE_TYPE[doc] = 'The "type" of the current recipe (e.g. target, native, cross)' | ||
21 | |||
22 | COPYLEFT_RECIPE_TYPES ?= 'target' | ||
23 | COPYLEFT_RECIPE_TYPES[type] = 'list' | ||
24 | COPYLEFT_RECIPE_TYPES[doc] = 'Space separated list of recipe types to include' | ||
25 | |||
26 | COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-canadian' | ||
27 | COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list' | ||
28 | COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types' | ||
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 | 11 | ||
36 | def copyleft_should_include(d): | 12 | COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' |
37 | """Determine if this recipe's sources should be deployed for compliance""" | ||
38 | import ast | ||
39 | import oe.license | ||
40 | from fnmatch import fnmatchcase as fnmatch | ||
41 | |||
42 | recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True) | ||
43 | if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d): | ||
44 | return False, 'recipe type "%s" is excluded' % recipe_type | ||
45 | |||
46 | include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d) | ||
47 | exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d) | ||
48 | |||
49 | try: | ||
50 | is_included, reason = oe.license.is_included(d.getVar('LICENSE', True), include, exclude) | ||
51 | except oe.license.LicenseError as exc: | ||
52 | bb.fatal('%s: %s' % (d.getVar('PF', True), exc)) | ||
53 | else: | ||
54 | if is_included: | ||
55 | return True, 'recipe has included licenses: %s' % ', '.join(reason) | ||
56 | else: | ||
57 | return False, 'recipe has excluded licenses: %s' % ', '.join(reason) | ||
58 | 13 | ||
59 | python do_prepare_copyleft_sources () { | 14 | python do_prepare_copyleft_sources () { |
60 | """Populate a tree of the recipe sources and emit patch series files""" | 15 | """Populate a tree of the recipe sources and emit patch series files""" |