summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2014-07-30 20:16:27 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-02 09:26:17 +0100
commitbfb23e603825d00d214ac58de6df5e4764832edf (patch)
treecd03cd2a3073f58ccae085af3e632b068de80f03 /meta/classes
parentcade601651c58225a10ece507b65e7ef738a6fa9 (diff)
downloadpoky-bfb23e603825d00d214ac58de6df5e4764832edf.tar.gz
sanity.bbclass: Add ability to verify toolchain flags
When attempting to use a binary toolchain, such as meta-mentor, we want the ability to verify that the CCARGS, ASARGS and LDARGS contain the necessary and appropriate flags. This change specifically verifies, if set: TUNEABI_REQUIRED_CCARGS_tune-<tune> TUNEABI_REQUIRED_ASARGS_tune-<tune> TUNEABI_REQUIRED_LDARGS_tune-<tune> Each of these, will be processed by the class and verified that the selected tune's CCARGS, ASARGS, and LDARGS contains the listed item. This can be used to validate that the user has not accidently or otherwise missed an argument. Note, conflicting arguments are not verified. Without verification it's possible for a misconfiguration to go undetected, presenting runtime and debugging errors. (From OE-Core rev: 226f17bfd2ceea7dc5784fbfaa8608f26b90d7f3) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sanity.bbclass52
1 files changed, 46 insertions, 6 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 1ad663a057..b5fab6a668 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -87,17 +87,54 @@ def raise_sanity_error(msg, d, network_error=False):
87 87
88 %s""" % msg) 88 %s""" % msg)
89 89
90# Check flags associated with a tuning.
91def check_toolchain_tune_args(data, tune, multilib, errs):
92 found_errors = False
93 if check_toolchain_args_present(data, tune, multilib, errs, 'CCARGS'):
94 found_errors = True
95 if check_toolchain_args_present(data, tune, multilib, errs, 'ASARGS'):
96 found_errors = True
97 if check_toolchain_args_present(data, tune, multilib, errs, 'LDARGS'):
98 found_errors = True
99
100 return found_errors
101
102def check_toolchain_args_present(data, tune, multilib, tune_errors, which):
103 args_set = (data.getVar("TUNE_%s" % which, True) or "").split()
104 args_wanted = (data.getVar("TUNEABI_REQUIRED_%s_tune-%s" % (which, tune), True) or "").split()
105 args_missing = []
106
107 # If no args are listed/required, we are done.
108 if not args_wanted:
109 return
110 for arg in args_wanted:
111 if arg not in args_set:
112 args_missing.append(arg)
113
114 found_errors = False
115 if args_missing:
116 found_errors = True
117 tune_errors.append("TUNEABI for %s requires '%s' in TUNE_%s (%s)." %
118 (tune, ' '.join(args_missing), which, ' '.join(args_set)))
119 return found_errors
120
90# Check a single tune for validity. 121# Check a single tune for validity.
91def check_toolchain_tune(data, tune, multilib): 122def check_toolchain_tune(data, tune, multilib):
92 tune_errors = [] 123 tune_errors = []
93 if not tune: 124 if not tune:
94 return "No tuning found for %s multilib." % multilib 125 return "No tuning found for %s multilib." % multilib
126 localdata = bb.data.createCopy(data)
127 if multilib != "default":
128 # Apply the overrides so we can look at the details.
129 overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + multilib
130 localdata.setVar("OVERRIDES", overrides)
131 bb.data.update_data(localdata)
95 bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib)) 132 bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib))
96 features = (data.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split() 133 features = (localdata.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split()
97 if not features: 134 if not features:
98 return "Tuning '%s' has no defined features, and cannot be used." % tune 135 return "Tuning '%s' has no defined features, and cannot be used." % tune
99 valid_tunes = data.getVarFlags('TUNEVALID') or {} 136 valid_tunes = localdata.getVarFlags('TUNEVALID') or {}
100 conflicts = data.getVarFlags('TUNECONFLICTS') or {} 137 conflicts = localdata.getVarFlags('TUNECONFLICTS') or {}
101 # [doc] is the documentation for the variable, not a real feature 138 # [doc] is the documentation for the variable, not a real feature
102 if 'doc' in valid_tunes: 139 if 'doc' in valid_tunes:
103 del valid_tunes['doc'] 140 del valid_tunes['doc']
@@ -113,15 +150,18 @@ def check_toolchain_tune(data, tune, multilib):
113 bb.debug(2, " %s: %s" % (feature, valid_tunes[feature])) 150 bb.debug(2, " %s: %s" % (feature, valid_tunes[feature]))
114 else: 151 else:
115 tune_errors.append("Feature '%s' is not defined." % feature) 152 tune_errors.append("Feature '%s' is not defined." % feature)
116 whitelist = data.getVar("TUNEABI_WHITELIST", True) or '' 153 whitelist = localdata.getVar("TUNEABI_WHITELIST", True) or ''
117 override = data.getVar("TUNEABI_OVERRIDE", True) or '' 154 override = localdata.getVar("TUNEABI_OVERRIDE", True) or ''
118 if whitelist: 155 if whitelist:
119 tuneabi = data.getVar("TUNEABI_tune-%s" % tune, True) or '' 156 tuneabi = localdata.getVar("TUNEABI_tune-%s" % tune, True) or ''
120 if not tuneabi: 157 if not tuneabi:
121 tuneabi = tune 158 tuneabi = tune
122 if True not in [x in whitelist.split() for x in tuneabi.split()]: 159 if True not in [x in whitelist.split() for x in tuneabi.split()]:
123 tune_errors.append("Tuning '%s' (%s) cannot be used with any supported tuning/ABI." % 160 tune_errors.append("Tuning '%s' (%s) cannot be used with any supported tuning/ABI." %
124 (tune, tuneabi)) 161 (tune, tuneabi))
162 else:
163 if not check_toolchain_tune_args(localdata, tuneabi, multilib, tune_errors):
164 bb.debug(2, "Sanity check: Compiler args OK for %s." % tune)
125 if tune_errors: 165 if tune_errors:
126 return "Tuning '%s' has the following errors:\n" % tune + '\n'.join(tune_errors) 166 return "Tuning '%s' has the following errors:\n" % tune + '\n'.join(tune_errors)
127 167