"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "buildbot/reporters/generators/utils.py" between
buildbot-3.0.2.tar.gz and buildbot-3.1.0.tar.gz

About: Buildbot is a continuous integration testing framework (Python-based). It supports also automation of complex build systems, application deployment, and management of sophisticated software-release processes.

utils.py  (buildbot-3.0.2):utils.py  (buildbot-3.1.0)
skipping to change at line 164 skipping to change at line 164
if isinstance(body, str) and isinstance(new_body, str): if isinstance(body, str) and isinstance(new_body, str):
return body + new_body, True return body + new_body, True
if isinstance(body, list) and isinstance(new_body, list): if isinstance(body, list) and isinstance(new_body, list):
return body + new_body, True return body + new_body, True
log.msg(('{}: Incompatible message body types for multiple builds ({} an d {}). Ignoring' log.msg(('{}: Incompatible message body types for multiple builds ({} an d {}). Ignoring'
).format(self, type(body), type(new_body))) ).format(self, type(body), type(new_body)))
return body, False return body, False
def _get_patches_for_build(self, build):
if not self.add_patch:
return []
ss_list = build['buildset']['sourcestamps']
return [ss['patch'] for ss in ss_list
if 'patch' in ss and ss['patch'] is not None]
@defer.inlineCallbacks @defer.inlineCallbacks
def build_message(self, formatter, master, reporter, name, builds, results): def build_message(self, formatter, master, reporter, build):
# The given builds must refer to builds from a single buildset patches = self._get_patches_for_build(build)
patches = []
logs = [] logs = yield self._get_logs_for_build(master, build)
body = None
subject = None
msgtype = None
users = set()
for build in builds:
if self.add_patch:
ss_list = build['buildset']['sourcestamps']
for ss in ss_list:
if 'patch' in ss and ss['patch'] is not None:
patches.append(ss['patch'])
if self.add_logs:
build_logs = yield self._get_logs_for_build(master, build)
if isinstance(self.add_logs, list):
build_logs = [log for log in build_logs if self._should_atta
ch_log(log)]
logs.extend(build_logs)
blamelist = yield reporter.getResponsibleUsersForBuild(master, build
['buildid'])
users.update(set(blamelist))
buildmsg = yield formatter.format_message_for_build(self.mode, name,
build,
master, blamelis
t)
msgtype, ok = self._merge_msgtype(msgtype, buildmsg['type'])
if not ok:
continue
subject = self._merge_subject(subject, buildmsg['subject'])
body, ok = self._merge_body(body, buildmsg['body'])
if not ok:
continue
users = yield reporter.getResponsibleUsersForBuild(master, build['buildi
d'])
buildmsg = yield formatter.format_message_for_build(master, build, mode=
self.mode,
users=users)
results = build['results']
subject = buildmsg['subject']
if subject is None and self.subject is not None: if subject is None and self.subject is not None:
subject = self.subject % {'result': statusToString(results), subject = self.subject % {'result': statusToString(results),
'projectName': master.config.title, 'projectName': master.config.title,
'title': master.config.title, 'title': master.config.title,
'builder': name} 'builder': build['builder']['name']}
return { return {
'body': body, 'body': buildmsg['body'],
'subject': subject, 'subject': subject,
'type': msgtype, 'type': buildmsg['type'],
'builder_name': name,
'results': results, 'results': results,
'builds': builds, 'builds': [build],
'users': list(users), 'users': list(users),
'patches': patches, 'patches': patches,
'logs': logs 'logs': logs
} }
@defer.inlineCallbacks @defer.inlineCallbacks
def _get_logs_for_build(self, master, build): def _get_logs_for_build(self, master, build):
if not self.add_logs:
return []
all_logs = [] all_logs = []
steps = yield master.data.get(('builds', build['buildid'], "steps")) steps = yield master.data.get(('builds', build['buildid'], "steps"))
for step in steps: for step in steps:
logs = yield master.data.get(("steps", step['stepid'], 'logs')) logs = yield master.data.get(("steps", step['stepid'], 'logs'))
for l in logs: for l in logs:
l['stepname'] = step['name'] l['stepname'] = step['name']
l['content'] = yield master.data.get(("logs", l['logid'], 'conte if self._should_attach_log(l):
nts')) l['content'] = yield master.data.get(("logs", l['logid'], 'c
all_logs.append(l) ontents'))
all_logs.append(l)
return all_logs return all_logs
def _verify_build_generator_mode(self, mode): def _verify_build_generator_mode(self, mode):
for m in self._compute_shortcut_modes(mode): for m in self._compute_shortcut_modes(mode):
if m not in self.possible_modes: if m not in self.possible_modes:
if m == "all": if m == "all":
config.error("mode 'all' is not valid in an iterator and mus t be " config.error("mode 'all' is not valid in an iterator and mus t be "
"passed in as a separate string") "passed in as a separate string")
else: else:
config.error("mode {} is not a valid mode".format(m)) config.error("mode {} is not a valid mode".format(m))
 End of changes. 9 change blocks. 
49 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)