diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2014-07-30 20:16:27 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-02 09:25:34 +0100 |
commit | 226f17bfd2ceea7dc5784fbfaa8608f26b90d7f3 (patch) | |
tree | ee5308a63280aa6ed755290d871560d7a1a5970e /meta/classes | |
parent | e8ee8b765183fb3ebe5e94df6375c2fad111dcc7 (diff) | |
download | openembedded-core-226f17bfd2ceea7dc5784fbfaa8608f26b90d7f3.tar.gz openembedded-core-226f17bfd2ceea7dc5784fbfaa8608f26b90d7f3.tar.bz2 openembedded-core-226f17bfd2ceea7dc5784fbfaa8608f26b90d7f3.zip |
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.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/sanity.bbclass | 52 |
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): %s""" % msg) +# Check flags associated with a tuning. +def check_toolchain_tune_args(data, tune, multilib, errs): + found_errors = False + if check_toolchain_args_present(data, tune, multilib, errs, 'CCARGS'): + found_errors = True + if check_toolchain_args_present(data, tune, multilib, errs, 'ASARGS'): + found_errors = True + if check_toolchain_args_present(data, tune, multilib, errs, 'LDARGS'): + found_errors = True + + return found_errors + +def check_toolchain_args_present(data, tune, multilib, tune_errors, which): + args_set = (data.getVar("TUNE_%s" % which, True) or "").split() + args_wanted = (data.getVar("TUNEABI_REQUIRED_%s_tune-%s" % (which, tune), True) or "").split() + args_missing = [] + + # If no args are listed/required, we are done. + if not args_wanted: + return + for arg in args_wanted: + if arg not in args_set: + args_missing.append(arg) + + found_errors = False + if args_missing: + found_errors = True + tune_errors.append("TUNEABI for %s requires '%s' in TUNE_%s (%s)." % + (tune, ' '.join(args_missing), which, ' '.join(args_set))) + return found_errors + # Check a single tune for validity. def check_toolchain_tune(data, tune, multilib): tune_errors = [] if not tune: return "No tuning found for %s multilib." % multilib + localdata = bb.data.createCopy(data) + if multilib != "default": + # Apply the overrides so we can look at the details. + overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + multilib + localdata.setVar("OVERRIDES", overrides) + bb.data.update_data(localdata) bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib)) - features = (data.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split() + features = (localdata.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split() if not features: return "Tuning '%s' has no defined features, and cannot be used." % tune - valid_tunes = data.getVarFlags('TUNEVALID') or {} - conflicts = data.getVarFlags('TUNECONFLICTS') or {} + valid_tunes = localdata.getVarFlags('TUNEVALID') or {} + conflicts = localdata.getVarFlags('TUNECONFLICTS') or {} # [doc] is the documentation for the variable, not a real feature if 'doc' in valid_tunes: del valid_tunes['doc'] @@ -113,15 +150,18 @@ def check_toolchain_tune(data, tune, multilib): bb.debug(2, " %s: %s" % (feature, valid_tunes[feature])) else: tune_errors.append("Feature '%s' is not defined." % feature) - whitelist = data.getVar("TUNEABI_WHITELIST", True) or '' - override = data.getVar("TUNEABI_OVERRIDE", True) or '' + whitelist = localdata.getVar("TUNEABI_WHITELIST", True) or '' + override = localdata.getVar("TUNEABI_OVERRIDE", True) or '' if whitelist: - tuneabi = data.getVar("TUNEABI_tune-%s" % tune, True) or '' + tuneabi = localdata.getVar("TUNEABI_tune-%s" % tune, True) or '' if not tuneabi: tuneabi = tune if True not in [x in whitelist.split() for x in tuneabi.split()]: tune_errors.append("Tuning '%s' (%s) cannot be used with any supported tuning/ABI." % (tune, tuneabi)) + else: + if not check_toolchain_tune_args(localdata, tuneabi, multilib, tune_errors): + bb.debug(2, "Sanity check: Compiler args OK for %s." % tune) if tune_errors: return "Tuning '%s' has the following errors:\n" % tune + '\n'.join(tune_errors) |