[rtems-source-builder commit] sb: Add platform reporting for better host reviewing in posted email reports.
Chris Johns
chrisj at rtems.org
Tue Oct 31 00:57:38 UTC 2017
Module: rtems-source-builder
Branch: master
Commit: 4dc9bf3a374b3e97a746fb1b6d080619ff7f5d90
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=4dc9bf3a374b3e97a746fb1b6d080619ff7f5d90
Author: Chris Johns <chrisj at rtems.org>
Date: Tue Oct 31 11:57:21 2017 +1100
sb: Add platform reporting for better host reviewing in posted email reports.
---
source-builder/sb/reports.py | 12 ++++++++++++
source-builder/sb/setbuilder.py | 18 +++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/source-builder/sb/reports.py b/source-builder/sb/reports.py
index 046045c..9d3a342 100644
--- a/source-builder/sb/reports.py
+++ b/source-builder/sb/reports.py
@@ -64,6 +64,18 @@ def _make_path(p, *args):
p = path.join(p, arg)
return os.path.abspath(path.host(p))
+def platform(mode = 'all'):
+ import platform
+ if mode == 'system':
+ return platform.system()
+ compact = platform.platform(aliased = True)
+ if mode == 'compact':
+ return compact
+ extended = ' '.join(platform.uname())
+ if mode == 'extended':
+ return extended
+ return '%s (%s)' % (short, extended)
+
class formatter(object):
def __init__(self):
self.content = ''
diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index 590e201..17b781a 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -30,6 +30,7 @@ import glob
import operator
import os
import sys
+import textwrap
try:
import build
@@ -341,7 +342,8 @@ class buildset:
log.trace('_bset: %s: make' % (self.bset))
log.notice('Build Set: %s' % (self.bset))
- mail_subject = '%s on %s' % (self.bset, self.macros.expand('%{_host}'))
+ mail_subject = '%s on %s' % (self.bset,
+ self.macros.expand('%{_host}'))
current_path = os.environ['PATH']
@@ -472,10 +474,12 @@ class buildset:
self.write_mail_header('Build Time: %s' % (build_time), True)
self.write_mail_header('', True)
if self.build_failure is not None:
- mail_subject = 'Build : FAILED %s (%s)' % \
+ mail_subject = 'FAILED %s (%s)' % \
(mail_subject, self.build_failure)
else:
- mail_subject = 'Build : PASSED %s' % (mail_subject)
+ mail_subject = 'PASSED %s' % (mail_subject)
+ mail_subject = 'Build %s: %s' % (reports.platform(mode = 'system'),
+ mail_subject)
self.write_mail_header(mail['header'], True)
self.write_mail_header('')
log.notice('Mailing report: %s' % (mail['to']))
@@ -534,9 +538,13 @@ def run():
if not check.host_setup(opts):
raise error.general('host build environment is not set up correctly')
if mail:
- mail['header'] = os.linesep.join(mail['output'].get())
+ mail['header'] = os.linesep.join(mail['output'].get()) + os.linesep
mail['header'] += os.linesep
- mail['header'] += opts.info() + os.linesep
+ mail['header'] += 'Host: ' + reports.platform('compact') + os.linesep
+ indent = ' '
+ for l in textwrap.wrap(reports.platform('extended'),
+ width = 80 - len(indent)):
+ mail['header'] += indent + l + os.linesep
configs = build.get_configs(opts)
if opts.get_arg('--list-deps'):
deps = []
More information about the vc
mailing list