From caeb6af57b00573fa90457e275523d651d64ed07 Mon Sep 17 00:00:00 2001 From: "bhearsum%mozilla.com" Date: Fri, 28 Nov 2008 13:01:40 +0000 Subject: [PATCH] bug 466998: ReleaseUpdatesFactory 'cvs diff' step (validly) returns 1, turns step red. r=ccooper, patch=me git-svn-id: svn://10.0.0.236/trunk@255254 18797224-902f-48f8-a5cc-f745e15eee43 --- .../tools/buildbotcustom/process/factory.py | 5 +++-- mozilla/tools/buildbotcustom/steps/misc.py | 20 ++++++++++++++++--- mozilla/tools/buildbotcustom/steps/release.py | 12 +++++++---- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/mozilla/tools/buildbotcustom/process/factory.py b/mozilla/tools/buildbotcustom/process/factory.py index 2733c88a191..d191c902a5f 100644 --- a/mozilla/tools/buildbotcustom/process/factory.py +++ b/mozilla/tools/buildbotcustom/process/factory.py @@ -1158,9 +1158,10 @@ class ReleaseUpdatesFactory(ReleaseFactory): description=['bump', patcherConfig], haltOnFailure=True ) - self.addStep(ShellCommand, + self.addStep(TinderboxShellCommand, command=['cvs', 'diff', '-u', patcherConfigFile], - description=['diff', patcherConfig] + description=['diff', patcherConfig], + ignoreCodes=[1] ) if commitPatcherConfig: self.addStep(ShellCommand, diff --git a/mozilla/tools/buildbotcustom/steps/misc.py b/mozilla/tools/buildbotcustom/steps/misc.py index db6b44670be..aa8561305b8 100644 --- a/mozilla/tools/buildbotcustom/steps/misc.py +++ b/mozilla/tools/buildbotcustom/steps/misc.py @@ -50,12 +50,26 @@ class TinderboxShellCommand(ShellCommand): haltOnFailure = False """This step is really just a 'do not care' buildstep for executing a - slave command and ignoring the results. - Always returns SUCCESS + slave command and ignoring the results. If ignoreCodes is passed, + only exit codes listed in it will be ignored. If ignoreCodes is not + passed, all exit codes will be ignored. """ + def __init__(self, ignoreCodes=None, **kwargs): + ShellCommand.__init__(self, **kwargs) + self.ignoreCodes = ignoreCodes + self.addFactoryArguments(ignoreCodes=ignoreCodes) def evaluateCommand(self, cmd): - return SUCCESS + # Ignore all return codes + if not self.ignoreCodes: + return SUCCESS + else: + # Ignore any of the return codes we're told to + if cmd.rc in self.ignoreCodes: + return SUCCESS + # If the return code is something else, fail + else: + return FAILURE class GetHgRevision(ShellCommand): """Retrieves the revision from a Mercurial repository. Builds based on diff --git a/mozilla/tools/buildbotcustom/steps/release.py b/mozilla/tools/buildbotcustom/steps/release.py index d18d13210b6..47f453a2e0e 100644 --- a/mozilla/tools/buildbotcustom/steps/release.py +++ b/mozilla/tools/buildbotcustom/steps/release.py @@ -1,6 +1,11 @@ from buildbot.status.builder import FAILURE, SUCCESS, WARNINGS from buildbot.steps.shell import ShellCommand +import buildbotcustom.steps.misc +reload(buildbotcustom.steps.misc) + +from buildbotcustom.steps.misc import TinderboxShellCommand + class UpdateVerify(ShellCommand): def evaluateCommand(self, cmd): for line in cmd.logs['stdio'].getText().split("\n"): @@ -9,7 +14,7 @@ class UpdateVerify(ShellCommand): return SUCCESS -class L10nVerifyMetaDiff(ShellCommand): +class L10nVerifyMetaDiff(TinderboxShellCommand): """Run the l10n verification script. """ name='l10n metadiff' @@ -28,17 +33,16 @@ class L10nVerifyMetaDiff(ShellCommand): self.command=['diff', '-r', '%s/diffs' % currentProduct, '%s/diffs' % previousProduct] - ShellCommand.__init__(self, **kwargs) + TinderboxShellCommand.__init__(self, ignoreCodes=[0,1], **kwargs) def evaluateCommand(self, cmd): - superResult = ShellCommand.evaluateCommand(self, cmd) fileWarnings = self.getProperty('fileWarnings') if fileWarnings and len(fileWarnings) > 0: return WARNINGS '''We ignore failures here on purpose, since diff will return 1(FAILURE) if it actually finds anything to output. ''' - return SUCCESS + return TinderboxShellCommand.evaluateCommand(self, cmd) def createSummary(self, log): fileWarnings = []