diff options
author | Uri Simchoni <urisimchoni@gmail.com> | 2015-05-18 21:12:06 +0300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2015-05-20 11:19:11 +0200 |
commit | 3fb617310df73795fbb761253f27052ae5afa40b (patch) | |
tree | 78b329e9cfa27425301c82603c10dc75ab9b5b02 /buildtools | |
parent | 843c373d008cd51940f08a7a291976b6e80a5fbf (diff) | |
download | samba-3fb617310df73795fbb761253f27052ae5afa40b.tar.gz |
waf: sanitize and fix added cross answer
When configuring samba for cross-compilation using the cross-answers
method, the function add_answer receives the standard output and exit code
of a configuration test and updates the cross-answers file accordingly.
This patch sanitizes the standard output to conform to the cross-answers
file format - one line of output. It also adds a missing newline.
(Note - at this point add_answer is only ever called with empty output
but this change is significant for the reminder of this patchset)
Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r-- | buildtools/wafsamba/samba_cross.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py index 877ead85815..b48155336d8 100644 --- a/buildtools/wafsamba/samba_cross.py +++ b/buildtools/wafsamba/samba_cross.py @@ -19,6 +19,16 @@ def add_answer(ca_file, msg, answer): except: Logs.error("Unable to open cross-answers file %s" % ca_file) sys.exit(1) + (retcode, retstring) = answer + # if retstring is more than one line then we probably + # don't care about its actual content (the tests should + # yield one-line output in order to comply with the cross-answer + # format) + retstring = retstring.strip() + if len(retstring.split('\n')) > 1: + retstring = '' + answer = (retcode, retstring) + if answer == ANSWER_OK: f.write('%s: OK\n' % msg) elif answer == ANSWER_UNKNOWN: @@ -26,8 +36,7 @@ def add_answer(ca_file, msg, answer): elif answer == ANSWER_FAIL: f.write('%s: FAIL\n' % msg) else: - (retcode, retstring) = answer - f.write('%s: (%d, "%s")' % (msg, retcode, retstring)) + f.write('%s: (%d, "%s")\n' % (msg, retcode, retstring)) f.close() |