summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2014-01-13 19:06:00 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-21 17:15:27 +0000
commit1f44904daea0c6dddde5ece065a95725722274a8 (patch)
tree121896b5773e14b9992dfb5126ad64a0f899fe3f /meta
parent2c7d20ce3849aba84e0552f0fc4bde649d96faa9 (diff)
downloadpoky-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>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/archiver.bbclass19
-rw-r--r--meta/classes/copyleft_compliance.bbclass55
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
38COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL*'
39COPYLEFT_LICENSE_INCLUDE[type] = 'list'
40COPYLEFT_LICENSE_INCLUDE[doc] = 'Space separated list of globs which include licenses'
41
42COPYLEFT_LICENSE_EXCLUDE ?= 'CLOSED Proprietary'
43COPYLEFT_LICENSE_EXCLUDE[type] = 'list'
44COPYLEFT_LICENSE_EXCLUDE[doc] = 'Space separated list of globs which exclude licenses'
45
46COPYLEFT_RECIPE_TYPE ?= '${@copyleft_recipe_type(d)}'
47COPYLEFT_RECIPE_TYPE[doc] = 'The "type" of the current recipe (e.g. target, native, cross)'
48
49COPYLEFT_RECIPE_TYPES ?= 'target'
50COPYLEFT_RECIPE_TYPES[type] = 'list'
51COPYLEFT_RECIPE_TYPES[doc] = 'Space separated list of recipe types to include'
52
53COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-canadian'
54COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list'
55COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types'
56
57python () { 38python () {
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 9COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL*'
10inherit archiver 10COPYLEFT_LICENSE_INCLUDE[type] = 'list'
11COPYLEFT_LICENSE_INCLUDE[doc] = 'Space separated list of globs which include licenses'
12
13COPYLEFT_LICENSE_EXCLUDE ?= 'CLOSED Proprietary'
14COPYLEFT_LICENSE_EXCLUDE[type] = 'list'
15COPYLEFT_LICENSE_EXCLUDE[doc] = 'Space separated list of globs which exclude licenses'
16
17COPYLEFT_RECIPE_TYPE ?= '${@copyleft_recipe_type(d)}'
18COPYLEFT_RECIPE_TYPE[doc] = 'The "type" of the current recipe (e.g. target, native, cross)'
19
20COPYLEFT_RECIPE_TYPES ?= 'target'
21COPYLEFT_RECIPE_TYPES[type] = 'list'
22COPYLEFT_RECIPE_TYPES[doc] = 'Space separated list of recipe types to include'
23
24COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-canadian'
25COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list'
26COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types'
11 27
12COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' 28COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources'
13 29
30def 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
36def 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
14python do_prepare_copyleft_sources () { 65python 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