summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/setbuilder.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-05-08 02:58:14 +0000
committerChris Johns <chrisj@rtems.org>2014-05-08 13:20:29 +1000
commit74da24cb61ef4478ca499c029a732cdba13ee668 (patch)
treef8eddd16894d6464ec036a4be4a0054b45be0ada /source-builder/sb/setbuilder.py
parentconfig: Fix the host and build options for Canadian cross builds. (diff)
downloadrtems-source-builder-74da24cb61ef4478ca499c029a732cdba13ee668.tar.bz2
sb: Generate an error report on an error.
Generate an error report users can send to the mailing list with error details.
Diffstat (limited to 'source-builder/sb/setbuilder.py')
-rw-r--r--source-builder/sb/setbuilder.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index 1491e9b..690c37b 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -33,6 +33,7 @@ try:
import build
import check
import error
+ import ereport
import log
import mailer
import options
@@ -423,6 +424,10 @@ def list_bset_cfg_files(opts, configs):
def run():
import sys
+ ec = 0
+ opts = None
+ b = None
+ erheader = None
try:
optargs = { '--list-configs': 'List available configurations',
'--list-bsets': 'List available build sets',
@@ -450,25 +455,34 @@ def run():
for bset in opts.params():
b = buildset(bset, configs, opts)
b.build(deps)
- del b
+ b = None
if deps is not None:
c = 0
for d in sorted(set(deps)):
c += 1
print 'dep[%d]: %s' % (c, d)
except error.general, gerr:
+ erheader = 'Build: %s' % (gerr)
log.notice(str(gerr))
- print >> sys.stderr, 'Build FAILED'
- sys.exit(1)
+ log.stderr('Build FAILED')
+ ec = 1
except error.internal, ierr:
+ erheader = 'Build: %s' % (ierr)
log.notice(str(ierr))
- sys.exit(1)
+ log.stderr('Internal Build FAILED')
+ ec = 1
except error.exit, eerr:
pass
except KeyboardInterrupt:
log.notice('abort: user terminated')
- sys.exit(1)
- sys.exit(0)
+ ec = 1
+ if (ec != 0 and erheader and opts and b) or (opts and opts.dry_run()):
+ if opts.dry_run():
+ bset = 'dry-run'
+ else:
+ bset = b.bset
+ ereport.generate('rsb-report-%s.txt' % (bset), opts, erheader)
+ sys.exit(ec)
if __name__ == "__main__":
run()