diff options
Diffstat (limited to 'lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts')
20 files changed, 0 insertions, 2121 deletions
diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/__init__.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/__init__.py +++ /dev/null diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/base.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/base.py deleted file mode 100644 index b1349a65..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/base.py +++ /dev/null @@ -1,172 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -import os -import copy -import stat -from twisted.python import usage, runtime - -def isBuildmasterDir(dir): - def print_error(error_message): - print "%s\ninvalid buildmaster directory '%s'" % (error_message, dir) - - buildbot_tac = os.path.join(dir, "buildbot.tac") - try: - contents = open(buildbot_tac).read() - except IOError, exception: - print_error("error reading '%s': %s" % \ - (buildbot_tac, exception.strerror)) - return False - - if "Application('buildmaster')" not in contents: - print_error("unexpected content in '%s'" % buildbot_tac) - return False - - return True - -def getConfigFileFromTac(basedir): - # execute the .tac file to see if its configfile location exists - tacFile = os.path.join(basedir, 'buildbot.tac') - if os.path.exists(tacFile): - # don't mess with the global namespace, but set __file__ for relocatable buildmasters - tacGlobals = {'__file__' : tacFile} - execfile(tacFile, tacGlobals) - return tacGlobals.get("configfile", "master.cfg") - else: - return "master.cfg" - -class SubcommandOptions(usage.Options): - # subclasses should set this to a list-of-lists in order to source the - # .buildbot/options file. Note that this *only* works with optParameters, - # not optFlags. Example: - # buildbotOptions = [ [ 'optfile-name', 'parameter-name' ], .. ] - buildbotOptions = None - - # set this to options that must have non-None values - requiredOptions = [] - - def __init__(self, *args): - # for options in self.buildbotOptions, optParameters, and the options - # file, change the default in optParameters to the value in the options - # file, call through to the constructor, and then change it back. - # Options uses reflect.accumulateClassList, so this *must* be a class - # attribute; however, we do not want to permanently change the class. - # So we patch it temporarily and restore it after. - cls = self.__class__ - if hasattr(cls, 'optParameters'): - old_optParameters = cls.optParameters - cls.optParameters = op = copy.deepcopy(cls.optParameters) - if self.buildbotOptions: - optfile = self.optionsFile = self.loadOptionsFile() - for optfile_name, option_name in self.buildbotOptions: - for i in range(len(op)): - if (op[i][0] == option_name - and optfile_name in optfile): - op[i] = list(op[i]) - op[i][2] = optfile[optfile_name] - usage.Options.__init__(self, *args) - if hasattr(cls, 'optParameters'): - cls.optParameters = old_optParameters - - def loadOptionsFile(self, _here=None): - """Find the .buildbot/options file. Crawl from the current directory - up towards the root, and also look in ~/.buildbot . The first directory - that's owned by the user and has the file we're looking for wins. - Windows skips the owned-by-user test. - - @rtype: dict - @return: a dictionary of names defined in the options file. If no - options file was found, return an empty dict. - """ - - here = _here or os.path.abspath(os.getcwd()) - - if runtime.platformType == 'win32': - # never trust env-vars, use the proper API - from win32com.shell import shellcon, shell - appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) - home = os.path.join(appdata, "buildbot") - else: - home = os.path.expanduser("~/.buildbot") - - searchpath = [] - toomany = 20 - while True: - searchpath.append(os.path.join(here, ".buildbot")) - next = os.path.dirname(here) - if next == here: - break # we've hit the root - here = next - toomany -= 1 # just in case - if toomany == 0: - print ("I seem to have wandered up into the infinite glories " - "of the heavens. Oops.") - break - - searchpath.append(home) - - localDict = {} - - for d in searchpath: - if os.path.isdir(d): - if runtime.platformType != 'win32': - if os.stat(d)[stat.ST_UID] != os.getuid(): - print "skipping %s because you don't own it" % d - continue # security, skip other people's directories - optfile = os.path.join(d, "options") - if os.path.exists(optfile): - try: - with open(optfile, "r") as f: - options = f.read() - exec options in localDict - except: - print "error while reading %s" % optfile - raise - break - - for k in localDict.keys(): - if k.startswith("__"): - del localDict[k] - return localDict - - def postOptions(self): - missing = [ k for k in self.requiredOptions if self[k] is None ] - if missing: - if len(missing) > 1: - msg = 'Required arguments missing: ' + ', '.join(missing) - else: - msg = 'Required argument missing: ' + missing[0] - raise usage.UsageError(msg) - -class BasedirMixin(object): - - """SubcommandOptions Mixin to handle subcommands that take a basedir - argument""" - - def parseArgs(self, *args): - if len(args) > 0: - self['basedir'] = args[0] - else: - # Use the current directory if no basedir was specified. - self['basedir'] = os.getcwd() - if len(args) > 1: - raise usage.UsageError("I wasn't expecting so many arguments") - - def postOptions(self): - # get an unambiguous, epxnaed basedir, including expanding '~', which - # may be useful in a .buildbot/config file - self['basedir'] = os.path.abspath(os.path.expanduser(self['basedir'])) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/buildbot_tac.tmpl b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/buildbot_tac.tmpl deleted file mode 100644 index 146c9698..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/buildbot_tac.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -import os - -from twisted.application import service -from buildbot.master import BuildMaster - -{% if relocatable -%} -basedir = '.' -{% else -%} -basedir = {{ basedir|repr }} -{%- endif %} -{% if not no_logrotate -%} -rotateLength = {{ log_size|repr }} -maxRotatedFiles = {{ log_count|repr }} -{%- endif %} -configfile = {{ config|repr }} - -# Default umask for server -umask = None - -# if this is a relocatable tac file, get the directory containing the TAC -if basedir == '.': - import os.path - basedir = os.path.abspath(os.path.dirname(__file__)) - -# note: this line is matched against to check that this is a buildmaster -# directory; do not edit it. -application = service.Application('buildmaster') -{% if not no_logrotate -%} -from twisted.python.logfile import LogFile -from twisted.python.log import ILogObserver, FileLogObserver -logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength, - maxRotatedFiles=maxRotatedFiles) -application.setComponent(ILogObserver, FileLogObserver(logfile).emit) -{%- endif %} - -m = BuildMaster(basedir, configfile, umask) -m.setServiceParent(application) -{% if not no_logrotate -%} -m.log_rotation.rotateLength = rotateLength -m.log_rotation.maxRotatedFiles = maxRotatedFiles -{%- endif %} - diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/checkconfig.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/checkconfig.py deleted file mode 100644 index 8e05b0bb..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/checkconfig.py +++ /dev/null @@ -1,56 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -import sys -import os -from buildbot import config -from buildbot.scripts.base import getConfigFileFromTac - -def _loadConfig(basedir, configFile, quiet): - try: - config.MasterConfig.loadConfig( - basedir, configFile) - except config.ConfigErrors, e: - if not quiet: - print >> sys.stderr, "Configuration Errors:" - for e in e.errors: - print >> sys.stderr, " " + e - return 1 - - if not quiet: - print "Config file is good!" - return 0 - - -def checkconfig(config): - quiet = config.get('quiet') - configFile = config.get('configFile') - - if os.path.isdir(configFile): - basedir = configFile - try: - configFile = getConfigFileFromTac(basedir) - except (SyntaxError, ImportError), e: - if not quiet: - print "Unable to load 'buildbot.tac' from '%s':" % basedir - print e - return 1 - else: - basedir = os.getcwd() - - return _loadConfig(basedir=basedir, configFile=configFile, quiet=quiet) - - -__all__ = ['checkconfig'] diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/create_master.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/create_master.py deleted file mode 100644 index ba5a5f60..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/create_master.py +++ /dev/null @@ -1,150 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -import os -import jinja2 -from twisted.python import util -from twisted.internet import defer -from buildbot.util import in_reactor -from buildbot.db import connector -from buildbot.master import BuildMaster -from buildbot import config as config_module -from buildbot import monkeypatches - -def makeBasedir(config): - if os.path.exists(config['basedir']): - if not config['quiet']: - print "updating existing installation" - return - if not config['quiet']: - print "mkdir", config['basedir'] - os.mkdir(config['basedir']) - -def makeTAC(config): - # render buildbot_tac.tmpl using the config - loader = jinja2.FileSystemLoader(os.path.dirname(__file__)) - env = jinja2.Environment(loader=loader, undefined=jinja2.StrictUndefined) - env.filters['repr'] = repr - tpl = env.get_template('buildbot_tac.tmpl') - cxt = dict((k.replace('-', '_'), v) for k,v in config.iteritems()) - contents = tpl.render(cxt) - - tacfile = os.path.join(config['basedir'], "buildbot.tac") - if os.path.exists(tacfile): - with open(tacfile, "rt") as f: - oldcontents = f.read() - if oldcontents == contents: - if not config['quiet']: - print "buildbot.tac already exists and is correct" - return - if not config['quiet']: - print "not touching existing buildbot.tac" - print "creating buildbot.tac.new instead" - tacfile += ".new" - with open(tacfile, "wt") as f: - f.write(contents) - -def makeSampleConfig(config): - source = util.sibpath(__file__, "sample.cfg") - target = os.path.join(config['basedir'], "master.cfg.sample") - if not config['quiet']: - print "creating %s" % target - with open(source, "rt") as f: - config_sample = f.read() - if config['db']: - config_sample = config_sample.replace('sqlite:///state.sqlite', - config['db']) - with open(target, "wt") as f: - f.write(config_sample) - os.chmod(target, 0600) - -def makePublicHtml(config): - files = { - 'bg_gradient.jpg' : "../status/web/files/bg_gradient.jpg", - 'default.css' : "../status/web/files/default.css", - 'robots.txt' : "../status/web/files/robots.txt", - 'favicon.ico' : "../status/web/files/favicon.ico", - } - webdir = os.path.join(config['basedir'], "public_html") - if os.path.exists(webdir): - if not config['quiet']: - print "public_html/ already exists: not replacing" - return - else: - os.mkdir(webdir) - if not config['quiet']: - print "populating public_html/" - for target, source in files.iteritems(): - source = util.sibpath(__file__, source) - target = os.path.join(webdir, target) - with open(target, "wt") as f: - with open(source, "rt") as i: - f.write(i.read()) - -def makeTemplatesDir(config): - files = { - 'README.txt' : "../status/web/files/templates_readme.txt", - } - template_dir = os.path.join(config['basedir'], "templates") - if os.path.exists(template_dir): - if not config['quiet']: - print "templates/ already exists: not replacing" - return - else: - os.mkdir(template_dir) - if not config['quiet']: - print "populating templates/" - for target, source in files.iteritems(): - source = util.sibpath(__file__, source) - target = os.path.join(template_dir, target) - with open(target, "wt") as f: - with open(source, "rt") as i: - f.write(i.read()) - -@defer.inlineCallbacks -def createDB(config, _noMonkey=False): - # apply the db monkeypatches (and others - no harm) - if not _noMonkey: # pragma: no cover - monkeypatches.patch_all() - - # create a master with the default configuration, but with db_url - # overridden - master_cfg = config_module.MasterConfig() - master_cfg.db['db_url'] = config['db'] - master = BuildMaster(config['basedir']) - master.config = master_cfg - db = connector.DBConnector(master, config['basedir']) - yield db.setup(check_version=False, verbose=not config['quiet']) - if not config['quiet']: - print "creating database (%s)" % (master_cfg.db['db_url'],) - yield db.model.upgrade() - - -@in_reactor -@defer.inlineCallbacks -def createMaster(config): - makeBasedir(config) - makeTAC(config) - makeSampleConfig(config) - makePublicHtml(config) - makeTemplatesDir(config) - yield createDB(config) - - if not config['quiet']: - print "buildmaster configured in %s" % (config['basedir'],) - - defer.returnValue(0) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/debugclient.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/debugclient.py deleted file mode 100644 index 4846c0bf..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/debugclient.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -def debugclient(config): - from buildbot.clients import debug - - d = debug.DebugWidget(config['master'], config['passwd']) - d.run() - return 0 diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/logwatcher.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/logwatcher.py deleted file mode 100644 index dede9704..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/logwatcher.py +++ /dev/null @@ -1,110 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - - -import os -from twisted.python.failure import Failure -from twisted.internet import defer, reactor, protocol, error -from twisted.protocols.basic import LineOnlyReceiver - -class FakeTransport: - disconnecting = False - -class BuildmasterTimeoutError(Exception): - pass -class ReconfigError(Exception): - pass - -class TailProcess(protocol.ProcessProtocol): - def outReceived(self, data): - self.lw.dataReceived(data) - def errReceived(self, data): - print "ERR: '%s'" % (data,) - - -class LogWatcher(LineOnlyReceiver): - POLL_INTERVAL = 0.1 - TIMEOUT_DELAY = 10.0 - delimiter = os.linesep - - def __init__(self, logfile): - self.logfile = logfile - self.in_reconfig = False - self.transport = FakeTransport() - self.pp = TailProcess() - self.pp.lw = self - self.timer = None - - def start(self): - # If the log file doesn't exist, create it now. - if not os.path.exists(self.logfile): - open(self.logfile, 'a').close() - - # return a Deferred that fires when the reconfig process has - # finished. It errbacks with TimeoutError if the finish line has not - # been seen within 10 seconds, and with ReconfigError if the error - # line was seen. If the logfile could not be opened, it errbacks with - # an IOError. - self.p = reactor.spawnProcess(self.pp, "/usr/bin/tail", - ("tail", "-f", "-n", "0", self.logfile), - env=os.environ, - ) - self.running = True - d = defer.maybeDeferred(self._start) - return d - - def _start(self): - self.d = defer.Deferred() - self.timer = reactor.callLater(self.TIMEOUT_DELAY, self.timeout) - return self.d - - def timeout(self): - self.timer = None - e = BuildmasterTimeoutError() - self.finished(Failure(e)) - - def finished(self, results): - try: - self.p.signalProcess("KILL") - except error.ProcessExitedAlready: - pass - if self.timer: - self.timer.cancel() - self.timer = None - self.running = False - self.in_reconfig = False - self.d.callback(results) - - def lineReceived(self, line): - if not self.running: - return - if "Log opened." in line: - self.in_reconfig = True - if "beginning configuration update" in line: - self.in_reconfig = True - - if self.in_reconfig: - print line - - if "message from master: attached" in line: - return self.finished("buildslave") - if "reconfig aborted" in line or 'reconfig partially applied' in line: - return self.finished(Failure(ReconfigError())) - if "Server Shut Down" in line: - return self.finished(Failure(ReconfigError())) - if "configuration update complete" in line: - return self.finished("buildmaster") - if "BuildMaster is running" in line: - return self.finished("buildmaster") diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/reconfig.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/reconfig.py deleted file mode 100644 index a7f5602e..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/reconfig.py +++ /dev/null @@ -1,92 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - - -import os -import signal -import platform -from twisted.internet import reactor - -from buildbot.scripts.logwatcher import LogWatcher, BuildmasterTimeoutError, \ - ReconfigError -from buildbot.util import in_reactor - -class Reconfigurator: - - rc = 0 - - def run(self, basedir, quiet): - # Returns "Microsoft" for Vista and "Windows" for other versions - if platform.system() in ("Windows", "Microsoft"): - print "Reconfig (through SIGHUP) is not supported on Windows." - print "The 'buildbot debugclient' tool can trigger a reconfig" - print "remotely, but requires Gtk+ libraries to run." - return - - with open(os.path.join(basedir, "twistd.pid"), "rt") as f: - self.pid = int(f.read().strip()) - if quiet: - os.kill(self.pid, signal.SIGHUP) - return - - # keep reading twistd.log. Display all messages between "loading - # configuration from ..." and "configuration update complete" or - # "I will keep using the previous config file instead.", or until - # 10 seconds have elapsed. - - self.sent_signal = False - reactor.callLater(0.2, self.sighup) - - lw = LogWatcher(os.path.join(basedir, "twistd.log")) - d = lw.start() - d.addCallbacks(self.success, self.failure) - d.addBoth(lambda _ : self.rc) - return d - - def sighup(self): - if self.sent_signal: - return - print "sending SIGHUP to process %d" % self.pid - self.sent_signal = True - os.kill(self.pid, signal.SIGHUP) - - def success(self, res): - print """ -Reconfiguration appears to have completed successfully. -""" - - def failure(self, why): - self.rc = 1 - if why.check(BuildmasterTimeoutError): - print "Never saw reconfiguration finish." - elif why.check(ReconfigError): - print """ -Reconfiguration failed. Please inspect the master.cfg file for errors, -correct them, then try 'buildbot reconfig' again. -""" - elif why.check(IOError): - # we were probably unable to open the file in the first place - self.sighup() - else: - print "Error while following twistd.log: %s" % why - -@in_reactor -def reconfig(config): - basedir = config['basedir'] - quiet = config['quiet'] - r = Reconfigurator() - return r.run(basedir, quiet) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/restart.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/restart.py deleted file mode 100644 index f9e0e28a..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/restart.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -from buildbot.scripts import base, stop, start - -def restart(config): - basedir = config['basedir'] - quiet = config['quiet'] - - if not base.isBuildmasterDir(basedir): - return 1 - - if stop.stop(config, wait=True) != 0: - return 1 - if not quiet: - print "now restarting buildbot process.." - return start.start(config) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/runner.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/runner.py deleted file mode 100644 index 89254c2a..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/runner.py +++ /dev/null @@ -1,731 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -# N.B.: don't import anything that might pull in a reactor yet. Some of our -# subcommands want to load modules that need the gtk reactor. -# -# Also don't forget to mirror your changes on command-line options in manual -# pages and texinfo documentation. - -from twisted.python import usage, reflect -import re -import sys - -from buildbot.scripts import base - -# Note that the terms 'options' and 'config' are used interchangeably here - in -# fact, they are interchanged several times. Caveat legator. - -def validateMasterOption(master): - """ - Validate master (-m, --master) command line option. - - Checks that option is a string of the 'hostname:port' form, otherwise - raises an UsageError exception. - - @type master: string - @param master: master option - - @raise usage.UsageError: on invalid master option - """ - try: - hostname, port = master.split(":") - port = int(port) - except: - raise usage.UsageError("master must have the form 'hostname:port'") - - -class UpgradeMasterOptions(base.BasedirMixin, base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.upgrade_master.upgradeMaster" - optFlags = [ - ["quiet", "q", "Do not emit the commands being run"], - ["replace", "r", "Replace any modified files without confirmation."], - ] - optParameters = [ - ] - - def getSynopsis(self): - return "Usage: buildbot upgrade-master [options] [<basedir>]" - - longdesc = """ - This command takes an existing buildmaster working directory and - adds/modifies the files there to work with the current version of - buildbot. When this command is finished, the buildmaster directory should - look much like a brand-new one created by the 'create-master' command. - - Use this after you've upgraded your buildbot installation and before you - restart the buildmaster to use the new version. - - If you have modified the files in your working directory, this command - will leave them untouched, but will put the new recommended contents in a - .new file (for example, if index.html has been modified, this command - will create index.html.new). You can then look at the new version and - decide how to merge its contents into your modified file. - - When upgrading from a pre-0.8.0 release (which did not use a database), - this command will create the given database and migrate data from the old - pickle files into it, then move the pickle files out of the way (e.g. to - changes.pck.old). - - When upgrading the database, this command uses the database specified in - the master configuration file. If you wish to use a database other than - the default (sqlite), be sure to set that parameter before upgrading. - """ - - -class CreateMasterOptions(base.BasedirMixin, base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.create_master.createMaster" - optFlags = [ - ["quiet", "q", "Do not emit the commands being run"], - ["force", "f", - "Re-use an existing directory (will not overwrite master.cfg file)"], - ["relocatable", "r", - "Create a relocatable buildbot.tac"], - ["no-logrotate", "n", - "Do not permit buildmaster rotate logs by itself"] - ] - optParameters = [ - ["config", "c", "master.cfg", "name of the buildmaster config file"], - ["log-size", "s", "10000000", - "size at which to rotate twisted log files"], - ["log-count", "l", "10", - "limit the number of kept old twisted log files"], - ["db", None, "sqlite:///state.sqlite", - "which DB to use for scheduler/status state. See below for syntax."], - ] - def getSynopsis(self): - return "Usage: buildbot create-master [options] [<basedir>]" - - longdesc = """ - This command creates a buildmaster working directory and buildbot.tac file. - The master will live in <dir> and create various files there. If - --relocatable is given, then the resulting buildbot.tac file will be - written such that its containing directory is assumed to be the basedir. - This is generally a good idea. - - At runtime, the master will read a configuration file (named - 'master.cfg' by default) in its basedir. This file should contain python - code which eventually defines a dictionary named 'BuildmasterConfig'. - The elements of this dictionary are used to configure the Buildmaster. - See doc/config.xhtml for details about what can be controlled through - this interface. - - The --db string is evaluated to build the DB object, which specifies - which database the buildmaster should use to hold scheduler state and - status information. The default (which creates an SQLite database in - BASEDIR/state.sqlite) is equivalent to: - - --db='sqlite:///state.sqlite' - - To use a remote MySQL database instead, use something like: - - --db='mysql://bbuser:bbpasswd@dbhost/bbdb' - The --db string is stored verbatim in the buildbot.tac file, and - evaluated as 'buildbot start' time to pass a DBConnector instance into - the newly-created BuildMaster object. - """ - - def postOptions(self): - base.BasedirMixin.postOptions(self) - if not re.match('^\d+$', self['log-size']): - raise usage.UsageError("log-size parameter needs to be an int") - if not re.match('^\d+$', self['log-count']) and \ - self['log-count'] != 'None': - raise usage.UsageError("log-count parameter needs to be an int "+ - " or None") - - -class StopOptions(base.BasedirMixin, base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.stop.stop" - optFlags = [ - ["quiet", "q", "Do not emit the commands being run"], - ["clean", "c", "Clean shutdown master"], - ] - def getSynopsis(self): - return "Usage: buildbot stop [<basedir>]" - - -class RestartOptions(base.BasedirMixin, base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.restart.restart" - optFlags = [ - ['quiet', 'q', "Don't display startup log messages"], - ['nodaemon', None, "Don't daemonize (stay in foreground)"], - ["clean", "c", "Clean shutdown master"], - ] - def getSynopsis(self): - return "Usage: buildbot restart [<basedir>]" - - -class StartOptions(base.BasedirMixin, base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.start.start" - optFlags = [ - ['quiet', 'q', "Don't display startup log messages"], - ['nodaemon', None, "Don't daemonize (stay in foreground)"], - ] - def getSynopsis(self): - return "Usage: buildbot start [<basedir>]" - - -class ReconfigOptions(base.BasedirMixin, base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.reconfig.reconfig" - optFlags = [ - ['quiet', 'q', "Don't display log messages about reconfiguration"], - ] - def getSynopsis(self): - return "Usage: buildbot reconfig [<basedir>]" - - -class DebugClientOptions(base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.debugclient.debugclient" - optParameters = [ - ["master", "m", None, - "Location of the buildmaster's slaveport (host:port)"], - ["passwd", "p", None, "Debug password to use"], - ] - buildbotOptions = [ - [ 'master', 'master' ], - [ 'debugMaster', 'master' ], - ] - requiredOptions = [ 'master', 'passwd' ] - - def getSynopsis(self): - return "Usage: buildbot debugclient [options]" - - def parseArgs(self, *args): - if len(args) > 0: - self['master'] = args[0] - if len(args) > 1: - self['passwd'] = args[1] - if len(args) > 2: - raise usage.UsageError("I wasn't expecting so many arguments") - - def postOptions(self): - base.SubcommandOptions.postOptions(self) - validateMasterOption(self.get('master')) - - -class BaseStatusClientOptions(base.SubcommandOptions): - optFlags = [ - ['help', 'h', "Display this message"], - ] - optParameters = [ - ["master", "m", None, - "Location of the buildmaster's status port (host:port)"], - ["username", "u", "statusClient", "Username performing the trial build"], - ["passwd", 'p', "clientpw", "password for PB authentication"], - ] - buildbotOptions = [ - [ 'master', 'master' ], - [ 'masterstatus', 'master' ], - ] - requiredOptions = [ 'master' ] - - def parseArgs(self, *args): - if len(args) > 0: - self['master'] = args[0] - if len(args) > 1: - raise usage.UsageError("I wasn't expecting so many arguments") - - def postOptions(self): - base.SubcommandOptions.postOptions(self) - validateMasterOption(self.get('master')) - - - -class StatusLogOptions(BaseStatusClientOptions): - subcommandFunction = "buildbot.scripts.statuslog.statuslog" - def getSynopsis(self): - return "Usage: buildbot statuslog [options]" - - -class StatusGuiOptions(BaseStatusClientOptions): - subcommandFunction = "buildbot.scripts.statusgui.statusgui" - def getSynopsis(self): - return "Usage: buildbot statusgui [options]" - - -class SendChangeOptions(base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.sendchange.sendchange" - def __init__(self): - base.SubcommandOptions.__init__(self) - self['properties'] = {} - - optParameters = [ - ("master", "m", None, - "Location of the buildmaster's PBListener (host:port)"), - # deprecated in 0.8.3; remove in 0.8.5 (bug #1711) - ("auth", "a", 'change:changepw', - "Authentication token - username:password, or prompt for password"), - ("who", "W", None, "Author of the commit"), - ("repository", "R", '', "Repository specifier"), - ("vc", "s", None, "The VC system in use, one of: cvs, svn, darcs, hg, " - "bzr, git, mtn, p4"), - ("project", "P", '', "Project specifier"), - ("branch", "b", None, "Branch specifier"), - ("category", "C", None, "Category of repository"), - ("codebase", None, None, - "Codebase this change is in (requires 0.8.7 master or later)"), - ("revision", "r", None, "Revision specifier"), - ("revision_file", None, None, "Filename containing revision spec"), - ("property", "p", None, - "A property for the change, in the format: name:value"), - ("comments", "c", None, "log message"), - ("logfile", "F", None, - "Read the log messages from this file (- for stdin)"), - ("when", "w", None, "timestamp to use as the change time"), - ("revlink", "l", '', "Revision link (revlink)"), - ("encoding", "e", 'utf8', - "Encoding of other parameters (default utf8)"), - ] - - buildbotOptions = [ - [ 'master', 'master' ], - [ 'who', 'who' ], - [ 'branch', 'branch' ], - [ 'category', 'category' ], - [ 'vc', 'vc' ], - ] - - requiredOptions = [ 'who', 'master' ] - - def getSynopsis(self): - return "Usage: buildbot sendchange [options] filenames.." - - def parseArgs(self, *args): - self['files'] = args - - def opt_property(self, property): - name,value = property.split(':', 1) - self['properties'][name] = value - - def postOptions(self): - base.SubcommandOptions.postOptions(self) - - if self.get("revision_file"): - with open(self["revision_file"],"r") as f: - self['revision'] = f.read() - - if self.get('when'): - try: - self['when'] = float(self['when']) - except: - raise usage.UsageError('invalid "when" value %s' - % (self['when'],)) - else: - self['when'] = None - - if not self.get('comments') and self.get('logfile'): - if self['logfile'] == "-": - self['comments'] = sys.stdin.read() - else: - with open(self['logfile'], "rt") as f: - self['comments'] = f.read() - if self.get('comments') is None: - self['comments'] = "" - - # fix up the auth with a password if none was given - auth = self.get('auth') - if ':' not in auth: - import getpass - pw = getpass.getpass("Enter password for '%s': " % auth) - auth = "%s:%s" % (auth, pw) - self['auth'] = tuple(auth.split(':', 1)) - - vcs = ['cvs', 'svn', 'darcs', 'hg', 'bzr', 'git', 'mtn', 'p4'] - if self.get('vc') and self.get('vc') not in vcs: - raise usage.UsageError("vc must be one of %s" % (', '.join(vcs))) - - validateMasterOption(self.get('master')) - -class TryOptions(base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.trycmd.trycmd" - optParameters = [ - ["connect", "c", None, - "How to reach the buildmaster, either 'ssh' or 'pb'"], - # for ssh, use --host, --username, and --jobdir - ["host", None, None, - "Hostname (used by ssh) for the buildmaster"], - ["jobdir", None, None, - "Directory (on the buildmaster host) where try jobs are deposited"], - ["username", "u", None, - "Username performing the try build"], - # for PB, use --master, --username, and --passwd - ["master", "m", None, - "Location of the buildmaster's PBListener (host:port)"], - ["passwd", None, None, - "Password for PB authentication"], - ["who", "w", None, - "Who is responsible for the try build"], - ["comment", "C", None, - "A comment which can be used in notifications for this build"], - - # for ssh to accommodate running in a virtualenv on the buildmaster - ["buildbotbin", None, "buildbot", - "buildbot binary to use on the buildmaster host"], - - ["diff", None, None, - "Filename of a patch to use instead of scanning a local tree. " - "Use '-' for stdin."], - ["patchlevel", "p", 0, - "Number of slashes to remove from patch pathnames, " - "like the -p option to 'patch'"], - - ["baserev", None, None, - "Base revision to use instead of scanning a local tree."], - - ["vc", None, None, - "The VC system in use, one of: bzr, cvs, darcs, git, hg, " - "mtn, p4, svn"], - ["branch", None, None, - "The branch in use, for VC systems that can't figure it out " - "themselves"], - ["repository", None, None, - "Repository to use, instead of path to working directory."], - - ["builder", "b", None, - "Run the trial build on this Builder. Can be used multiple times."], - ["properties", None, None, - "A set of properties made available in the build environment, " - "format is --properties=prop1=value1,prop2=value2,.. " - "option can be specified multiple times."], - ["property", None, None, - "A property made available in the build environment, " - "format:prop=value. Can be used multiple times."], - - ["topfile", None, None, - "Name of a file at the top of the tree, used to find the top. " - "Only needed for SVN and CVS."], - ["topdir", None, None, - "Path to the top of the working copy. Only needed for SVN and CVS."], - ] - - optFlags = [ - ["wait", None, - "wait until the builds have finished"], - ["dryrun", 'n', - "Gather info, but don't actually submit."], - ["get-builder-names", None, - "Get the names of available builders. Doesn't submit anything. " - "Only supported for 'pb' connections."], - ["quiet", "q", - "Don't print status of current builds while waiting."], - ] - - # Mapping of .buildbot/options names to command-line options - buildbotOptions = [ - [ 'try_connect', 'connect' ], - #[ 'try_builders', 'builders' ], <-- handled in postOptions - [ 'try_vc', 'vc' ], - [ 'try_branch', 'branch' ], - [ 'try_repository', 'repository' ], - [ 'try_topdir', 'topdir' ], - [ 'try_topfile', 'topfile' ], - [ 'try_host', 'host' ], - [ 'try_username', 'username' ], - [ 'try_jobdir', 'jobdir' ], - [ 'try_buildbotbin', 'buildbotbin' ], - [ 'try_passwd', 'passwd' ], - [ 'try_master', 'master' ], - [ 'try_who', 'who' ], - [ 'try_comment', 'comment' ], - #[ 'try_wait', 'wait' ], <-- handled in postOptions - #[ 'try_quiet', 'quiet' ], <-- handled in postOptions - - # Deprecated command mappings from the quirky old days: - [ 'try_masterstatus', 'master' ], - [ 'try_dir', 'jobdir' ], - [ 'try_password', 'passwd' ], - ] - - def __init__(self): - base.SubcommandOptions.__init__(self) - self['builders'] = [] - self['properties'] = {} - - def opt_builder(self, option): - self['builders'].append(option) - - def opt_properties(self, option): - # We need to split the value of this option into a dictionary of properties - propertylist = option.split(",") - for i in range(0,len(propertylist)): - splitproperty = propertylist[i].split("=", 1) - self['properties'][splitproperty[0]] = splitproperty[1] - - def opt_property(self, option): - name, _, value = option.partition("=") - self['properties'][name] = value - - def opt_patchlevel(self, option): - self['patchlevel'] = int(option) - - def getSynopsis(self): - return "Usage: buildbot try [options]" - - def postOptions(self): - base.SubcommandOptions.postOptions(self) - opts = self.optionsFile - if not self['builders']: - self['builders'] = opts.get('try_builders', []) - if opts.get('try_wait', False): - self['wait'] = True - if opts.get('try_quiet', False): - self['quiet'] = True - # get the global 'masterstatus' option if it's set and no master - # was specified otherwise - if not self['master']: - self['master'] = opts.get('masterstatus', None) - - if self['connect'] == 'pb': - if not self['master']: - raise usage.UsageError("master location must be specified" \ - "for 'pb' connections") - validateMasterOption(self['master']) - - -class TryServerOptions(base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.tryserver.tryserver" - optParameters = [ - ["jobdir", None, None, "the jobdir (maildir) for submitting jobs"], - ] - requiredOptions = [ 'jobdir' ] - - def getSynopsis(self): - return "Usage: buildbot tryserver [options]" - - def postOptions(self): - if not self['jobdir']: - raise usage.UsageError('jobdir is required') - - -class CheckConfigOptions(base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.checkconfig.checkconfig" - optFlags = [ - ['quiet', 'q', "Don't display error messages or tracebacks"], - ] - - def getSynopsis(self): - return "Usage: buildbot checkconfig [configFile]\n" + \ - " If not specified, 'master.cfg' will be used as 'configFile'" - - def parseArgs(self, *args): - if len(args) >= 1: - self['configFile'] = args[0] - else: - self['configFile'] = 'master.cfg' - - -class UserOptions(base.SubcommandOptions): - subcommandFunction = "buildbot.scripts.user.user" - optParameters = [ - ["master", "m", None, - "Location of the buildmaster's PBListener (host:port)"], - ["username", "u", None, - "Username for PB authentication"], - ["passwd", "p", None, - "Password for PB authentication"], - ["op", None, None, - "User management operation: add, remove, update, get"], - ["bb_username", None, None, - "Username to set for a given user. Only availabe on 'update', " - "and bb_password must be given as well."], - ["bb_password", None, None, - "Password to set for a given user. Only availabe on 'update', " - "and bb_username must be given as well."], - ["ids", None, None, - "User's identifiers, used to find users in 'remove' and 'get' " - "Can be specified multiple times (--ids=id1,id2,id3)"], - ["info", None, None, - "User information in the form: --info=type=value,type=value,.. " - "Used in 'add' and 'update', can be specified multiple times. " - "Note that 'update' requires --info=id:type=value..."] - ] - buildbotOptions = [ - [ 'master', 'master' ], - [ 'user_master', 'master' ], - [ 'user_username', 'username' ], - [ 'user_passwd', 'passwd' ], - ] - requiredOptions = [ 'master' ] - - longdesc = """ - Currently implemented types for --info= are:\n - git, svn, hg, cvs, darcs, bzr, email - """ - - def __init__(self): - base.SubcommandOptions.__init__(self) - self['ids'] = [] - self['info'] = [] - - def opt_ids(self, option): - id_list = option.split(",") - self['ids'].extend(id_list) - - def opt_info(self, option): - # splits info into type/value dictionary, appends to info - info_list = option.split(",") - info_elem = {} - - if len(info_list) == 1 and '=' not in info_list[0]: - info_elem["identifier"] = info_list[0] - self['info'].append(info_elem) - else: - for i in range(0, len(info_list)): - split_info = info_list[i].split("=", 1) - - # pull identifier from update --info - if ":" in split_info[0]: - split_id = split_info[0].split(":") - info_elem["identifier"] = split_id[0] - split_info[0] = split_id[1] - - info_elem[split_info[0]] = split_info[1] - self['info'].append(info_elem) - - def getSynopsis(self): - return "Usage: buildbot user [options]" - - def _checkValidTypes(self, info): - from buildbot.process.users import users - valid = set(['identifier', 'email'] + users.srcs) - - for user in info: - for attr_type in user: - if attr_type not in valid: - raise usage.UsageError( - "Type not a valid attr_type, must be in: %s" - % ', '.join(valid)) - - def postOptions(self): - base.SubcommandOptions.postOptions(self) - - validateMasterOption(self.get('master')) - - op = self.get('op') - if not op: - raise usage.UsageError("you must specify an operation: add, " - "remove, update, get") - if op not in ['add', 'remove', 'update', 'get']: - raise usage.UsageError("bad op %r, use 'add', 'remove', 'update', " - "or 'get'" % op) - - if not self.get('username') or not self.get('passwd'): - raise usage.UsageError("A username and password must be given") - - bb_username = self.get('bb_username') - bb_password = self.get('bb_password') - if bb_username or bb_password: - if op != 'update': - raise usage.UsageError("bb_username and bb_password only work " - "with update") - if not bb_username or not bb_password: - raise usage.UsageError("Must specify both bb_username and " - "bb_password or neither.") - - info = self.get('info') - ids = self.get('ids') - - # check for erroneous args - if not info and not ids: - raise usage.UsageError("must specify either --ids or --info") - - if op == 'add' or op == 'update': - if ids: - raise usage.UsageError("cannot use --ids with 'add' or " - "'update'") - self._checkValidTypes(info) - if op == 'update': - for user in info: - if 'identifier' not in user: - raise usage.UsageError("no ids found in update info; " - "use: --info=id:type=value,type=value,..") - if op == 'add': - for user in info: - if 'identifier' in user: - raise usage.UsageError("identifier found in add info, " - "use: --info=type=value,type=value,..") - if op == 'remove' or op == 'get': - if info: - raise usage.UsageError("cannot use --info with 'remove' " - "or 'get'") - - -class Options(usage.Options): - synopsis = "Usage: buildbot <command> [command options]" - - subCommands = [ - ['create-master', None, CreateMasterOptions, - "Create and populate a directory for a new buildmaster"], - ['upgrade-master', None, UpgradeMasterOptions, - "Upgrade an existing buildmaster directory for the current version"], - ['start', None, StartOptions, - "Start a buildmaster"], - ['stop', None, StopOptions, - "Stop a buildmaster"], - ['restart', None, RestartOptions, - "Restart a buildmaster"], - ['reconfig', None, ReconfigOptions, - "SIGHUP a buildmaster to make it re-read the config file"], - ['sighup', None, ReconfigOptions, - "SIGHUP a buildmaster to make it re-read the config file"], - ['sendchange', None, SendChangeOptions, - "Send a change to the buildmaster"], - ['debugclient', None, DebugClientOptions, - "Launch a small debug panel GUI"], - ['statuslog', None, StatusLogOptions, - "Emit current builder status to stdout"], - ['statusgui', None, StatusGuiOptions, - "Display a small window showing current builder status"], - ['try', None, TryOptions, - "Run a build with your local changes"], - ['tryserver', None, TryServerOptions, - "buildmaster-side 'try' support function, not for users"], - ['checkconfig', None, CheckConfigOptions, - "test the validity of a master.cfg config file"], - ['user', None, UserOptions, - "Manage users in buildbot's database"] - ] - - def opt_version(self): - import buildbot - print "Buildbot version: %s" % buildbot.version - usage.Options.opt_version(self) - - def opt_verbose(self): - from twisted.python import log - log.startLogging(sys.stderr) - - def postOptions(self): - if not hasattr(self, 'subOptions'): - raise usage.UsageError("must specify a command") - - -def run(): - config = Options() - try: - config.parseOptions(sys.argv[1:]) - except usage.error, e: - print "%s: %s" % (sys.argv[0], e) - print - c = getattr(config, 'subOptions', config) - print str(c) - sys.exit(1) - - subconfig = config.subOptions - subcommandFunction = reflect.namedObject(subconfig.subcommandFunction) - sys.exit(subcommandFunction(subconfig)) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/sample.cfg b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/sample.cfg deleted file mode 100644 index c461f644..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/sample.cfg +++ /dev/null @@ -1,126 +0,0 @@ -# -*- python -*- -# ex: set syntax=python: - -# This is a sample buildmaster config file. It must be installed as -# 'master.cfg' in your buildmaster's base directory. - -# This is the dictionary that the buildmaster pays attention to. We also use -# a shorter alias to save typing. -c = BuildmasterConfig = {} - -####### BUILDSLAVES - -# The 'slaves' list defines the set of recognized buildslaves. Each element is -# a BuildSlave object, specifying a unique slave name and password. The same -# slave name and password must be configured on the slave. -from buildbot.buildslave import BuildSlave -c['slaves'] = [BuildSlave("example-slave", "pass")] - -# 'slavePortnum' defines the TCP port to listen on for connections from slaves. -# This must match the value configured into the buildslaves (with their -# --master option) -c['slavePortnum'] = 9989 - -####### CHANGESOURCES - -# the 'change_source' setting tells the buildmaster how it should find out -# about source code changes. Here we point to the buildbot clone of pyflakes. - -from buildbot.changes.gitpoller import GitPoller -c['change_source'] = [] -c['change_source'].append(GitPoller( - 'git://github.com/buildbot/pyflakes.git', - workdir='gitpoller-workdir', branch='master', - pollinterval=300)) - -####### SCHEDULERS - -# Configure the Schedulers, which decide how to react to incoming changes. In this -# case, just kick off a 'runtests' build - -from buildbot.schedulers.basic import SingleBranchScheduler -from buildbot.schedulers.forcesched import ForceScheduler -from buildbot.changes import filter -c['schedulers'] = [] -c['schedulers'].append(SingleBranchScheduler( - name="all", - change_filter=filter.ChangeFilter(branch='master'), - treeStableTimer=None, - builderNames=["runtests"])) -c['schedulers'].append(ForceScheduler( - name="force", - builderNames=["runtests"])) - -####### BUILDERS - -# The 'builders' list defines the Builders, which tell Buildbot how to perform a build: -# what steps, and which slaves can execute them. Note that any particular build will -# only take place on one slave. - -from buildbot.process.factory import BuildFactory -from buildbot.steps.source.git import Git -from buildbot.steps.shell import ShellCommand - -factory = BuildFactory() -# check out the source -factory.addStep(Git(repourl='git://github.com/buildbot/pyflakes.git', mode='incremental')) -# run the tests (note that this will require that 'trial' is installed) -factory.addStep(ShellCommand(command=["trial", "pyflakes"])) - -from buildbot.config import BuilderConfig - -c['builders'] = [] -c['builders'].append( - BuilderConfig(name="runtests", - slavenames=["example-slave"], - factory=factory)) - -####### STATUS TARGETS - -# 'status' is a list of Status Targets. The results of each build will be -# pushed to these targets. buildbot/status/*.py has a variety to choose from, -# including web pages, email senders, and IRC bots. - -c['status'] = [] - -from buildbot.status import html -from buildbot.status.web import authz, auth - -authz_cfg=authz.Authz( - # change any of these to True to enable; see the manual for more - # options - auth=auth.BasicAuth([("pyflakes","pyflakes")]), - gracefulShutdown = False, - forceBuild = 'auth', # use this to test your slave once it is set up - forceAllBuilds = False, - pingBuilder = False, - stopBuild = False, - stopAllBuilds = False, - cancelPendingBuild = False, -) -c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) - -####### PROJECT IDENTITY - -# the 'title' string will appear at the top of this buildbot -# installation's html.WebStatus home page (linked to the -# 'titleURL') and is embedded in the title of the waterfall HTML page. - -c['title'] = "Pyflakes" -c['titleURL'] = "https://launchpad.net/pyflakes" - -# the 'buildbotURL' string should point to the location where the buildbot's -# internal web server (usually the html.WebStatus page) is visible. This -# typically uses the port number set in the Waterfall 'status' entry, but -# with an externally-visible host name which the buildbot cannot figure out -# without some help. - -c['buildbotURL'] = "http://localhost:8010/" - -####### DB URL - -c['db'] = { - # This specifies what database buildbot uses to store its state. You can leave - # this at its default for all but the largest installations. - 'db_url' : "sqlite:///state.sqlite", -} diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/sendchange.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/sendchange.py deleted file mode 100644 index 480d28dd..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/sendchange.py +++ /dev/null @@ -1,54 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -import sys -import traceback -from twisted.internet import defer -from buildbot.clients import sendchange as sendchange_client -from buildbot.util import in_reactor - -@in_reactor -@defer.inlineCallbacks -def sendchange(config): - encoding = config.get('encoding', 'utf8') - who = config.get('who') - auth = config.get('auth') - master = config.get('master') - branch = config.get('branch') - category = config.get('category') - revision = config.get('revision') - properties = config.get('properties', {}) - repository = config.get('repository', '') - vc = config.get('vc', None) - project = config.get('project', '') - revlink = config.get('revlink', '') - when = config.get('when') - comments = config.get('comments') - files = config.get('files', ()) - codebase = config.get('codebase', None) - - s = sendchange_client.Sender(master, auth, encoding=encoding) - try: - yield s.send(branch, revision, comments, files, who=who, - category=category, when=when, properties=properties, - repository=repository, vc=vc, project=project, revlink=revlink, - codebase=codebase) - except: - print "change not sent:" - traceback.print_exc(file=sys.stdout) - defer.returnValue(1) - else: - print "change sent successfully" - defer.returnValue(0) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/start.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/start.py deleted file mode 100644 index e49787b5..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/start.py +++ /dev/null @@ -1,115 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - - -import os, sys -from buildbot.scripts import base -from twisted.internet import reactor, protocol -from twisted.python.runtime import platformType -from buildbot.scripts.logwatcher import LogWatcher -from buildbot.scripts.logwatcher import BuildmasterTimeoutError -from buildbot.scripts.logwatcher import ReconfigError - -class Follower: - def follow(self, basedir): - self.rc = 0 - print "Following twistd.log until startup finished.." - lw = LogWatcher(os.path.join(basedir, "twistd.log")) - d = lw.start() - d.addCallbacks(self._success, self._failure) - reactor.run() - return self.rc - - def _success(self, _): - print "The buildmaster appears to have (re)started correctly." - self.rc = 0 - reactor.stop() - - def _failure(self, why): - if why.check(BuildmasterTimeoutError): - print """ -The buildmaster took more than 10 seconds to start, so we were unable to -confirm that it started correctly. Please 'tail twistd.log' and look for a -line that says 'configuration update complete' to verify correct startup. -""" - elif why.check(ReconfigError): - print """ -The buildmaster appears to have encountered an error in the master.cfg config -file during startup. Please inspect and fix master.cfg, then restart the -buildmaster. -""" - else: - print """ -Unable to confirm that the buildmaster started correctly. You may need to -stop it, fix the config file, and restart. -""" - print why - self.rc = 1 - reactor.stop() - -def launchNoDaemon(config): - os.chdir(config['basedir']) - sys.path.insert(0, os.path.abspath(config['basedir'])) - - argv = ["twistd", - "--no_save", - '--nodaemon', - "--logfile=twistd.log", # windows doesn't use the same default - "--python=buildbot.tac"] - sys.argv = argv - - # this is copied from bin/twistd. twisted-2.0.0 through 2.4.0 use - # _twistw.run . Twisted-2.5.0 and later use twistd.run, even for - # windows. - from twisted.scripts import twistd - twistd.run() - -def launch(config): - os.chdir(config['basedir']) - sys.path.insert(0, os.path.abspath(config['basedir'])) - - # see if we can launch the application without actually having to - # spawn twistd, since spawning processes correctly is a real hassle - # on windows. - argv = [sys.executable, - "-c", - # this is copied from bin/twistd. twisted-2.0.0 through 2.4.0 use - # _twistw.run . Twisted-2.5.0 and later use twistd.run, even for - # windows. - "from twisted.scripts import twistd; twistd.run()", - "--no_save", - "--logfile=twistd.log", # windows doesn't use the same default - "--python=buildbot.tac"] - - # ProcessProtocol just ignores all output - reactor.spawnProcess(protocol.ProcessProtocol(), sys.executable, argv, env=os.environ) - -def start(config): - if not base.isBuildmasterDir(config['basedir']): - return 1 - - if config['nodaemon']: - launchNoDaemon(config) - return 0 - - launch(config) - - # We don't have tail on windows - if platformType == "win32" or config['quiet']: - return 0 - - # this is the parent - rc = Follower().follow(config['basedir']) - return rc diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/statusgui.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/statusgui.py deleted file mode 100644 index bf8ac31f..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/statusgui.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -# note that this cannot be run in tests for code coverage, as it requires a -# different reactor than the default - -def statusgui(config): - from buildbot.clients import gtkPanes - - master = config.get('master') - passwd = config.get('passwd') - username = config.get('username') - c = gtkPanes.GtkClient(master, username=username, passwd=passwd) - c.run() - return 0 diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/statuslog.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/statuslog.py deleted file mode 100644 index 2c65cc41..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/statuslog.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -# note that this cannot be run in tests for code coverage, as it requires a -# different reactor than the default - -from buildbot.clients import text - -def statuslog(config): - master = config.get('master') - passwd = config.get('passwd') - username = config.get('username') - c = text.TextClient(master, username=username, passwd=passwd) - c.run() - return 0 diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/stop.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/stop.py deleted file mode 100644 index 69020a3b..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/stop.py +++ /dev/null @@ -1,79 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -import time -import os -import errno -import signal -from buildbot.scripts import base - -def stop(config, signame="TERM", wait=False): - basedir = config['basedir'] - quiet = config['quiet'] - - if config['clean']: - signame = 'USR1' - - if not base.isBuildmasterDir(config['basedir']): - return 1 - - pidfile = os.path.join(basedir, 'twistd.pid') - try: - with open(pidfile, "rt") as f: - pid = int(f.read().strip()) - except: - if not config['quiet']: - print "buildmaster not running" - return 0 - - signum = getattr(signal, "SIG"+signame) - try: - os.kill(pid, signum) - except OSError, e: - if e.errno != errno.ESRCH: - raise - else: - if not config['quiet']: - print "buildmaster not running" - try: - os.unlink(pidfile) - except: - pass - return 0 - - if not wait: - if not quiet: - print "sent SIG%s to process" % signame - return 0 - - time.sleep(0.1) - - # poll once per second until twistd.pid goes away, up to 10 seconds, - # unless we're doing a clean stop, in which case wait forever - count = 0 - while count < 10 or config['clean']: - try: - os.kill(pid, 0) - except OSError: - if not quiet: - print "buildbot process %d is dead" % pid - return 0 - time.sleep(1) - count += 1 - if not quiet: - print "never saw process go away" - return 1 diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/trycmd.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/trycmd.py deleted file mode 100644 index e4f70cd1..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/trycmd.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -def trycmd(config): - from buildbot.clients import tryclient - t = tryclient.Try(config) - t.run() - return 0 diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/tryserver.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/tryserver.py deleted file mode 100644 index 713cdacb..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/tryserver.py +++ /dev/null @@ -1,40 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -import os -import sys -import time -from hashlib import md5 - -def tryserver(config): - jobdir = os.path.expanduser(config["jobdir"]) - job = sys.stdin.read() - # now do a 'safecat'-style write to jobdir/tmp, then move atomically to - # jobdir/new . Rather than come up with a unique name randomly, I'm just - # going to MD5 the contents and prepend a timestamp. - timestring = "%d" % time.time() - m = md5() - m.update(job) - jobhash = m.hexdigest() - fn = "%s-%s" % (timestring, jobhash) - tmpfile = os.path.join(jobdir, "tmp", fn) - newfile = os.path.join(jobdir, "new", fn) - with open(tmpfile, "w") as f: - f.write(job) - os.rename(tmpfile, newfile) - - return 0 diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/upgrade_master.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/upgrade_master.py deleted file mode 100644 index c471965d..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/upgrade_master.py +++ /dev/null @@ -1,180 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from __future__ import with_statement - -import os -import sys -import traceback -from twisted.internet import defer -from twisted.python import util, runtime -from buildbot import config as config_module -from buildbot import monkeypatches -from buildbot.db import connector -from buildbot.master import BuildMaster -from buildbot.util import in_reactor -from buildbot.scripts import base - -def checkBasedir(config): - if not config['quiet']: - print "checking basedir" - - if not base.isBuildmasterDir(config['basedir']): - return False - - if runtime.platformType != 'win32': # no pids on win32 - if not config['quiet']: - print "checking for running master" - pidfile = os.path.join(config['basedir'], 'twistd.pid') - if os.path.exists(pidfile): - print "'%s' exists - is this master still running?" % (pidfile,) - return False - - return True - -def loadConfig(config, configFileName='master.cfg'): - if not config['quiet']: - print "checking %s" % configFileName - - try: - master_cfg = config_module.MasterConfig.loadConfig( - config['basedir'], configFileName) - except config_module.ConfigErrors, e: - print "Errors loading configuration:" - for msg in e.errors: - print " " + msg - return - except: - print "Errors loading configuration:" - traceback.print_exc(file=sys.stdout) - return - - return master_cfg - -def installFile(config, target, source, overwrite=False): - with open(source, "rt") as f: - new_contents = f.read() - if os.path.exists(target): - with open(target, "rt") as f: - old_contents = f.read() - if old_contents != new_contents: - if overwrite: - if not config['quiet']: - print "%s has old/modified contents" % target - print " overwriting it with new contents" - with open(target, "wt") as f: - f.write(new_contents) - else: - if not config['quiet']: - print "%s has old/modified contents" % target - print " writing new contents to %s.new" % target - with open(target + ".new", "wt") as f: - f.write(new_contents) - # otherwise, it's up to date - else: - if not config['quiet']: - print "creating %s" % target - with open(target, "wt") as f: - f.write(new_contents) - -def upgradeFiles(config): - if not config['quiet']: - print "upgrading basedir" - - webdir = os.path.join(config['basedir'], "public_html") - if not os.path.exists(webdir): - if not config['quiet']: - print "creating public_html" - os.mkdir(webdir) - - templdir = os.path.join(config['basedir'], "templates") - if not os.path.exists(templdir): - if not config['quiet']: - print "creating templates" - os.mkdir(templdir) - - for file in ('bg_gradient.jpg', 'default.css', - 'robots.txt', 'favicon.ico'): - source = util.sibpath(__file__, "../status/web/files/%s" % (file,)) - target = os.path.join(webdir, file) - try: - installFile(config, target, source) - except IOError: - print "Can't write '%s'." % (target,) - - installFile(config, os.path.join(config['basedir'], "master.cfg.sample"), - util.sibpath(__file__, "sample.cfg"), overwrite=True) - - # if index.html exists, use it to override the root page tempalte - index_html = os.path.join(webdir, "index.html") - root_html = os.path.join(templdir, "root.html") - if os.path.exists(index_html): - if os.path.exists(root_html): - print "Notice: %s now overrides %s" % (root_html, index_html) - print " as the latter is not used by buildbot anymore." - print " Decide which one you want to keep." - else: - try: - print "Notice: Moving %s to %s." % (index_html, root_html) - print " You can (and probably want to) remove it if " \ - "you haven't modified this file." - os.renames(index_html, root_html) - except Exception, e: - print "Error moving %s to %s: %s" % (index_html, root_html, - str(e)) - -@defer.inlineCallbacks -def upgradeDatabase(config, master_cfg): - if not config['quiet']: - print "upgrading database (%s)" % (master_cfg.db['db_url']) - - master = BuildMaster(config['basedir']) - master.config = master_cfg - db = connector.DBConnector(master, basedir=config['basedir']) - - yield db.setup(check_version=False, verbose=not config['quiet']) - yield db.model.upgrade() - -@in_reactor -@defer.inlineCallbacks -def upgradeMaster(config, _noMonkey=False): - if not _noMonkey: # pragma: no cover - monkeypatches.patch_all() - - if not checkBasedir(config): - defer.returnValue(1) - return - - os.chdir(config['basedir']) - - try: - configFile = base.getConfigFileFromTac(config['basedir']) - except (SyntaxError, ImportError), e: - print "Unable to load 'buildbot.tac' from '%s':" % config['basedir'] - print e - defer.returnValue(1) - return - master_cfg = loadConfig(config, configFile) - if not master_cfg: - defer.returnValue(1) - return - - upgradeFiles(config) - yield upgradeDatabase(config, master_cfg) - - if not config['quiet']: - print "upgrade complete" - - defer.returnValue(0) diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/user.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/user.py deleted file mode 100644 index 4f231e76..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/user.py +++ /dev/null @@ -1,48 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from twisted.internet import defer -from buildbot.clients import usersclient -from buildbot.process.users import users -from buildbot.util import in_reactor - -@in_reactor -@defer.inlineCallbacks -def user(config): - - master = config.get('master') - op = config.get('op') - username = config.get('username') - passwd = config.get('passwd') - master, port = master.split(":") - port = int(port) - bb_username = config.get('bb_username') - bb_password = config.get('bb_password') - if bb_username or bb_password: - bb_password = users.encrypt(bb_password) - info = config.get('info') - ids = config.get('ids') - - # find identifier if op == add - if info and op == 'add': - for user in info: - user['identifier'] = sorted(user.values())[0] - - uc = usersclient.UsersClient(master, username, passwd, port) - output = yield uc.send(op, bb_username, bb_password, ids, info) - if output: - print output - - defer.returnValue(0) |