summaryrefslogtreecommitdiffstats
path: root/meta/classes/copyleft_filter.bbclass
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-06-09 12:46:48 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-23 10:46:57 (GMT)
commitae9102bda398359736ae0d46db388af51141d361 (patch)
treebb3f0b993299690b57d76b0c78df171c1002917f /meta/classes/copyleft_filter.bbclass
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/copyleft_filter.bbclass')
-rw-r--r--meta/classes/copyleft_filter.bbclass25
1 files changed, 21 insertions, 4 deletions
diff --git a/meta/classes/copyleft_filter.bbclass b/meta/classes/copyleft_filter.bbclass
index 2c1d8f1..46be7f7 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