Backed out changeset 9cc940a50219 because it's busted.
authorBen Hearsum <bhearsum@mozilla.com>
Thu, 26 Aug 2010 10:03:08 -0400
changeset 86 ac42a4ad878fd6b6d5e103c1e72190f67c4d2340
parent 83 9cc940a502192e9588c1725f413143c7ade2a8a7
child 88 e4a4a686eb12b780cfec25640bbc6ad89b9de3fa
push id34
push userbhearsum@mozilla.com
push dateThu, 26 Aug 2010 14:04:23 +0000
backs out9cc940a502192e9588c1725f413143c7ade2a8a7
Backed out changeset 9cc940a50219 because it's busted.
master/buildbot/process/buildstep.py
master/buildbot/status/builder.py
--- a/master/buildbot/process/buildstep.py
+++ b/master/buildbot/process/buildstep.py
@@ -981,31 +981,27 @@ class OutputProgressObserver(LogObserver
 class LoggingBuildStep(BuildStep):
     """This is an abstract base class, suitable for inheritance by all
     BuildSteps that invoke RemoteCommands which emit stdout/stderr messages.
     """
 
     progressMetrics = ('output',)
     logfiles = {}
 
-    parms = BuildStep.parms + ['logfiles', 'lazylogfiles', 'log_eval_func']
+    parms = BuildStep.parms + ['logfiles', 'lazylogfiles']
 
-    def __init__(self, logfiles={}, lazylogfiles=False, log_eval_func=None,
-                 *args, **kwargs):
+    def __init__(self, logfiles={}, lazylogfiles=False, *args, **kwargs):
         BuildStep.__init__(self, *args, **kwargs)
         self.addFactoryArguments(logfiles=logfiles,
-                                 lazylogfiles=lazylogfiles,
-                                 log_eval_func=log_eval_func)
+                                 lazylogfiles=lazylogfiles)
         # merge a class-level 'logfiles' attribute with one passed in as an
         # argument
         self.logfiles = self.logfiles.copy()
         self.logfiles.update(logfiles)
         self.lazylogfiles = lazylogfiles
-        assert not log_eval_func or callable(log_eval_func)
-        self.log_eval_func = log_eval_func
         self.addLogObserver('stdio', OutputProgressObserver("output"))
 
     def addLogFile(self, logname, filename):
         """
         This allows to add logfiles after construction, but before calling
         startCommand().
         """
         self.logfiles[logname] = filename
@@ -1114,20 +1110,19 @@ class LoggingBuildStep(BuildStep):
         """
         pass
 
     def evaluateCommand(self, cmd):
         """Decide whether the command was SUCCESS, WARNINGS, or FAILURE.
         Override this to, say, declare WARNINGS if there is any stderr
         activity, or to say that rc!=0 is not actually an error."""
 
-        if self.log_eval_func:
-            return self.log_eval_func(cmd, self.step_status)
         if cmd.rc != 0:
             return FAILURE
+        # if cmd.log.getStderr(): return WARNINGS
         return SUCCESS
 
     def getText(self, cmd, results):
         if results == SUCCESS:
             return self.describe(True)
         elif results == WARNINGS:
             return self.describe(True) + ["warnings"]
         else:
@@ -1158,36 +1153,13 @@ class LoggingBuildStep(BuildStep):
         return []
 
     def setStatus(self, cmd, results):
         # this is good enough for most steps, but it can be overridden to
         # get more control over the displayed text
         self.step_status.setText(self.getText(cmd, results))
         self.step_status.setText2(self.maybeGetText2(cmd, results))
 
-
-# Parses the logs for a list of regexs. Meant to be invoked like:
-# regexes = ((re.compile(...), FAILURE), (re.compile(...), WARNINGS))
-# self.addStep(ShellCommand,
-#   command=...,
-#   ...,
-#   log_eval_func=lambda c,s: regex_log_evaluator(c, s, regexs)
-# )
-def regex_log_evaluator(cmd, step_status, regexes):
-    worst = SUCCESS
-    for err, possible_status in regexes:
-        # worst_status returns the worse of the two status' passed to it.
-        # we won't be changing "worst" unless possible_status is worse than it,
-        # so we don't even need to check the log if that's the case
-        if worst_status(worst, possible_status) == possible_status:
-            if isinstance(err, (basestring)):
-                err = re.compile(".*%s.*" % err, re.DOTALL)
-            for l in cmd.logs:
-                if err.search(l.getText()):
-                    worst = possible_status
-    return worst
-
-
 # (WithProperties used to be available in this module)
 from buildbot.process.properties import WithProperties
 _hush_pyflakes = [WithProperties]
 del _hush_pyflakes
 
--- a/master/buildbot/status/builder.py
+++ b/master/buildbot/status/builder.py
@@ -18,23 +18,16 @@ from bz2 import BZ2File
 from gzip import GzipFile
 
 # sibling imports
 from buildbot import interfaces, util, sourcestamp
 
 SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION, RETRY = range(6)
 Results = ["success", "warnings", "failure", "skipped", "exception", "retry"]
 
-def worst_status(a, b):
-    # SUCCESS > SKIPPED > WARNINGS > FAILURE > EXCEPTION > RETRY
-    # Retry needs to be considered the worst so that conusmers don't have to
-    # worry about other failures undermining the RETRY.
-    for s in (RETRY, EXCEPTION, FAILURE, WARNINGS, SKIPPED, SUCCESS):
-        if s in (a, b):
-            return s
 
 # build processes call the following methods:
 #
 #  setDefaults
 #
 #  currentlyBuilding
 #  currentlyIdle
 #  currentlyInterlocked