diff options
author | Peter Seebach <peter.seebach@windriver.com> | 2012-05-01 11:20:22 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-09 21:42:51 +0100 |
commit | 36784da87871bbf59e77af18ed0df1a8d09fe0e7 (patch) | |
tree | 4165461737fdfd2bf10559d1a4e8f6b7a9d86e43 /meta/classes/sanity.bbclass | |
parent | 87b6197d1d2517b210273871d52c8c249c9daa51 (diff) | |
download | poky-36784da87871bbf59e77af18ed0df1a8d09fe0e7.tar.gz |
sanity.bbclass: Implement initial toolchain sanity checks
This introduces a sanity check for the toolchain, which verifies
each tuning (including any multilibs), producing meaningful diagnostics
for problems, and also provides some higher-level tuning features.
The TUNEVALID and TUNECONFLICT/TUNECONFLICTS settings were not
implemented. Listed one or two missing features in TUNEVALID,
also (in a previous patch) fixed the references to
features which didn't exist.
This patch also provides a whitelisting mechanism (which is completely
unused) to allow vendors providing prebuilt toolchain components to
restrict tunings to those based on or compatible with a particular ABI.
(From OE-Core rev: 2a91ff0ba0d587c516a5a972553280364853faa4)
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-rw-r--r-- | meta/classes/sanity.bbclass | 73 |
1 files changed, 73 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. | ||
15 | def 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 | |||
52 | def 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 | |||
14 | def check_conf_exists(fn, data): | 84 | def 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': |