bhearsum%mozilla.com 17f81a71d7 bug 421884: buildbotcustom modules should only try to addFactoryArguments() for Buildbot 0.7.6 or higher. r=rhelmer, patch=me
git-svn-id: svn://10.0.0.236/trunk@247474 18797224-902f-48f8-a5cc-f745e15eee43
2008-03-10 16:03:19 +00:00

35 lines
1.3 KiB
Python

import buildbot
from buildbot.steps.shell import ShellCommand
from buildbot.status.builder import FAILURE, SUCCESS
class GetBuildID(ShellCommand):
"""Retrieves the BuildID from a Mozilla tree (using platform.ini) and sets
it as a build property ('buildid'). If defined, uses objdir as it's base.
"""
description=['getting buildid']
descriptionDone=['get buildid']
haltOnFailure=True
def __init__(self, objdir="", **kwargs):
ShellCommand.__init__(self, **kwargs)
major, minor, point = buildbot.version.split(".", 3)
# Buildbot 0.7.5 and below do not require this
if int(minor) >= 7 and int(point) >= 6:
self.addFactoryArguments(objdir=objdir)
self.objdir = objdir
self.command = ['python', 'config/printconfigsetting.py',
'%s/dist/bin/application.ini' % self.objdir,
'App', 'BuildID']
def commandComplete(self, cmd):
buildid = ""
try:
buildid = cmd.logs['stdio'].getText().strip().rstrip()
self.setProperty('buildid', buildid)
except:
log.msg("Could not find BuildID or BuildID invalid")
log.msg("Found: %s" % buildid)
return FAILURE
return SUCCESS