From 4fe54f8dff81ec56ad1b6d0c0e93aca80ab14b2c Mon Sep 17 00:00:00 2001 From: Edmund Wong Date: Tue, 6 Nov 2012 17:59:25 +0800 Subject: [PATCH] - Changed USERCANCEL to CANCELLED. --- master/buildbot/process/build.py | 8 ++++---- master/buildbot/status/mail.py | 11 ++++++----- master/buildbot/status/results.py | 8 ++++---- master/buildbot/status/tinderbox.py | 4 ++-- master/buildbot/status/words.py | 4 ++-- master/buildbot/test/unit/test_process_build.py | 8 ++++---- master/buildbot/test/unit/test_status_mail.py | 2 +- master/docs/developer/results.rst | 2 +- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py index 75b96994818..b6d6bbfc252 100644 --- a/master/buildbot/process/build.py +++ b/master/buildbot/process/build.py @@ -23,7 +23,7 @@ from buildbot import interfaces, locks from buildbot.status.results import SUCCESS, WARNINGS, FAILURE, EXCEPTION, \ - RETRY, SKIPPED, USERCANCEL, worst_status + RETRY, SKIPPED, CANCELLED, worst_status from buildbot.status.builder import Results from buildbot.status.progress import BuildProgress from buildbot.process import metrics, properties @@ -437,7 +437,7 @@ def stepDone(self, result, step): possible_overall_result = WARNINGS if step.flunkOnWarnings: possible_overall_result = FAILURE - elif result in (EXCEPTION, RETRY): + elif result in (EXCEPTION, RETRY, CANCELLED): terminate = True # if we skipped this step, then don't adjust the build status @@ -482,7 +482,7 @@ def stopBuild(self, reason=""): if self.currentStep: self.currentStep.interrupt(reason) - self.result = USERCANCEL + self.result = CANCELLED if self._acquiringLock: lock, access, d = self._acquiringLock @@ -498,7 +498,7 @@ def allStepsDone(self): text = ["exception"] elif self.result == RETRY: text = ["retry"] - elif self.result == USERCANCEL: + elif self.result == CANCELLED: text = ["usercancel"] else: text = ["build", "successful"] diff --git a/master/buildbot/status/mail.py b/master/buildbot/status/mail.py index db453570abc..9a64b6e5f87 100644 --- a/master/buildbot/status/mail.py +++ b/master/buildbot/status/mail.py @@ -49,7 +49,7 @@ from buildbot import interfaces, util, config from buildbot.process.users import users from buildbot.status import base -from buildbot.status.results import FAILURE, SUCCESS, WARNINGS, EXCEPTION, USERCANCEL, Results +from buildbot.status.results import FAILURE, SUCCESS, WARNINGS, EXCEPTION, CANCELLED, Results VALID_EMAIL = re.compile("[a-zA-Z0-9\.\_\%\-\+]+@[a-zA-Z0-9\.\_\%\-]+.[a-zA-Z]{2,6}") @@ -94,7 +94,7 @@ def defaultMessage(mode, name, build, results, master_status): text += "The Buildbot has detected a passing build" elif results == EXCEPTION: text += "The Buildbot has detected a build exception" - elif results == USERCANCEL: + elif results == CANCELLED: text += "The Build was cancelled by the user" projects = [] @@ -146,7 +146,7 @@ def defaultMessage(mode, name, build, results, master_status): text += "Build succeeded!\n" elif results == WARNINGS: text += "Build Had Warnings%s\n" % t - elif results == USERCANCEL: + elif results == CANCELLED: text += "Build was cancelled by %s\n" % build.getResponsibleUsers() else: text += "BUILD FAILED%s\n" % t @@ -186,7 +186,7 @@ class MailNotifier(base.StatusReceiverMultiService): "subject", "sendToInterestedUsers", "customMesg", "messageFormatter", "extraHeaders"] - possible_modes = ("change", "failing", "passing", "problem", "warnings", "exception") + possible_modes = ("change", "failing", "passing", "problem", "warnings", "exception", "cancelled") def __init__(self, fromaddr, mode=("failing", "passing", "warnings"), categories=None, builders=None, addLogs=False, @@ -231,6 +231,7 @@ def __init__(self, fromaddr, mode=("failing", "passing", "warnings"), when the previous build passed - "warnings": send mail if a build contain warnings - "exception": send mail if a build fails due to an exception + - "cancelled": send mail if a build is cancelled - "all": always send mail Defaults to ("failing", "passing", "warnings"). @@ -455,7 +456,7 @@ def isMailNeeded(self, build, results): return True if "exception" in self.mode and results == EXCEPTION: return True - if "usercancel" in self.mode and results == USERCANCEL: + if "usercancel" in self.mode and results == CANCELLED: return True return False diff --git a/master/buildbot/status/results.py b/master/buildbot/status/results.py index dc24ba4f66f..8187e1e2d59 100644 --- a/master/buildbot/status/results.py +++ b/master/buildbot/status/results.py @@ -13,12 +13,12 @@ # # Copyright Buildbot Team Members -SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION, RETRY, USERCANCEL = range(7) +SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION, RETRY, CANCELLED = range(7) Results = ["success", "warnings", "failure", "skipped", "exception", "retry", "usercancel"] def worst_status(a, b): - # SUCCESS > WARNINGS > FAILURE > EXCEPTION > RETRY > USERCANCEL - # USERCANCEL needs to be considered the worst. - for s in (USERCANCEL, RETRY, EXCEPTION, FAILURE, WARNINGS, SKIPPED, SUCCESS): + # SUCCESS > WARNINGS > FAILURE > EXCEPTION > RETRY > CANCELLED + # CANCELLED needs to be considered the worst. + for s in (CANCELLED, RETRY, EXCEPTION, FAILURE, WARNINGS, SKIPPED, SUCCESS): if s in (a, b): return s diff --git a/master/buildbot/status/tinderbox.py b/master/buildbot/status/tinderbox.py index 0f3c796ffa8..85246d461d6 100644 --- a/master/buildbot/status/tinderbox.py +++ b/master/buildbot/status/tinderbox.py @@ -22,7 +22,7 @@ from buildbot import interfaces from buildbot.status import mail -from buildbot.status.results import SUCCESS, WARNINGS, EXCEPTION, RETRY, USERCANCEL +from buildbot.status.results import SUCCESS, WARNINGS, EXCEPTION, RETRY, CANCELLED from buildbot.steps.shell import WithProperties import gzip, bz2, base64, re, cStringIO @@ -184,7 +184,7 @@ def buildMessage(self, name, build, results): elif results in (EXCEPTION, RETRY): res = "exception" text += res - elif results == USERCANCEL: + elif results == CANCELLED: res = "usercancel" text += res else: diff --git a/master/buildbot/status/words.py b/master/buildbot/status/words.py index 82df63b74df..88043c4c325 100644 --- a/master/buildbot/status/words.py +++ b/master/buildbot/status/words.py @@ -28,7 +28,7 @@ from buildbot.interfaces import IStatusReceiver from buildbot.sourcestamp import SourceStamp from buildbot.status import base -from buildbot.status.results import SUCCESS, WARNINGS, FAILURE, EXCEPTION, RETRY, USERCANCEL +from buildbot.status.results import SUCCESS, WARNINGS, FAILURE, EXCEPTION, RETRY, CANCELLED from buildbot.process.properties import Properties # twisted.internet.ssl requires PyOpenSSL, so be resilient if it's missing @@ -404,7 +404,7 @@ def buildStarted(self, builderName, build): FAILURE: ("Failure", 'RED'), EXCEPTION: ("Exception", 'PURPLE'), RETRY: ("Retry", 'AQUA_LIGHT'), - USERCANCEL: ("UserCancel", 'PINK'), + CANCELLED: ("UserCancel", 'PINK'), } def getResultsDescriptionAndColor(self, results): diff --git a/master/buildbot/test/unit/test_process_build.py b/master/buildbot/test/unit/test_process_build.py index 849e2a9d9b7..1e2a12aff4d 100644 --- a/master/buildbot/test/unit/test_process_build.py +++ b/master/buildbot/test/unit/test_process_build.py @@ -19,7 +19,7 @@ from buildbot import interfaces from buildbot.process.build import Build from buildbot.process.properties import Properties -from buildbot.status.results import FAILURE, SUCCESS, WARNINGS, RETRY, EXCEPTION +from buildbot.status.results import FAILURE, SUCCESS, WARNINGS, RETRY, EXCEPTION, CANCELLED from buildbot.locks import SlaveLock from buildbot.process.buildstep import LoggingBuildStep @@ -142,7 +142,7 @@ def startStep(*args, **kw): b.startBuild(FakeBuildStatus(), None, slavebuilder) - self.assertEqual(b.result, EXCEPTION) + self.assertEqual(b.result, CANCELLED) self.assert_( ('interrupt', ('stop it',), {}) in step.method_calls) @@ -183,7 +183,7 @@ def startStep2(*args, **kw): d = b.startBuild(FakeBuildStatus(), None, slavebuilder) def check(ign): - self.assertEqual(b.result, EXCEPTION) + self.assertEqual(b.result, CANCELLED) self.assert_( ('interrupt', ('stop it',), {}) in step1.method_calls) self.assert_(step2Started[0]) d.addCallback(check) @@ -332,7 +332,7 @@ def acquireLocks(res=None): self.assert_( ('startStep', (slavebuilder.remote,), {}) not in step.method_calls) self.assert_(b.currentStep is None) - self.assertEqual(b.result, EXCEPTION) + self.assertEqual(b.result, CANCELLED) self.assert_( ('interrupt', ('stop it',), {}) not in step.method_calls) def testStopBuildWaitingForLocks_lostRemote(self): diff --git a/master/buildbot/test/unit/test_status_mail.py b/master/buildbot/test/unit/test_status_mail.py index f9339fa6aa2..9a7275c330c 100644 --- a/master/buildbot/test/unit/test_status_mail.py +++ b/master/buildbot/test/unit/test_status_mail.py @@ -17,7 +17,7 @@ from mock import Mock from buildbot import config from twisted.trial import unittest -from buildbot.status.results import SUCCESS, FAILURE, WARNINGS, EXCEPTION +from buildbot.status.results import SUCCESS, FAILURE, WARNINGS, EXCEPTION, USERCANCEL from buildbot.status.mail import MailNotifier from twisted.internet import defer from buildbot.test.fake import fakedb diff --git a/master/docs/developer/results.rst b/master/docs/developer/results.rst index e9fc6c416fe..74004d23d33 100644 --- a/master/docs/developer/results.rst +++ b/master/docs/developer/results.rst @@ -38,7 +38,7 @@ external tools, so the values are fixed. Value: 4; color: purple; a run that should be retried, usually due to a slave disconnection. -.. py:data:: USERCANCEL +.. py:data:: CANCELLED Value: 5; color: pink; a run that was cancelled by the user.