summaryrefslogtreecommitdiffstats
path: root/meta/classes/copyleft_compliance.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/copyleft_compliance.bbclass')
-rw-r--r--meta/classes/copyleft_compliance.bbclass56
1 files changed, 1 insertions, 55 deletions
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass
index b47c2c95ad..907c1836b3 100644
--- a/meta/classes/copyleft_compliance.bbclass
+++ b/meta/classes/copyleft_compliance.bbclass
@@ -2,66 +2,12 @@
2# Defaults to using symlinks, as it's a quick operation, and one can easily 2# Defaults to using symlinks, as it's a quick operation, and one can easily
3# follow the links when making use of the files (e.g. tar with the -h arg). 3# follow the links when making use of the files (e.g. tar with the -h arg).
4# 4#
5# By default, includes all GPL and LGPL, and excludes CLOSED and Proprietary.
6#
7# vi:sts=4:sw=4:et 5# vi:sts=4:sw=4:et
8 6
9COPYLEFT_LICENSE_INCLUDE ?= 'GPL* LGPL*' 7inherit copyleft_filter
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'
27 8
28COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' 9COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources'
29 10
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
65python do_prepare_copyleft_sources () { 11python do_prepare_copyleft_sources () {
66 """Populate a tree of the recipe sources and emit patch series files""" 12 """Populate a tree of the recipe sources and emit patch series files"""
67 import os.path 13 import os.path