diff options
author | Beat Bolli <dev@drbeat.li> | 2016-02-20 13:21:06 +0100 |
---|---|---|
committer | Jon Schlueter <jschlueter@redhat.com> | 2016-02-20 11:44:57 -0500 |
commit | 06aac6020a56f027669ff9505c3b48cfbd13b7b7 (patch) | |
tree | cbb30d1cf8314cf8482a827da956890098205502 /devtools | |
parent | 1b0b9ed1efcf91cb57950ec3f8115cd49978cd33 (diff) | |
download | gpsd-06aac6020a56f027669ff9505c3b48cfbd13b7b7.tar.gz |
Eliminate duplicate code when running the build command.
Signed-off-by: Beat Bolli <dev@drbeat.li>
Signed-off-by: Jon Schlueter <jschlueter@redhat.com>
Diffstat (limited to 'devtools')
-rwxr-xr-x | devtools/identify_failing_build_options.py | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/devtools/identify_failing_build_options.py b/devtools/identify_failing_build_options.py index e9e03ee7..9a53498f 100755 --- a/devtools/identify_failing_build_options.py +++ b/devtools/identify_failing_build_options.py @@ -84,6 +84,15 @@ def main(starting_number_of_options=0): failed_configurations = [] dev_null = open('/dev/null', 'w') + def _run(command, phase): + if subprocess.call(command, stdout=dev_null) == 0: + return True + failed_configurations.append(command) + print command + with open(phase + '_build_configs.txt', 'a') as failed_configs: + failed_configs.write(' '.join(command) + '\n') + return False + static_params = [key + '=on' for key in always_on] static_params += [key + '=off' for key in always_off] @@ -96,27 +105,12 @@ def main(starting_number_of_options=0): # print {'on_params': row, 'scons_params': params} - command = ['scons', '-j9'] - command.extend(params) if os.path.exists('.scons-option-cache'): os.remove('.scons-option-cache') - retval = subprocess.call(['scons', '-c'], stdout=dev_null) - - retval = subprocess.call(command, stdout=dev_null) - if retval != 0: - failed_configurations.append(command) - print command - with open('failed_build_configs.txt', 'a') as failed_configs: - failed_configs.write(' '.join(command) + '\n') - - if retval == 0: - command = ['scons', 'check'] - command.extend(params) - retval = subprocess.call(command, stdout=dev_null) - if retval != 0: - print command - with open('check_build_configs.txt', 'a') as failed_configs: - failed_configs.write(str(retval) + ' ' + ' '.join(command) + '\n') + subprocess.call(['scons', '-c'], stdout=dev_null) + + if _run(['scons', '-j9'] + params, 'build'): + _run(['scons', 'check'] + params, 'check') return failed_configurations @@ -124,5 +118,3 @@ if __name__ == '__main__': failed = main(0) for row in failed: print ' '.join(row) - - |