mirror of
git://git.yoctoproject.org/yocto-autobuilder2.git
synced 2025-07-05 21:24:47 +02:00
steps/observer: Update to work with new buildbot versions
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
e30237bd7a
commit
3d960690e4
|
@ -2,6 +2,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from twisted.internet import defer
|
||||||
from twisted.python import log
|
from twisted.python import log
|
||||||
|
|
||||||
from buildbot.process import logobserver
|
from buildbot.process import logobserver
|
||||||
|
@ -21,8 +22,8 @@ class SimpleLogObserver(ShellCommand):
|
||||||
|
|
||||||
warnOnWarnings = True
|
warnOnWarnings = True
|
||||||
warnOnFailure = True
|
warnOnFailure = True
|
||||||
warnings = 0
|
warnCount = 0
|
||||||
errors = 0
|
errorCount = 0
|
||||||
|
|
||||||
def __init__(self, maxsteps=10, *args, **kwargs):
|
def __init__(self, maxsteps=10, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -41,22 +42,44 @@ class SimpleLogObserver(ShellCommand):
|
||||||
while True:
|
while True:
|
||||||
stream, line = yield
|
stream, line = yield
|
||||||
if line.startswith("WARNING:"):
|
if line.startswith("WARNING:"):
|
||||||
self.warnings += 1
|
self.warnCount += 1
|
||||||
self.warningLines.append(logname + ": " + line)
|
self.warningLines.append(logname + ": " + line)
|
||||||
if line.startswith("ERROR:"):
|
if line.startswith("ERROR:"):
|
||||||
self.errors += 1
|
self.errorCount += 1
|
||||||
self.errorLines.append(logname + ": " + line)
|
self.errorLines.append(logname + ": " + line)
|
||||||
|
|
||||||
def commandComplete(self, cmd):
|
@defer.inlineCallbacks
|
||||||
if self.warningLines:
|
def finish_logs(self):
|
||||||
self.addCompleteLog('warnings', '\n'.join(self.warningLines))
|
stdio_log = yield self.getLog('stdio')
|
||||||
|
yield stdio_log.finish()
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def createSummary(self):
|
||||||
|
if self.warnCount:
|
||||||
|
yield self.addCompleteLog('warnings', '\n'.join(self.warningLines) + '\n')
|
||||||
if self.errorLines:
|
if self.errorLines:
|
||||||
self.addCompleteLog('errors', '\n'.join(self.errorLines))
|
yield self.addCompleteLog('errors', '\n'.join(self.errorLines) + '\n')
|
||||||
|
|
||||||
|
warnings_stat = self.getStatistic('warnings', 0)
|
||||||
|
self.setStatistic('warnings', warnings_stat + self.warnCount)
|
||||||
|
|
||||||
|
old_count = self.getProperty("warnings-count", 0)
|
||||||
|
self.setProperty(
|
||||||
|
"warnings-count", old_count + self.warnCount, "SimpleLogObserver")
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def run(self):
|
||||||
|
cmd = yield self.makeRemoteShellCommand()
|
||||||
|
yield self.runCommand(cmd)
|
||||||
|
|
||||||
|
yield self.finish_logs()
|
||||||
|
yield self.createSummary()
|
||||||
|
return self.evaluateCommand(cmd)
|
||||||
|
|
||||||
def evaluateCommand(self, cmd):
|
def evaluateCommand(self, cmd):
|
||||||
if cmd.didFail() or self.errors:
|
if cmd.didFail() or self.errorCount:
|
||||||
return FAILURE
|
return FAILURE
|
||||||
if self.warnings:
|
if self.warnCount:
|
||||||
return WARNINGS
|
return WARNINGS
|
||||||
return SUCCESS
|
return SUCCESS
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user