Changeset 74da24c in rtems-source-builder


Ignore:
Timestamp:
May 8, 2014, 2:58:14 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
5850ac9
Parents:
2a6acc7
git-author:
Chris Johns <chrisj@…> (05/08/14 02:58:14)
git-committer:
Chris Johns <chrisj@…> (05/08/14 03:20:29)
Message:

sb: Generate an error report on an error.

Generate an error report users can send to the mailing list with
error details.

Location:
source-builder/sb
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/build.py

    r2a6acc7 r74da24c  
    3737    import download
    3838    import error
     39    import ereport
    3940    import execute
    4041    import log
     
    263264        exit_code, proc, output = e.shell(cmd, cwd = path.host(cwd))
    264265        if exit_code != 0:
    265             raise error.general('shell cmd failed: %s' % (cmd))
     266            log.output('shell cmd failed: %s' % (cmd))
     267            raise error.general('building %s' % (self.macros['buildname']))
    266268
    267269    def builddir(self):
     
    432434
    433435def run(args):
     436    ec = 0
     437    opts = None
     438    b = None
     439    erheader = None
    434440    try:
    435441        optargs = { '--list-configs': 'List available configurations' }
     
    452458                b = build(config_file, True, opts)
    453459                b.make()
    454                 del b
     460                b = None
    455461    except error.general, gerr:
    456         print gerr
    457         print >> sys.stderr, 'Build FAILED'
    458         sys.exit(1)
     462        erheader = 'Build: %s' % (gerr)
     463        log.notice(str(gerr))
     464        log.stderr('Build FAILED')
     465        ec = 1
    459466    except error.internal, ierr:
    460         print ierr
    461         print >> sys.stderr, 'Build FAILED'
    462         sys.exit(1)
     467        erheader = 'Build: %s' % (ierr)
     468        log.notice(str(ierr))
     469        log.stderr('Internal Build FAILED')
     470        ec = 1
    463471    except error.exit, eerr:
    464472        pass
    465473    except KeyboardInterrupt:
    466474        log.notice('abort: user terminated')
    467         sys.exit(1)
    468     sys.exit(0)
     475        ec = 1
     476    if (ec != 0 and erheader and opts and b) or (opts and opts.dry_run()):
     477        if opts.dry_run():
     478            bname = 'dry-run'
     479        else:
     480            bname = b.name()
     481        ereport.generate('rsb-report-%s.txt' % (bname), opts, erheader)
     482    sys.exit(ec)
    469483
    470484if __name__ == "__main__":
  • source-builder/sb/freebsd.py

    r2a6acc7 r74da24c  
    8484        if check.check_exe(cxx, cxx):
    8585            defines['__cxx'] = cxx
    86             defines['optflags_build'] = '-O2 -pipe -fbracket-depth=1024'
     86            #defines['optflags_build'] = '-O2 -pipe -fbracket-depth=1024'
    8787        cvs = 'cvs'
    8888        if check.check_exe(cvs, cvs):
  • source-builder/sb/git.py

    r2a6acc7 r74da24c  
    5151        return exit_code, output
    5252
    53     def __init__(self, _path, opts, macros = None):
     53    def __init__(self, _path, opts = None, macros = None):
    5454        self.path = _path
    5555        self.opts = opts
    56         if macros is None:
     56        if macros is None and opts is not None:
    5757            self.macros = opts.defaults
    5858        else:
  • source-builder/sb/log.py

    r2a6acc7 r74da24c  
    8787        default.flush()
    8888
     89def tail(log = None):
     90    if log is not None:
     91        return log.tail
     92    if default is not None:
     93        return default.tail
     94    return 'No log output'
     95
    8996class log:
    9097    """Log output to stdout or a file."""
    91     def __init__(self, streams = None, tail_size = 100):
     98    def __init__(self, streams = None, tail_size = 200):
    9299        self.tail = []
    93100        self.tail_size = tail_size
  • source-builder/sb/options.py

    r2a6acc7 r74da24c  
    304304            repo_head = repo.head()
    305305            repo_clean = not repo.dirty()
     306            repo_remotes = '%{nil}'
     307            remotes = repo.remotes()
     308            if 'origin' in remotes:
     309                repo_remotes = '%s/origin' % (remotes['origin']['url'])
    306310            repo_id = repo_head
    307311            if not repo_clean:
     
    312316            repo_head = '%{nil}'
    313317            repo_clean = '%{nil}'
     318            repo_remotes = '%{nil}'
    314319            repo_id = 'no-repo'
    315320            repo_mail = None
     
    317322        self.defaults['_sbgit_head']  = repo_head
    318323        self.defaults['_sbgit_clean'] = str(repo_clean)
     324        self.defaults['_sbgit_remotes'] = str(repo_remotes)
    319325        self.defaults['_sbgit_id']    = repo_id
    320326        if repo_mail is not None:
     
    463469        return self.opts['no-download'] != '0'
    464470
     471    def info(self):
     472        s = ' Command Line: %s%s' % (' '.join(self.argv), os.linesep)
     473        s += ' Python: %s' % (sys.version.replace('\n', ''))
     474        return s
     475
    465476    def log_info(self):
    466         log.output(' Command Line: %s' % (' '.join(self.argv)))
    467         log.output(' Python: %s' % (sys.version.replace('\n', '')))
     477        log.output(self.info())
    468478
    469479def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'):
  • source-builder/sb/setbuilder.py

    r2a6acc7 r74da24c  
    3434    import check
    3535    import error
     36    import ereport
    3637    import log
    3738    import mailer
     
    424425def run():
    425426    import sys
     427    ec = 0
     428    opts = None
     429    b = None
     430    erheader = None
    426431    try:
    427432        optargs = { '--list-configs':  'List available configurations',
     
    451456                b = buildset(bset, configs, opts)
    452457                b.build(deps)
    453                 del b
     458                b = None
    454459        if deps is not None:
    455460            c = 0
     
    458463                print 'dep[%d]: %s' % (c, d)
    459464    except error.general, gerr:
     465        erheader = 'Build: %s' % (gerr)
    460466        log.notice(str(gerr))
    461         print >> sys.stderr, 'Build FAILED'
    462         sys.exit(1)
     467        log.stderr('Build FAILED')
     468        ec = 1
    463469    except error.internal, ierr:
     470        erheader = 'Build: %s' % (ierr)
    464471        log.notice(str(ierr))
    465         sys.exit(1)
     472        log.stderr('Internal Build FAILED')
     473        ec = 1
    466474    except error.exit, eerr:
    467475        pass
    468476    except KeyboardInterrupt:
    469477        log.notice('abort: user terminated')
    470         sys.exit(1)
    471     sys.exit(0)
     478        ec = 1
     479    if (ec != 0 and erheader and opts and b) or (opts and opts.dry_run()):
     480        if opts.dry_run():
     481            bset = 'dry-run'
     482        else:
     483            bset = b.bset
     484        ereport.generate('rsb-report-%s.txt' % (bset), opts, erheader)
     485    sys.exit(ec)
    472486
    473487if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.