def __init__(*k, **kw): (obj, args) = k use_answers = False ans = ANSWER_UNKNOWN # Three possibilities: # 1. Only cross-answers - try the cross-answers file, and if # there's no corresponding answer, add to the file and mark # the configure process as unfinished. # 2. Only cross-execute - get the answer from cross-execute # 3. Both - try the cross-answers file, and if there is no # corresponding answer - use cross-execute to get an answer, # and add that answer to the file. if '--cross-answers' in args: # when --cross-answers is set, then change the arguments # to use the cross answers if available use_answers = True i = args.index('--cross-answers') ca_file = args[i + 1] msg = args[i + 2] ans = cross_answer(ca_file, msg) if '--cross-execute' in args and ans == ANSWER_UNKNOWN: # when --cross-execute is set, then change the arguments # to use the cross emulator i = args.index('--cross-execute') newargs = shlex.split(args[i + 1]) newargs.extend(args[0:i]) if use_answers: p = real_Popen(newargs, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=kw.get('env', {})) ce_out, ce_err = p.communicate() ans = (p.returncode, samba_utils.get_string(ce_out)) add_answer(ca_file, msg, ans) else: args = newargs if use_answers: if ans == ANSWER_UNKNOWN: global cross_answers_incomplete cross_answers_incomplete = True add_answer(ca_file, msg, ans) (retcode, retstring) = ans args = [ '/bin/sh', '-c', "printf %%s '%s'; exit %d" % (retstring, retcode) ] real_Popen.__init__(*(obj, args), **kw)
def abi_check_task(self): '''check if the ABI has changed''' abi_gen = self.ABI_GEN libpath = self.inputs[0].abspath(self.env) libname = os.path.basename(libpath) sigs = samba_utils.get_string(Utils.cmd_output([abi_gen, libpath])) parsed_sigs = parse_sigs(sigs, self.ABI_MATCH) sig_file = self.ABI_FILE old_sigs = samba_utils.load_file(sig_file) if old_sigs is None or Options.options.ABI_UPDATE: if not save_sigs(sig_file, parsed_sigs): raise Errors.WafError('Failed to save ABI file "%s"' % sig_file) Logs.warn('Generated ABI signatures %s' % sig_file) return parsed_old_sigs = parse_sigs(old_sigs, self.ABI_MATCH) # check all old sigs got_error = False for s in parsed_old_sigs: if not s in parsed_sigs: Logs.error( '%s: symbol %s has been removed - please update major version\n\tsignature: %s' % (libname, s, parsed_old_sigs[s])) got_error = True elif normalise_varargs(parsed_old_sigs[s]) != normalise_varargs( parsed_sigs[s]): Logs.error( '%s: symbol %s has changed - please update major version\n\told_signature: %s\n\tnew_signature: %s' % (libname, s, parsed_old_sigs[s], parsed_sigs[s])) got_error = True for s in parsed_sigs: if not s in parsed_old_sigs: Logs.error( '%s: symbol %s has been added - please mark it _PRIVATE_ or update minor version\n\tsignature: %s' % (libname, s, parsed_sigs[s])) got_error = True if got_error: raise Errors.WafError( 'ABI for %s has changed - please fix library version then build with --abi-update\nSee http://wiki.samba.org/index.php/Waf#ABI_Checking for more information\nIf you have not changed any ABI, and your platform always gives this error, please configure with --abi-check-disable to skip this check' % libname)