зеркало из https://github.com/mozilla/pjs.git
b=393413
r=rcampbell - add proper clobber support to buildbot
This commit is contained in:
Родитель
8594a53261
Коммит
376eb33948
|
@ -1,20 +1,108 @@
|
|||
import subprocess
|
||||
|
||||
def killAndClobber():
|
||||
print "Killing Firefox..."
|
||||
try:
|
||||
subprocess.call("C:\\Utilities\\pskill.exe firefox")
|
||||
subprocess.call(["C:\\Windows\\System32\\cmd.exe", "/X", "/C", "rmdir", "/s", "/q", "C:\\slave\\trunk_2k3\\mozilla\\objdir"])
|
||||
except Exception, err:
|
||||
print str(err)
|
||||
|
||||
def main():
|
||||
cvsco = open("C:\\slave\\trunk_2k3\\cvsco.log")
|
||||
lines = cvsco.readlines()
|
||||
cvsco.close()
|
||||
|
||||
if 'U mozilla/tools/tinderbox-configs/firefox/win32/CLOBBER\n' in lines:
|
||||
killAndClobber()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
import os, subprocess, sys, getopt
|
||||
|
||||
def usage():
|
||||
print "killAndClobberWin.py [--help] [--platform=?] [--slave_name=?] [--branch=?]"
|
||||
print " Defaults:"
|
||||
print " platform: <none>"
|
||||
print " slaveName: slave"
|
||||
print " branch: trunk"
|
||||
|
||||
def rmdirRecursive(dir):
|
||||
"""This is a replacement for shutil.rmtree that works better under
|
||||
windows. Thanks to Bear at the OSAF for the code."""
|
||||
if not os.path.exists(dir):
|
||||
return
|
||||
|
||||
if os.path.islink(dir):
|
||||
os.remove(dir)
|
||||
return
|
||||
|
||||
# Verify the directory is read/write/execute for the current user
|
||||
os.chmod(dir, 0700)
|
||||
|
||||
for name in os.listdir(dir):
|
||||
full_name = os.path.join(dir, name)
|
||||
# on Windows, if we don't have write permission we can't remove
|
||||
# the file/directory either, so turn that on
|
||||
if os.name == 'nt':
|
||||
if not os.access(full_name, os.W_OK):
|
||||
# I think this is now redundant, but I don't have an NT
|
||||
# machine to test on, so I'm going to leave it in place
|
||||
# -warner
|
||||
os.chmod(full_name, 0600)
|
||||
|
||||
if os.path.isdir(full_name):
|
||||
rmdirRecursive(full_name)
|
||||
else:
|
||||
os.chmod(full_name, 0700)
|
||||
os.remove(full_name)
|
||||
os.rmdir(dir)
|
||||
|
||||
def killAndClobber(slaveName, branchDir):
|
||||
print "Killing Firefox..."
|
||||
mozDir = os.path.join('C:\\',
|
||||
slaveName,
|
||||
branchDir,
|
||||
'mozilla')
|
||||
try:
|
||||
# This may be redundant if the pskill on sh.exe succeeds, but we
|
||||
# want to be sure.
|
||||
subprocess.call("C:\\Utilities\\pskill.exe -t sh.exe")
|
||||
subprocess.call("C:\\Utilities\\pskill.exe -t make.exe")
|
||||
subprocess.call("C:\\Utilities\\pskill.exe -t firefox")
|
||||
rmdirRecursive(mozDir);
|
||||
except Exception, err:
|
||||
print str(err)
|
||||
|
||||
def main(argv):
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(argv,
|
||||
"hp:s:b:d",
|
||||
["help",
|
||||
"platform=",
|
||||
"slaveName=",
|
||||
"branch="])
|
||||
except getopt.GetoptError:
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
platform = ""
|
||||
slaveName = "slave"
|
||||
branch = "trunk"
|
||||
branchDir = "trunk"
|
||||
|
||||
for opt,arg in opts:
|
||||
if opt in ("-h", "--help"):
|
||||
usage()
|
||||
sys.exit()
|
||||
elif opt in ("-p", "--platform"):
|
||||
platform = arg
|
||||
elif opt in ("-s", "--slaveName"):
|
||||
slaveName = arg
|
||||
elif opt in ("-b", "--branch"):
|
||||
branch = arg
|
||||
|
||||
if platform != "":
|
||||
branchDir = branch + "_" + platform
|
||||
|
||||
logDir = os.path.join('C:\\',
|
||||
slaveName,
|
||||
branchDir,
|
||||
'logs')
|
||||
tboxClobberLog = os.path.join(logDir, 'tbox-CLOBBER-cvsco.log')
|
||||
buildbotClobberLog = os.path.join(logDir, 'buildbot-CLOBBER-cvsco.log')
|
||||
|
||||
tboxCvsCo = open(tboxClobberLog)
|
||||
tboxLines = tboxCvsCo.readlines()
|
||||
tboxCvsCo.close()
|
||||
buildbotCvsCo = open(buildbotClobberLog)
|
||||
buildbotLines = buildbotCvsCo.readlines()
|
||||
buildbotCvsCo.close()
|
||||
|
||||
if 'U tinderbox-configs/CLOBBER' in tboxLines or 'U buildbot-configs/CLOBBER' in buildbotLines:
|
||||
killAndClobber(slaveName, branchDir)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
||||
|
|
|
@ -117,9 +117,17 @@ builders = []
|
|||
|
||||
centosFactory = factory.BuildFactory()
|
||||
|
||||
centosLeakFactory.addStep(UpdateClobberFiles,
|
||||
cvsroot=CVSROOT,
|
||||
workdir='.',
|
||||
platform='linux')
|
||||
centosLeakFactory.addStep(MozillaClobber,
|
||||
platform="linux",
|
||||
workdir='.',
|
||||
env=MozillaEnvironments['centos'])
|
||||
centosFactory.addStep(MozillaCheckoutClientMk,
|
||||
workdir=".",
|
||||
cvsroot=CVSROOT),
|
||||
cvsroot=CVSROOT)
|
||||
centosFactory.addStep(FileDownload, mastersrc="mozconfig-places",
|
||||
slavedest=".mozconfig",
|
||||
workdir="mozilla")
|
||||
|
@ -131,10 +139,6 @@ centosFactory.addStep(step.Compile, name="checkout",
|
|||
descriptionDone = ["checkout"],
|
||||
command=["make","-f","client.mk","checkout"],
|
||||
workdir='mozilla')
|
||||
centosFactory.addStep(MozillaClobber,
|
||||
platform="linux",
|
||||
workdir='.',
|
||||
env=MozillaEnvironments['centos'])
|
||||
centosFactory.addStep(step.Compile,
|
||||
command=["make", "-f", "client.mk", "build"],
|
||||
workdir='mozilla')
|
||||
|
@ -179,6 +183,15 @@ builders.append(firefox_trunk_centos5_builder)
|
|||
|
||||
osxFactory = factory.BuildFactory()
|
||||
|
||||
osxLeakFactory.addStep(UpdateClobberFiles,
|
||||
cvsroot=CVSROOT,
|
||||
workdir='.',
|
||||
platform='macosx',
|
||||
env=MozillaEnvironments['osx'])
|
||||
osxLeakFactory.addStep(MozillaClobber,
|
||||
workdir='.',
|
||||
platform="macosx",
|
||||
env=MozillaEnvironments['osx'])
|
||||
osxFactory.addStep(MozillaCheckoutClientMk,
|
||||
workdir=".",
|
||||
cvsroot=CVSROOT),
|
||||
|
@ -193,10 +206,6 @@ osxFactory.addStep(step.Compile, name="checkout",
|
|||
descriptionDone = ["checkout"],
|
||||
command=["make","-f","client.mk","checkout"],
|
||||
workdir='mozilla')
|
||||
osxFactory.addStep(MozillaClobber,
|
||||
platform="macosx",
|
||||
workdir='.',
|
||||
env=MozillaEnvironments['osx'])
|
||||
osxFactory.addStep(step.Compile,
|
||||
command=["make", "-f", "client.mk", "build"],
|
||||
workdir='mozilla')
|
||||
|
@ -241,6 +250,15 @@ builders.append(firefox_trunk_osx_builder)
|
|||
|
||||
leopardFactory = factory.BuildFactory()
|
||||
|
||||
leopardLeakFactory.addStep(UpdateClobberFiles,
|
||||
cvsroot=CVSROOT,
|
||||
workdir='.',
|
||||
platform='macosx',
|
||||
env=MozillaEnvironments['osx'])
|
||||
leopardLeakFactory.addStep(MozillaClobber,
|
||||
workdir='.',
|
||||
platform="macosx",
|
||||
env=MozillaEnvironments['osx'])
|
||||
leopardFactory.addStep(MozillaCheckoutClientMk,
|
||||
workdir=".",
|
||||
cvsroot=CVSROOT),
|
||||
|
@ -255,10 +273,6 @@ leopardFactory.addStep(step.Compile, name="checkout",
|
|||
descriptionDone = ["checkout"],
|
||||
command=["make","-f","client.mk","checkout"],
|
||||
workdir='mozilla')
|
||||
leopardFactory.addStep(MozillaClobber,
|
||||
platform="macosx",
|
||||
workdir='.',
|
||||
env=MozillaEnvironments['osx'])
|
||||
leopardFactory.addStep(step.Compile,
|
||||
command=["make", "-f", "client.mk", "build"],
|
||||
workdir='mozilla')
|
||||
|
@ -312,13 +326,36 @@ builders.append(firefox_trunk_leopard_builder)
|
|||
|
||||
winxpFactory = factory.BuildFactory()
|
||||
|
||||
winxpLeakFactory.addStep(TinderboxShellCommand, name="kill sh",
|
||||
description='kill sh',
|
||||
descriptionDone="killed sh",
|
||||
command="pskill -t sh.exe",
|
||||
workdir="C:\\Utilities")
|
||||
winxpLeakFactory.addStep(TinderboxShellCommand, name="kill make",
|
||||
description='kill make',
|
||||
descriptionDone="killed make",
|
||||
command="pskill -t make.exe",
|
||||
workdir="C:\\Utilities")
|
||||
winxpLeakFactory.addStep(TinderboxShellCommand, name="kill firefox",
|
||||
description='kill firefox',
|
||||
descriptionDone="killed firefox",
|
||||
command="pskill -t firefox.exe",
|
||||
workdir="C:\\Utilities")
|
||||
winxpLeakFactory.addStep(UpdateClobberFiles,
|
||||
cvsroot=CVSROOT,
|
||||
workdir='.',
|
||||
platform='winxp',
|
||||
logDir='..\\logs\\',
|
||||
env=MozillaEnvironments['vc8'])
|
||||
winxpLeakFactory.addStep(MozillaClobberWin,
|
||||
workdir='.',
|
||||
platform="winxp",
|
||||
slaveName="slave",
|
||||
env=MozillaEnvironments['vc8'])
|
||||
winxpFactory.addStep(MozillaCheckoutClientMk,
|
||||
workdir=".",
|
||||
cvsroot=CVSROOT,
|
||||
env=MozillaEnvironments['vc8'])
|
||||
winxpFactory.addStep(TinderboxShellCommand, name="KILL FIREFOX",
|
||||
command="pskill firefox.exe",
|
||||
workdir="C:\\Utilities")
|
||||
winxpFactory.addStep(FileDownload, mastersrc="mozconfig-winxp",
|
||||
slavedest=".mozconfig",
|
||||
workdir="mozilla")
|
||||
|
@ -332,9 +369,6 @@ winxpFactory.addStep(step.Compile, name="checkout",
|
|||
command=["make","-f","client.mk","checkout"],
|
||||
workdir='mozilla',
|
||||
env=MozillaEnvironments['vc8'])
|
||||
winxpFactory.addStep(MozillaClobberWin,
|
||||
workdir='.',
|
||||
env=MozillaEnvironments['vc8'])
|
||||
winxpFactory.addStep(step.Compile,
|
||||
command=["make", "-f", "client.mk", "build"],
|
||||
workdir='mozilla',
|
||||
|
@ -381,13 +415,36 @@ builders.append(firefox_trunk_winxp_builder)
|
|||
|
||||
win2k3Factory = factory.BuildFactory()
|
||||
|
||||
win2k3LeakFactory.addStep(TinderboxShellCommand, name="kill sh",
|
||||
description='kill sh',
|
||||
descriptionDone="killed sh",
|
||||
command="pskill -t sh.exe",
|
||||
workdir="C:\\Utilities")
|
||||
win2k3LeakFactory.addStep(TinderboxShellCommand, name="kill make",
|
||||
description='kill make',
|
||||
descriptionDone="killed make",
|
||||
command="pskill -t make.exe",
|
||||
workdir="C:\\Utilities")
|
||||
win2k3LeakFactory.addStep(TinderboxShellCommand, name="kill firefox",
|
||||
description='kill firefox',
|
||||
descriptionDone="killed firefox",
|
||||
command="pskill -t firefox.exe",
|
||||
workdir="C:\\Utilities")
|
||||
win2k3LeakFactory.addStep(UpdateClobberFiles,
|
||||
cvsroot=CVSROOT,
|
||||
workdir='.',
|
||||
platform='win2k3',
|
||||
logDir='..\\logs\\',
|
||||
env=MozillaEnvironments['mozbuild'])
|
||||
win2k3LeakFactory.addStep(MozillaClobberWin,
|
||||
workdir='.',
|
||||
platform="2k3",
|
||||
slaveName="slave",
|
||||
env=MozillaEnvironments['mozbuild'])
|
||||
win2k3Factory.addStep(MozillaCheckoutClientMk,
|
||||
workdir=".",
|
||||
cvsroot=CVSROOT,
|
||||
env=MozillaEnvironments['mozbuild'])
|
||||
win2k3Factory.addStep(TinderboxShellCommand, name="KILL FIREFOX",
|
||||
command="pskill firefox.exe",
|
||||
workdir="C:\\Utilities")
|
||||
win2k3Factory.addStep(FileDownload, mastersrc="mozconfig-win2k3",
|
||||
slavedest=".mozconfig",
|
||||
workdir="mozilla")
|
||||
|
@ -401,9 +458,6 @@ win2k3Factory.addStep(step.Compile, name="checkout",
|
|||
command=["make","-f","client.mk","checkout"],
|
||||
workdir='mozilla',
|
||||
env=MozillaEnvironments['mozbuild'])
|
||||
win2k3Factory.addStep(MozillaClobberWin,
|
||||
workdir='.',
|
||||
env=MozillaEnvironments['mozbuild'])
|
||||
win2k3Factory.addStep(step.Compile,
|
||||
command=["make", "-f", "client.mk", "build"],
|
||||
workdir='mozilla',
|
||||
|
|
|
@ -4,6 +4,7 @@ from buildbot.process import step
|
|||
from buildbot.process.step import ShellCommand
|
||||
from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION
|
||||
import re
|
||||
import os
|
||||
|
||||
MozillaEnvironments = { }
|
||||
|
||||
|
@ -24,8 +25,9 @@ MozillaEnvironments['osx'] = {
|
|||
"CVS_RSH": 'ssh'
|
||||
}
|
||||
|
||||
# standard vc8 express build env; vc8 normal will be very similar, just different
|
||||
# platform SDK location. we can build both from one generic template.
|
||||
# standard vc8 express build env; vc8 normal will be very similar,
|
||||
# just different platform SDK location. we can build both from one
|
||||
# generic template.
|
||||
MozillaEnvironments['vc8'] = {
|
||||
"MOZ_NO_REMOTE": '1',
|
||||
"NO_EM_RESTART": '1',
|
||||
|
@ -128,6 +130,10 @@ MozillaEnvironments['mozbuild'] = {
|
|||
'C:\\Program Files\\Microsoft Visual Studio 8\\VC\\ATLMFC\\LIB'
|
||||
}
|
||||
|
||||
cvsCoLog = "cvsco.log"
|
||||
tboxClobberCvsCoLog = "tbox-CLOBBER-cvsco.log"
|
||||
buildbotClobberCvsCoLog = "buildbot-CLOBBER-cvsco.log"
|
||||
|
||||
class TinderboxShellCommand(ShellCommand):
|
||||
haltOnFailure = False
|
||||
|
||||
|
@ -182,28 +188,68 @@ class MozillaPackage(ShellCommand):
|
|||
descriptionDone = ["package"]
|
||||
command = ["make"]
|
||||
|
||||
class UpdateClobberFiles(ShellCommand):
|
||||
name = "update clobber files"
|
||||
warnOnFailure = True
|
||||
description = "updating clobber files"
|
||||
descriptionDone = "clobber files updated"
|
||||
clobberFilePath = "clobber_files/"
|
||||
logDir = '../logs/'
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
if not 'platform' in kwargs:
|
||||
return FAILURE
|
||||
self.platform = kwargs['platform']
|
||||
if 'clobberFilePath' in kwargs:
|
||||
self.clobberFilePath = kwargs['clobberFilePath']
|
||||
if logDir in kwargs:
|
||||
self.logDir = kwargs['logDir']
|
||||
if self.platform.startswith('win'):
|
||||
self.tboxClobberModule = 'mozilla/tools/tinderbox-configs/firefox/win32'
|
||||
else:
|
||||
self.tboxClobberModule = 'mozilla/tools/tinderbox-configs/firefox/' + self.platform
|
||||
if 'cvsroot' in kwargs:
|
||||
self.cvsroot = kwargs['cvsroot']
|
||||
if 'branch' in kwargs:
|
||||
self.branchString = ' -r ' + kwargs['branch']
|
||||
self.buildbotClobberModule = 'mozilla/tools/buildbot-configs/testing/unittest/CLOBBER/firefox/' + kwargs['branch'] + '/' + self.platform
|
||||
else:
|
||||
self.branchString = ''
|
||||
self.buildbotClobberModule = 'mozilla/tools/buildbot-configs/testing/unittest/CLOBBER/firefox/TRUNK/' + self.platform
|
||||
|
||||
if not 'command' in kwargs:
|
||||
if self.platform.startswith('win'):
|
||||
self.command = ''
|
||||
else:
|
||||
self.command = r'mkdir -p ' + self.clobberFilePath + r' && '
|
||||
self.command += r'cd ' + self.clobberFilePath + r' && cvs -d ' + self.cvsroot + r' checkout' + self.branchString + r' -d tinderbox-configs ' + self.tboxClobberModule + r'>' + self.logDir + tboxClobberCvsCoLog + r' && cvs -d ' + self.cvsroot + r' checkout -d buildbot-configs ' + self.buildbotClobberModule + r'>' + self.logDir + buildbotClobberCvsCoLog
|
||||
ShellCommand.__init__(self, **kwargs)
|
||||
|
||||
class MozillaClobber(ShellCommand):
|
||||
name = "clobber"
|
||||
description = "checking clobber file"
|
||||
descriptionDone = "clobber checked"
|
||||
filePath = "mozilla/tools/tinderbox-configs/firefox/"
|
||||
clobberFilePath = "clobber_files/"
|
||||
logDir = 'logs/'
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
if 'platform' in kwargs:
|
||||
self.platform = kwargs['platform']
|
||||
if logDir in kwargs:
|
||||
self.logDir = kwargs['logDir']
|
||||
if 'clobberFilePath' in kwargs:
|
||||
self.clobberFilePath = kwargs['clobberFilePath']
|
||||
if not 'command' in kwargs:
|
||||
self.command = ["awk"]
|
||||
catCommand = "cat %s%s/CLOBBER" % (self.filePath, self.platform)
|
||||
rmCommand = "rm -rf mozilla/objdir"
|
||||
awkString = "/U "+ self.filePath.replace('/', '.') + \
|
||||
self.platform + '.CLOBBER/ { system("' + catCommand + \
|
||||
'"); system("' + rmCommand + '") }'
|
||||
self.command.append(awkString)
|
||||
self.command.append('cvsco.log')
|
||||
if self.platform == 'win32':
|
||||
self.command = "sh -c 'awk \'" + awkString + "\' cvsco.log'"
|
||||
tboxGrepCommand = r"grep -q '^U tinderbox-configs.CLOBBER' " + self.logDir + tboxClobberCvsCoLog
|
||||
tboxPrintHeader = "echo Tinderbox clobber file updated"
|
||||
tboxCatCommand = "cat %s/tinderbox-configs/CLOBBER" % self.clobberFilePath
|
||||
buildbotGrepCommand = r"grep -q '^U buildbot-configs.CLOBBER' " + self.logDir + buildbotClobberCvsCoLog
|
||||
buildbotPrintHeader = "echo Buildbot clobber file updated"
|
||||
buildbotCatCommand = "cat %s/buildbot-configs/CLOBBER" % self.clobberFilePath
|
||||
rmCommand = "rm -rf mozilla"
|
||||
printExitStatus = "echo No clobber required"
|
||||
self.command = tboxGrepCommand + r' && ' + tboxPrintHeader + r' && ' + tboxCatCommand + r' && ' + rmCommand + r'; if [ $? -gt 0 ]; then ' + buildbotGrepCommand + r' && ' + buildbotPrintHeader + r' && ' + buildbotCatCommand + r' && ' + rmCommand + r'; fi; if [ $? -gt 0 ]; then ' + printExitStatus + r'; fi'
|
||||
ShellCommand.__init__(self, **kwargs)
|
||||
|
||||
|
||||
class MozillaClobberWin(ShellCommand):
|
||||
name = "clobber win"
|
||||
|
@ -211,10 +257,18 @@ class MozillaClobberWin(ShellCommand):
|
|||
descriptionDone = "clobber finished"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
platformFlag = ""
|
||||
slaveNameFlag = ""
|
||||
branchFlag = ""
|
||||
if 'platform' in kwargs:
|
||||
platformFlag = " --platform=" + kwargs['platform']
|
||||
if 'slaveName' in kwargs:
|
||||
slaveNameFlag = " --slaveName=" + kwargs['slaveName']
|
||||
if 'branch' in kwargs:
|
||||
branchFlag = " --branch=" + kwargs['branch']
|
||||
if not 'command' in kwargs:
|
||||
self.command = 'python C:\\Utilities\\killAndClobberWin.py'
|
||||
self.command = 'python C:\\Utilities\\killAndClobberWin.py' + platformFlag + slaveNameFlag + branchFlag
|
||||
ShellCommand.__init__(self, **kwargs)
|
||||
|
||||
|
||||
class MozillaCheck(ShellCommand):
|
||||
name = "check"
|
||||
|
|
Загрузка…
Ссылка в новой задаче