|
From: | Jon Schlueter |
Subject: | Re: [gpsd-dev] [PATCH 4/4] Eliminate duplicate code when running the build command. |
Date: | Sat, 20 Feb 2016 11:48:42 -0500 |
Signed-off-by: Beat Bolli <address@hidden>
---
devtools/identify_failing_build_options.py | 34 ++++++++++++------------------
1 file changed, 13 insertions(+), 21 deletions(-)
diff --git a/devtools/identify_failing_build_options.py b/devtools/identify_failing_build_options.py
index e9e03ee..9a53498 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)
-
-
--
2.7.1.370.gb2aa7f8
[Prev in Thread] | Current Thread | [Next in Thread] |