def useLog(self, log, closeWhenFinished=False, logfileName=None): assert interfaces.ILogFile.providedBy(log) if not logfileName: logfileName = log.getName() assert logfileName not in self.logs assert logfileName not in self.delayedLogs self.logs[logfileName] = log self._closeWhenFinished[logfileName] = closeWhenFinished
def useLog(self, log, closeWhenFinished=False, logfileName=None): # NOTE: log may be a SyngLogFileWrapper or a Log instance, depending on the step if not logfileName: logfileName = log.getName() assert logfileName not in self.logs assert logfileName not in self.delayedLogs self.logs[logfileName] = log self._closeWhenFinished[logfileName] = closeWhenFinished
def message_formatter(mode, name, build, results, master_status): result = Results[results] limit_lines = 60 text = list() text.append('<h4>Build status: %s</h4>' % result.upper()) text.append("Buildslave for this Build: <b>%s</b>" % build.getSlavename()) text.append('<br>') if master_status.getURLForThing(build): text.append('Complete logs for all build steps: <a href="%s">%s</a>' % (master_status.getURLForThing(build), master_status.getURLForThing(build)) ) text.append('<br>') text.append("Build Reason: %s" % build.getReason()) text.append('<br>') try: build_properties = build.getProperties().asList() except: pass if build_properties: text.append("Build Properties:<br>") text.append("<ul>") for prop in build_properties: if str(prop[1]) != '': if prop[0] == "BBLAYERS" or prop[0] == "LOCALCONF": if prop[0] == 'BBLAYERS': text.append('<li>Contents of bblayers.conf (Note. LCONF_VERSION will not show up correctly)<br><code>') else: text.append('<li>Contents of auto.conf (local.conf for autobuilders)<br><code>') lines=prop[1].splitlines() for line in lines: text.append(line + "<br>") text.append('<br></code></li>') elif "trigger" not in prop[0] and "ss_" not in prop[0]: text.append('<li>' + prop[0] + " : " + str(prop[1])+"</li>") text.append('</ul>') url = "" for log in build.getLogs(): log_name = "%s.%s" % (log.getStep().getName(), log.getName()) log_status, dummy = log.getStep().getResults() log_body = [] for line in log.getText().splitlines(): # Note: can be VERY LARGE print line if "ERROR" in line or "|" in line: log_body.append(line) log_url = '%s/steps/%s/logs/%s' % (master_status.getURLForThing(build), log.getStep().getName(), log.getName()) if log_status == 2 and log_body: text.append('<i>Detailed log of last build step:</i> <a href="%s">%s</a>' % (log_url, log_url)) text.append('<br>') text.append('<h4>Last %d lines of "%s" Error log:</h4>' % (limit_lines, log_name)) text.append('<p>') text.append('<br>'.join([line for line in log_body[len(log_body)-limit_lines:]])) text.append('</p>') text.append('<br><br>') text.append('<b>-The Yocto BuildBot</b>') return {'body': "\n".join(text), 'type': 'html'}