From 3bd8def2106f831d3af4fca61bb00881b3a6e2c0 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Wed, 3 Oct 2018 11:38:09 +1000 Subject: config: Consolidate the version information into a single configuration file --- tester/rt/check.py | 33 +++++++++++++++------------------ tester/rt/options.py | 2 +- tester/rt/run.py | 2 +- tester/rt/test.py | 2 +- 4 files changed, 18 insertions(+), 21 deletions(-) (limited to 'tester') diff --git a/tester/rt/check.py b/tester/rt/check.py index 0f9ee13..f2addbd 100755 --- a/tester/rt/check.py +++ b/tester/rt/check.py @@ -64,6 +64,9 @@ log_lock = threading.Lock() # max_build_label = 0 +def _now(): + return datetime.datetime.now() + def rtems_version(): return version.version() @@ -99,7 +102,7 @@ def comma_split(options): return [o.strip() for o in options.split(',')] def title(): - return 'RTEMS Tools Project - RTEMS Kernel BSP Builder, %s' % (version.str()) + return 'RTEMS Tools Project - RTEMS Kernel BSP Builder, %s' % (version.string()) def command_line(): return wrap(('command: ', ' '.join(sys.argv)), lineend = '\\') @@ -156,10 +159,10 @@ class arch_bsp_build: return self.arch, self.bsp def start(self): - self.start_time = datetime.datetime.now() + self.start_time = _now() def stop(self): - self.stop_time = datetime.datetime.now() + self.stop_time = _now() def duration(self): return self.stop_time - self.start_time @@ -988,8 +991,7 @@ class builder: with open(self.options['warnings-report'], 'w') as f: f.write(title() + os.linesep) f.write(os.linesep) - f.write('Date: %s%s' % (datetime.datetime.now().strftime('%c'), - os.linesep)) + f.write('Date: %s%s' % (_now().strftime('%c'), os.linesep)) f.write(os.linesep) f.write(command_line() + os.linesep) f.write(self.results.warnings_errors.warnings_report()) @@ -999,8 +1001,7 @@ class builder: with open(self.options['failures-report'], 'w') as f: f.write(title() + os.linesep) f.write(os.linesep) - f.write('Date: %s%s' % (datetime.datetime.now().strftime('%c'), - os.linesep)) + f.write('Date: %s%s' % (_now().strftime('%c'), os.linesep)) f.write(os.linesep) f.write(command_line() + os.linesep) f.write(self.results.failures_report()) @@ -1022,8 +1023,8 @@ class builder: if path.exists(self.build_dir): log.notice('Cleaning: %s' % (self.build_dir)) path.removeall(self.build_dir) - self.start = datetime.datetime.now() - self.end = datetime.datetime.now() + self.start = _now() + self.end = _now() self.duration = self.end - self.start self.average = self.duration env_path = os.environ['PATH'] @@ -1063,7 +1064,7 @@ class builder: except: pass raise - self.end = datetime.datetime.now() + self.end = _now() os.environ['PATH'] = env_path self.duration = self.end - self.start if self.jobs_completed == 0: @@ -1123,16 +1124,12 @@ def run_args(args): try: rtems.clean_windows_path() - start = datetime.datetime.now() - top = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) + start = _now() prefix = '/opt/rtems/%s' % (rtems_version()) tools = prefix build_dir = 'bsp-builds' - logf = 'bsp-build-%s.txt' % \ - (datetime.datetime.now().strftime('%Y%m%d-%H%M%S')) - config_file = path.join(top, 'config', 'rtems-bsps.ini') - if not path.exists(config_file): - config_file = path.join(top, 'share', 'rtems', 'config', 'rtems-bsps.ini') + logf = 'bsp-build-%s.txt' % (_now().strftime('%Y%m%d-%H%M%S')) + config_file = rtems.bsp_configuration_file() argsp = argparse.ArgumentParser() argsp.add_argument('--prefix', help = 'Prefix to build the BSP.', @@ -1249,7 +1246,7 @@ def run_args(args): else: what = 'Profile(s): %s' % (' '.join(profiles)) b.build_profiles(profiles) - end = datetime.datetime.now() + end = _now() # # Email the results of the build. diff --git a/tester/rt/options.py b/tester/rt/options.py index d41b721..da743c1 100644 --- a/tester/rt/options.py +++ b/tester/rt/options.py @@ -109,7 +109,7 @@ def load(args, optargs = None, def run(args): try: _opts = load(args = args, defaults = defaults_mc) - log.notice('RTEMS Test - Defaults, v%s' % (version.str())) + log.notice('RTEMS Test - Defaults, v%s' % (version.string())) _opts.log_info() log.notice('Options:') log.notice(str(_opts)) diff --git a/tester/rt/run.py b/tester/rt/run.py index cf8c4e5..1f4fa3a 100644 --- a/tester/rt/run.py +++ b/tester/rt/run.py @@ -114,7 +114,7 @@ def run(command_path = None): opts = options.load(sys.argv, optargs = optargs, command_path = command_path) - log.notice('RTEMS Testing - Run, %s' % (version.str())) + log.notice('RTEMS Testing - Run, %s' % (version.string())) if opts.find_arg('--list-bsps'): bsps.list(opts) opts.log_info() diff --git a/tester/rt/test.py b/tester/rt/test.py index 9214ad6..c5d61d8 100644 --- a/tester/rt/test.py +++ b/tester/rt/test.py @@ -250,7 +250,7 @@ def run(command_path = None): else: to_addr = 'build@rtems.org' output = log_capture() - log.notice('RTEMS Testing - Tester, %s' % (version.str())) + log.notice('RTEMS Testing - Tester, %s' % (version.string())) if opts.find_arg('--list-bsps'): bsps.list(opts) exe_filter = opts.find_arg('--filter') -- cgit v1.2.3