source: rtems-source-builder/source-builder/sb/ereport.py @ d4eb08f

4.104.114.9
Last change on this file since d4eb08f was d4eb08f, checked in by Chris Johns <chrisj@…>, on Feb 7, 2015 at 6:58:17 AM

Windows native build fixes.

The testing of building on Windows is done using MSYS2.

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
4# All rights reserved.
5#
6# This file is part of the RTEMS Tools package in 'rtems-testing'.
7#
8# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20#
21# Create an error log.
22#
23
24import os
25
26import error
27import log
28
29def generate(name, opts, header = None, footer = None):
30    r = ['RTEMS Tools Project - Source Builder Error Report'] + []
31    if header:
32        r += [' %s' % (header)]
33    r += [opts.info()]
34    if opts.defaults.get_value('%{_sbgit_valid}') == '1':
35        r += [' %s/%s' % (opts.defaults.get_value('%{_sbgit_remotes}'),
36                          opts.defaults.get_value('%{_sbgit_id}'))]
37    else:
38        r += [' RSB: not a valid repo']
39    if os.name == 'nt':
40        r += [' Windows']
41    else:
42        r += [' %s' % (' '.join(os.uname()))]
43    r += []
44    r += ['Tail of the build log:']
45    r += log.tail()
46    if footer:
47        r += [footer]
48    try:
49        name = name.replace('/', '-')
50        l = open(name, 'w')
51        l.write(os.linesep.join(r))
52        l.close()
53        log.notice('  See error report: %s' % (name))
54    except:
55        log.stderr('error: failure to create error report')
56        raise
Note: See TracBrowser for help on using the repository browser.