mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Improve the error handling for setbuilder errors.
If an error happens in the setbuilder code report the error. Errors in the build phase are logged in the RSB Error Report.
This commit is contained in:
parent
cbf576e923
commit
120e101ca3
@ -288,6 +288,8 @@ class buildset:
|
|||||||
|
|
||||||
def build(self, deps = None, nesting_count = 0):
|
def build(self, deps = None, nesting_count = 0):
|
||||||
|
|
||||||
|
build_error = False
|
||||||
|
|
||||||
nesting_count += 1
|
nesting_count += 1
|
||||||
|
|
||||||
log.trace('_bset: %s: make' % (self.bset))
|
log.trace('_bset: %s: make' % (self.bset))
|
||||||
@ -296,10 +298,6 @@ class buildset:
|
|||||||
if self.opts.get_arg('--mail'):
|
if self.opts.get_arg('--mail'):
|
||||||
mail_report_subject = '%s %s' % (self.bset, self.macros.expand('%{_host}'))
|
mail_report_subject = '%s %s' % (self.bset, self.macros.expand('%{_host}'))
|
||||||
|
|
||||||
configs = self.load()
|
|
||||||
|
|
||||||
log.trace('_bset: %s: configs: %s' % (self.bset, ','.join(configs)))
|
|
||||||
|
|
||||||
current_path = os.environ['PATH']
|
current_path = os.environ['PATH']
|
||||||
|
|
||||||
start = datetime.datetime.now()
|
start = datetime.datetime.now()
|
||||||
@ -308,6 +306,10 @@ class buildset:
|
|||||||
have_errors = False
|
have_errors = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
configs = self.load()
|
||||||
|
|
||||||
|
log.trace('_bset: %s: configs: %s' % (self.bset, ','.join(configs)))
|
||||||
|
|
||||||
builds = []
|
builds = []
|
||||||
for s in range(0, len(configs)):
|
for s in range(0, len(configs)):
|
||||||
b = None
|
b = None
|
||||||
@ -327,8 +329,12 @@ class buildset:
|
|||||||
elif configs[s].endswith('.cfg'):
|
elif configs[s].endswith('.cfg'):
|
||||||
mail_report = self.opts.get_arg('--mail')
|
mail_report = self.opts.get_arg('--mail')
|
||||||
log.trace('_bset: -- %2d %s' % (nesting_count + 1, '-' * 75))
|
log.trace('_bset: -- %2d %s' % (nesting_count + 1, '-' * 75))
|
||||||
b = build.build(configs[s], self.opts.get_arg('--pkg-tar-files'),
|
try:
|
||||||
opts, macros)
|
b = build.build(configs[s], self.opts.get_arg('--pkg-tar-files'),
|
||||||
|
opts, macros)
|
||||||
|
except:
|
||||||
|
build_error = True
|
||||||
|
raise
|
||||||
if b.macros.get('%{_disable_reporting}'):
|
if b.macros.get('%{_disable_reporting}'):
|
||||||
mail_report = False
|
mail_report = False
|
||||||
if deps is None:
|
if deps is None:
|
||||||
@ -378,6 +384,8 @@ class buildset:
|
|||||||
for b in builds:
|
for b in builds:
|
||||||
del b
|
del b
|
||||||
except error.general, gerr:
|
except error.general, gerr:
|
||||||
|
if not build_error:
|
||||||
|
log.stderr(str(gerr))
|
||||||
raise
|
raise
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
mail_report = False
|
mail_report = False
|
||||||
@ -427,6 +435,7 @@ def list_bset_cfg_files(opts, configs):
|
|||||||
def run():
|
def run():
|
||||||
import sys
|
import sys
|
||||||
ec = 0
|
ec = 0
|
||||||
|
setbuilder_error = False
|
||||||
try:
|
try:
|
||||||
optargs = { '--list-configs': 'List available configurations',
|
optargs = { '--list-configs': 'List available configurations',
|
||||||
'--list-bsets': 'List available build sets',
|
'--list-bsets': 'List available build sets',
|
||||||
@ -452,18 +461,24 @@ def run():
|
|||||||
not path.ispathwritable(prefix):
|
not path.ispathwritable(prefix):
|
||||||
raise error.general('prefix is not writable: %s' % (path.host(prefix)))
|
raise error.general('prefix is not writable: %s' % (path.host(prefix)))
|
||||||
for bset in opts.params():
|
for bset in opts.params():
|
||||||
|
setbuilder_error = True
|
||||||
b = buildset(bset, configs, opts)
|
b = buildset(bset, configs, opts)
|
||||||
b.build(deps)
|
b.build(deps)
|
||||||
b = None
|
b = None
|
||||||
|
setbuilder_error = False
|
||||||
if deps is not None:
|
if deps is not None:
|
||||||
c = 0
|
c = 0
|
||||||
for d in sorted(set(deps)):
|
for d in sorted(set(deps)):
|
||||||
c += 1
|
c += 1
|
||||||
print 'dep[%d]: %s' % (c, d)
|
print 'dep[%d]: %s' % (c, d)
|
||||||
except error.general, gerr:
|
except error.general, gerr:
|
||||||
|
if not setbuilder_error:
|
||||||
|
log.stderr(str(gerr))
|
||||||
log.stderr('Build FAILED')
|
log.stderr('Build FAILED')
|
||||||
ec = 1
|
ec = 1
|
||||||
except error.internal, ierr:
|
except error.internal, ierr:
|
||||||
|
if not setbuilder_error:
|
||||||
|
log.stderr(str(ierr))
|
||||||
log.stderr('Internal Build FAILED')
|
log.stderr('Internal Build FAILED')
|
||||||
ec = 1
|
ec = 1
|
||||||
except error.exit, eerr:
|
except error.exit, eerr:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user