[rtems-source-builder commit] sb: Add XML formatter
Sebastian Huber
sebh at rtems.org
Thu Dec 11 07:10:22 UTC 2014
Module: rtems-source-builder
Branch: master
Commit: 1f77f9e36b299d7336c95213b01d2051c99bd2f4
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=1f77f9e36b299d7336c95213b01d2051c99bd2f4
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Dec 5 06:44:36 2014 +0100
sb: Add XML formatter
---
source-builder/sb/reports.py | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/source-builder/sb/reports.py b/source-builder/sb/reports.py
index f158925..4c7c585 100644
--- a/source-builder/sb/reports.py
+++ b/source-builder/sb/reports.py
@@ -89,6 +89,9 @@ class formatter(object):
c.line('Report: %s' % (name))
return c.get()
+ def epilogue(self, name):
+ return ''
+
class asciidoc_formatter(formatter):
def format(self):
return 'asciidoc'
@@ -160,6 +163,25 @@ class ini_formatter(text_formatter):
c.line(';')
return c.get()
+class xml_formatter(formatter):
+ def format(self):
+ return 'xml'
+
+ def ext(self):
+ return '.xml'
+
+ def introduction(self, name, now, intro_text):
+ c = chunk()
+ c.line('<RTEMSSourceBuilderReport>')
+ if intro_text:
+ c.line('\t<Introduction>%s</Introduction>' % (intro_text))
+ return c.get()
+
+ def epilogue(self, name):
+ c = chunk()
+ c.line('</RTEMSSourceBuilderReport>')
+ return c.get()
+
def _tree_name(path_):
return path.splitext(path.basename(path_))[0]
@@ -298,6 +320,9 @@ class report:
self.out += self.formatter.introduction(name, now, intro_text)
self.git_status()
+ def epilogue(self, name):
+ self.out += self.formatter.epilogue(name)
+
def config_start(self, name, _config):
self.files['configs'] += [name]
for cf in _config.includes():
@@ -630,13 +655,14 @@ class report:
self.setup()
self.introduction(inname, intro_text)
self.generate(inname)
+ self.epilogue(inname)
self.write(outname)
def run(args):
try:
optargs = { '--list-bsets': 'List available build sets',
'--list-configs': 'List available configurations',
- '--format': 'Output format (text, html, asciidoc, ini)',
+ '--format': 'Output format (text, html, asciidoc, ini, xml)',
'--output': 'File name to output the report' }
opts = options.load(args, optargs)
if opts.get_arg('--output') and len(opts.params()) > 1:
@@ -663,6 +689,8 @@ def run(args):
formatter = html_formatter()
elif format_opt[1] == 'ini':
formatter = ini_formatter()
+ elif format_opt[1] == 'xml':
+ formatter = xml_formatter()
else:
raise error.general('invalid format: %s' % (format_opt[1]))
r = report(formatter, configs, opts)
More information about the vc
mailing list