[rtems-source-builder commit] sb: Move the option check for reporting errors to the error reporter.
Chris Johns
chrisj at rtems.org
Thu Oct 12 02:52:03 UTC 2017
Module: rtems-source-builder
Branch: master
Commit: 6dc551cf47eda01941449f70f106630ea508fa06
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=6dc551cf47eda01941449f70f106630ea508fa06
Author: Chris Johns <chrisj at rtems.org>
Date: Thu Oct 12 13:40:12 2017 +1100
sb: Move the option check for reporting errors to the error reporter.
Updates #2536.
---
source-builder/sb/build.py | 7 ++----
source-builder/sb/ereport.py | 60 +++++++++++++++++++++++---------------------
2 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index b995e6b..e28a831 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -111,11 +111,8 @@ class build:
return name
def _generate_report_(self, header, footer = None):
- label, result = self.opts.with_arg('error-report')
- if (label.startswith('without_') and result != 'yes') or \
- (label.startswith('with_') and result != 'no'):
- ereport.generate('rsb-report-%s.txt' % self.macros['name'],
- self.opts, header, footer)
+ ereport.generate('rsb-report-%s.txt' % self.macros['name'],
+ self.opts, header, footer)
def __init__(self, name, create_tar_files, opts, macros = None):
try:
diff --git a/source-builder/sb/ereport.py b/source-builder/sb/ereport.py
index 88aaa16..475eff7 100755
--- a/source-builder/sb/ereport.py
+++ b/source-builder/sb/ereport.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2014 Chris Johns (chrisj at rtems.org)
+# Copyright 2010-2017 Chris Johns (chrisj at rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-testing'.
@@ -21,36 +21,40 @@
# Create an error log.
#
+from __future__ import print_function
+
import os
import error
import log
def generate(name, opts, header = None, footer = None):
- r = ['RTEMS Tools Project - Source Builder Error Report'] + []
- if header:
- r += [' %s' % (header)]
- r += [opts.info()]
- if opts.defaults.get_value('%{_sbgit_valid}') == '1':
- r += [' %s/%s' % (opts.defaults.get_value('%{_sbgit_remotes}'),
- opts.defaults.get_value('%{_sbgit_id}'))]
- else:
- r += [' RSB: not a valid repo']
- if os.name == 'nt':
- r += [' Windows']
- else:
- r += [' %s' % (' '.join(os.uname()))]
- r += []
- r += ['Tail of the build log:']
- r += log.tail()
- if footer:
- r += [footer]
- try:
- name = name.replace('/', '-')
- l = open(name, 'w')
- l.write(os.linesep.join(r))
- l.close()
- log.notice(' See error report: %s' % (name))
- except:
- log.stderr('error: failure to create error report')
- raise
+ label, result = opts.with_arg('error-report')
+ if (label.startswith('without_') and result != 'yes') or \
+ (label.startswith('with_') and result != 'no'):
+ r = ['RTEMS Tools Project - Source Builder Error Report'] + []
+ if header:
+ r += [' %s' % (header)]
+ r += [opts.info()]
+ if opts.defaults.get_value('%{_sbgit_valid}') == '1':
+ r += [' %s/%s' % (opts.defaults.get_value('%{_sbgit_remotes}'),
+ opts.defaults.get_value('%{_sbgit_id}'))]
+ else:
+ r += [' RSB: not a valid repo']
+ if os.name == 'nt':
+ r += [' Windows']
+ else:
+ r += [' %s' % (' '.join(os.uname()))]
+ r += []
+ r += ['Tail of the build log:']
+ r += log.tail()
+ if footer:
+ r += [footer]
+ try:
+ name = name.replace('/', '-')
+ with open(name, 'w') as l:
+ l.write(os.linesep.join(r))
+ log.notice(' See error report: %s' % (name))
+ except:
+ log.stderr('error: failure to create error report')
+ raise
More information about the vc
mailing list