def stopBuildbot(self): """ Try to stop buildbot """ print "attempting to terminate buildbot" if os.name == "posix": check_call([self.buildbot, 'stop', '.'], cwd=self.basedir) elif os.name == "nt": for pid in getPidsOfProcess(['python', 'buildbot']): TerminateProcess(pid)
def stopBuildbot(self): """ Try to stop buildbot """ print "attempting to terminate buildbot" if os.name == "posix": check_call([self.buildbot, "stop", "."], cwd=self.basedir) elif os.name == "nt": for pid in getPidsOfProcess(["python", "buildbot"]): TerminateProcess(pid)
def startBuildbot(self): """ Try to start buildbot, removing twistd.pid if exists """ if os.name == "posix": pidfile = path.join(self.basedir, "twistd.pid") if exists(pidfile): os.remove(pidfile) print self.buildbot print self.basedir check_call([self.buildbot, "start", "."], cwd=self.basedir) elif os.name == "nt": check_call(["cmd.exe", "/C", "start", self.buildbot, "start", self.basedir])
def startBuildbot(self): """ Try to start buildbot, removing twistd.pid if exists """ if os.name == "posix": pidfile = path.join(self.basedir, 'twistd.pid') if exists(pidfile): os.remove(pidfile) print self.buildbot print self.basedir check_call([self.buildbot, 'start', '.'], cwd=self.basedir) elif os.name == "nt": check_call([ 'cmd.exe', '/C', 'start', self.buildbot, 'start', self.basedir ])
def updateConfig(self): """ Copy buildbot master configs to buildbot dir and reconfig """ isUpdate = self.checkForUpdates(checkoutdir="buildbot-configs", module=BUILDBOT_CONFIGS) configDir = path.join(self.checkoutbase, "buildbot-configs") if isUpdate: check_call( ["python", "buildbot/contrib/checkconfig.py", path.join("buildbot-configs", "master.cfg")], cwd=self.checkoutbase, ) for entry in listdir(configDir): if path.isdir(path.join(configDir, entry)): copytree(path.join(configDir, entry), path.join(self.basedir, entry)) else: copy2(path.join(configDir, entry), self.basedir) check_call([self.buildbot, "reconfig", "."], cwd=basedir)
def updateConfig(self): """ Copy buildbot master configs to buildbot dir and reconfig """ isUpdate = self.checkForUpdates(checkoutdir='buildbot-configs', module=BUILDBOT_CONFIGS) configDir = path.join(self.checkoutbase, 'buildbot-configs') if (isUpdate): check_call([ 'python', 'buildbot/contrib/checkconfig.py', path.join('buildbot-configs', 'master.cfg') ], cwd=self.checkoutbase) for entry in listdir(configDir): if path.isdir(path.join(configDir, entry)): copytree(path.join(configDir, entry), path.join(self.basedir, entry)) else: copy2(path.join(configDir, entry), self.basedir) check_call([self.buildbot, 'reconfig', '.'], cwd=basedir)
def installBuildbot(self): """ Install buildbot using setup.py """ bbotCheckout = path.join(self.checkoutbase, "buildbot") # TODO run unit tests check_call(["python", "setup.py", "install", "--prefix", self.prefix], cwd=bbotCheckout)
basedir=options.basedir, ) buildbot = path.join(b.prefix, BUILDBOT_RUN_SCRIPT) # If buildbot is not installed or configured, try to do it. # Note - no error handling here, the script will exit if something goes wrong. # if not exists(b.prefix): # b.checkForUpdates('buildbot', BUILDBOT_SOURCE) # b.installBuildbot() if not exists(b.basedir): print "basedir does not exist, creating" mkdir(b.basedir) if not exists(path.join(b.basedir, "buildbot.tac")): if isMaster: check_call([buildbot, "create-master", "."], cwd=b.basedir) else: check_call([buildbot, "create-slave", ".", master, username, password], cwd=b.basedir) # Loop infinitely and watch for CVS updates. Catch errors and retry, # unless it looks like the user wants to quit (KeyboardInterrupt) while True: try: # b.updateBuildbot() if isMaster: b.updateConfig() if not b.isRunning(): b.startBuildbot() except KeyboardInterrupt: print "someone wants us dead, quitting" sys.exit(0)
def installBuildbot(self): """ Install buildbot using setup.py """ bbotCheckout = path.join(self.checkoutbase, 'buildbot') # TODO run unit tests check_call(['python', 'setup.py', 'install', '--prefix', self.prefix], cwd=bbotCheckout)
checkoutbase=options.checkoutbase, basedir=options.basedir) buildbot = path.join(b.prefix, BUILDBOT_RUN_SCRIPT) # If buildbot is not installed or configured, try to do it. # Note - no error handling here, the script will exit if something goes wrong. #if not exists(b.prefix): # b.checkForUpdates('buildbot', BUILDBOT_SOURCE) # b.installBuildbot() if not exists(b.basedir): print "basedir does not exist, creating" mkdir(b.basedir) if not exists(path.join(b.basedir, 'buildbot.tac')): if isMaster: check_call([buildbot, 'create-master', '.'], cwd=b.basedir) else: check_call( [buildbot, 'create-slave', '.', master, username, password], cwd=b.basedir) # Loop infinitely and watch for CVS updates. Catch errors and retry, # unless it looks like the user wants to quit (KeyboardInterrupt) while True: try: #b.updateBuildbot() if isMaster: b.updateConfig() if not b.isRunning(): b.startBuildbot() except KeyboardInterrupt: