summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/sanity.bbclass73
-rw-r--r--meta/conf/documentation.conf6
2 files changed, 79 insertions, 0 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 687ddebccf..635049ec97 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -11,6 +11,76 @@ def raise_sanity_error(msg):
11 11
12 %s""" % msg) 12 %s""" % msg)
13 13
14# Check a single tune for validity.
15def check_toolchain_tune(data, tune, multilib):
16 tune_errors = []
17 if not tune:
18 return "No tuning found for %s multilib." % multilib
19 bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib))
20 features = (data.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split()
21 if not features:
22 return "Tuning '%s' has no defined features, and cannot be used." % tune
23 valid_tunes = data.getVarFlags('TUNEVALID') or {}
24 conflicts = data.getVarFlags('TUNECONFLICTS') or {}
25 # [doc] is the documentation for the variable, not a real feature
26 if 'doc' in valid_tunes:
27 del valid_tunes['doc']
28 if 'doc' in conflicts:
29 del conflicts['doc']
30 for feature in features:
31 if feature in conflicts:
32 for conflict in conflicts[feature].split():
33 if conflict in features:
34 tune_errors.append("Feature '%s' conflicts with '%s'." %
35 (feature, conflict))
36 if feature in valid_tunes:
37 bb.debug(2, " %s: %s" % (feature, valid_tunes[feature]))
38 else:
39 tune_errors.append("Feature '%s' is not defined." % feature)
40 whitelist = data.getVar("TUNEABI_WHITELIST", True) or ''
41 override = data.getVar("TUNEABI_OVERRIDE", True) or ''
42 if whitelist:
43 tuneabi = data.getVar("TUNEABI_tune-%s" % tune, True) or ''
44 if not tuneabi:
45 tuneabi = tune
46 if True not in [x in whitelist.split() for x in tuneabi.split()]:
47 tune_errors.append("Tuning '%s' (%s) cannot be used with any supported tuning/ABI." %
48 (tune, tuneabi))
49 if tune_errors:
50 return "Tuning '%s' has the following errors:\n" + '\n'.join(tune_errors)
51
52def check_toolchain(data):
53 tune_error_set = []
54 deftune = data.getVar("DEFAULTTUNE", True)
55 tune_errors = check_toolchain_tune(data, deftune, 'default')
56 if tune_errors:
57 tune_error_set.append(tune_errors)
58
59 multilibs = (data.getVar("MULTILIB_VARIANTS", True) or "").split()
60 if multilibs:
61 seen_libs = []
62 seen_tunes = []
63 for lib in multilibs:
64 if lib in seen_libs:
65 tune_error_set.append("The multilib '%s' appears more than once." % lib)
66 else:
67 seen_libs.append(lib)
68 tune = data.getVar("DEFAULTTUNE_virtclass-multilib-%s" % lib, True)
69 if tune in seen_tunes:
70 tune_error_set.append("The tuning '%s' appears in more than one multilib." % tune)
71 else:
72 seen_libs.append(tune)
73 if tune == deftune:
74 tune_error_set.append("Multilib '%s' (%s) is also the default tuning." % (lib, deftune))
75 else:
76 tune_errors = check_toolchain_tune(data, tune, lib)
77 if tune_errors:
78 tune_error_set.append(tune_errors)
79 if tune_error_set:
80 return "Toolchain tunings invalid:\n" + '\n'.join(tune_error_set)
81
82 return ""
83
14def check_conf_exists(fn, data): 84def check_conf_exists(fn, data):
15 bbpath = [] 85 bbpath = []
16 fn = data.expand(fn) 86 fn = data.expand(fn)
@@ -327,6 +397,9 @@ def check_sanity(e):
327 messages = messages + pseudo_msg + '\n' 397 messages = messages + pseudo_msg + '\n'
328 398
329 check_supported_distro(e) 399 check_supported_distro(e)
400 toolchain_msg = check_toolchain(e.data)
401 if toolchain_msg != "":
402 messages = messages + toolchain_msg + '\n'
330 403
331 # Check if DISPLAY is set if IMAGETEST is set 404 # Check if DISPLAY is set if IMAGETEST is set
332 if not data.getVar( 'DISPLAY', e.data, True ) and data.getVar( 'IMAGETEST', e.data, True ) == 'qemu': 405 if not data.getVar( 'DISPLAY', e.data, True ) and data.getVar( 'IMAGETEST', e.data, True ) == 'qemu':
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 3e40a77a40..004a16c6a7 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -36,6 +36,12 @@ for hardware floating point instructions."
36 36
37TUNEVALID[doc] = "Descriptions of valid tuning features, stored as flags." 37TUNEVALID[doc] = "Descriptions of valid tuning features, stored as flags."
38TUNECONFLICTS[doc] = "List of conflicting features for a given feature." 38TUNECONFLICTS[doc] = "List of conflicting features for a given feature."
39TUNEABI[doc] = "An underlying ABI used by a particular tuning in a given \
40toolchain layer. This feature allows providers using prebuilt \
41libraries to check compatibility of a tuning against their selection \
42of libraries."
43TUNEABI_WHITELIST[doc] = "A whitelist of permissible TUNEABI values; if unset, all are allowed."
44TUNEABI_OVERRIDE[doc] = "If set, ignores TUNEABI_WHITELIST."
39 45
40ASSUME_PROVIDED[doc] = "List of packages (recipes actually) which are assumed to be implicitly available.\ 46ASSUME_PROVIDED[doc] = "List of packages (recipes actually) which are assumed to be implicitly available.\
41 These packages won't be built by bitbake." 47 These packages won't be built by bitbake."