summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-06-09 12:46:48 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-23 11:46:57 +0100
commitae9102bda398359736ae0d46db388af51141d361 (patch)
treebb3f0b993299690b57d76b0c78df171c1002917f /meta/classes
parentb4c5f802e30b175afc0d1d7225ae939113b61cdf (diff)
downloadpoky-ae9102bda398359736ae0d46db388af51141d361.tar.gz
copyleft_filter.bbclass: Allow to filter on name
The archiver uses a license based filter to provide the source code. This patch allows to search on name based on two new variables (COPYLEFT_PN_INCLUDE, COPYLEFT_PN_EXCLUDE). Both variables are empty by default. The filter by name has higher priority than the license filter. [YOCTO # 6929] (From OE-Core rev: 04066239e9cd6a8461fb2c18e826289469ac1240) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/archiver.bbclass14
-rw-r--r--meta/classes/copyleft_filter.bbclass25
2 files changed, 27 insertions, 12 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index b598aa3ad6..7b5274df89 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -52,14 +52,12 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
52python () { 52python () {
53 pn = d.getVar('PN', True) 53 pn = d.getVar('PN', True)
54 54
55 if d.getVar('COPYLEFT_LICENSE_INCLUDE', True) or \ 55 included, reason = copyleft_should_include(d)
56 d.getVar('COPYLEFT_LICENSE_EXCLUDE', True): 56 if not included:
57 included, reason = copyleft_should_include(d) 57 bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason))
58 if not included: 58 return
59 bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason)) 59 else:
60 return 60 bb.debug(1, 'archiver: %s is included: %s' % (pn, reason))
61 else:
62 bb.debug(1, 'archiver: %s is included: %s' % (pn, reason))
63 61
64 ar_src = d.getVarFlag('ARCHIVER_MODE', 'src', True) 62 ar_src = d.getVarFlag('ARCHIVER_MODE', 'src', True)
65 ar_dumpdata = d.getVarFlag('ARCHIVER_MODE', 'dumpdata', True) 63 ar_dumpdata = d.getVarFlag('ARCHIVER_MODE', 'dumpdata', True)
diff --git a/meta/classes/copyleft_filter.bbclass b/meta/classes/copyleft_filter.bbclass
index 2c1d8f1c90..46be7f7d2f 100644
--- a/meta/classes/copyleft_filter.bbclass
+++ b/meta/classes/copyleft_filter.bbclass
@@ -25,6 +25,14 @@ COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-
25COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list' 25COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list'
26COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types' 26COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types'
27 27
28COPYLEFT_PN_INCLUDE ?= ''
29COPYLEFT_PN_INCLUDE[type] = 'list'
30COPYLEFT_PN_INCLUDE[doc] = 'Space separated list of recipe names to include'
31
32COPYLEFT_PN_EXCLUDE ?= ''
33COPYLEFT_PN_EXCLUDE[type] = 'list'
34COPYLEFT_PN_EXCLUDE[doc] = 'Space separated list of recipe names to exclude'
35
28def copyleft_recipe_type(d): 36def copyleft_recipe_type(d):
29 for recipe_type in oe.data.typed_value('COPYLEFT_AVAILABLE_RECIPE_TYPES', d): 37 for recipe_type in oe.data.typed_value('COPYLEFT_AVAILABLE_RECIPE_TYPES', d):
30 if oe.utils.inherits(d, recipe_type): 38 if oe.utils.inherits(d, recipe_type):
@@ -39,9 +47,11 @@ def copyleft_should_include(d):
39 import oe.license 47 import oe.license
40 from fnmatch import fnmatchcase as fnmatch 48 from fnmatch import fnmatchcase as fnmatch
41 49
50 included, motive = False, 'recipe did not match anything'
51
42 recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True) 52 recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True)
43 if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d): 53 if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d):
44 return False, 'recipe type "%s" is excluded' % recipe_type 54 include, motive = False, 'recipe type "%s" is excluded' % recipe_type
45 55
46 include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d) 56 include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d)
47 exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d) 57 exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d)
@@ -53,10 +63,17 @@ def copyleft_should_include(d):
53 else: 63 else:
54 if is_included: 64 if is_included:
55 if reason: 65 if reason:
56 return True, 'recipe has included licenses: %s' % ', '.join(reason) 66 included, motive = True, 'recipe has included licenses: %s' % ', '.join(reason)
57 else: 67 else:
58 return False, 'recipe does not include a copyleft license' 68 included, motive = False, 'recipe does not include a copyleft license'
59 else: 69 else:
60 return False, 'recipe has excluded licenses: %s' % ', '.join(reason) 70 included, motive = False, 'recipe has excluded licenses: %s' % ', '.join(reason)
61 71
72 if any(fnmatch(d.getVar('PN', True), name) \
73 for name in oe.data.typed_value('COPYLEFT_PN_INCLUDE', d)):
74 included, motive = True, 'recipe included by name'
75 if any(fnmatch(d.getVar('PN', True), name) \
76 for name in oe.data.typed_value('COPYLEFT_PN_EXCLUDE', d)):
77 included, motive = False, 'recipe excluded by name'
62 78
79 return included, motive