aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands')
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/__init__.py0
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/base.py618
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bk.py116
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bzr.py193
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/cvs.py134
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/darcs.py101
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/fs.py244
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/git.py218
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/hg.py285
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/mtn.py202
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/p4.py221
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/registry.py48
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/repo.py225
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/shell.py58
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/svn.py210
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/transfer.py435
-rw-r--r--lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/utils.py100
17 files changed, 0 insertions, 3408 deletions
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/__init__.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/__init__.py
+++ /dev/null
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/base.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/base.py
deleted file mode 100644
index b18d199c..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/base.py
+++ /dev/null
@@ -1,618 +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 base64 import b64encode
-import sys
-import shutil
-
-from zope.interface import implements
-from twisted.internet import reactor, threads, defer
-from twisted.python import log, failure, runtime
-
-from buildslave.interfaces import ISlaveCommand
-from buildslave import runprocess
-from buildslave.exceptions import AbandonChain
-from buildslave.commands import utils
-from buildslave import util
-
-# this used to be a CVS $-style "Revision" auto-updated keyword, but since I
-# moved to Darcs as the primary repository, this is updated manually each
-# time this file is changed. The last cvs_ver that was here was 1.51 .
-command_version = "2.15"
-
-# version history:
-# >=1.17: commands are interruptable
-# >=1.28: Arch understands 'revision', added Bazaar
-# >=1.33: Source classes understand 'retry'
-# >=1.39: Source classes correctly handle changes in branch (except Git)
-# Darcs accepts 'revision' (now all do but Git) (well, and P4Sync)
-# Arch/Baz should accept 'build-config'
-# >=1.51: (release 0.7.3)
-# >= 2.1: SlaveShellCommand now accepts 'initial_stdin', 'keep_stdin_open',
-# and 'logfiles'. It now sends 'log' messages in addition to
-# stdout/stdin/header/rc. It acquired writeStdin/closeStdin methods,
-# but these are not remotely callable yet.
-# (not externally visible: ShellCommandPP has writeStdin/closeStdin.
-# ShellCommand accepts new arguments (logfiles=, initialStdin=,
-# keepStdinOpen=) and no longer accepts stdin=)
-# (release 0.7.4)
-# >= 2.2: added monotone, uploadFile, and downloadFile (release 0.7.5)
-# >= 2.3: added bzr (release 0.7.6)
-# >= 2.4: Git understands 'revision' and branches
-# >= 2.5: workaround added for remote 'hg clone --rev REV' when hg<0.9.2
-# >= 2.6: added uploadDirectory
-# >= 2.7: added usePTY option to SlaveShellCommand
-# >= 2.8: added username and password args to SVN class
-# >= 2.9: add depth arg to SVN class
-# >= 2.10: CVS can handle 'extra_options' and 'export_options'
-# >= 2.11: Arch, Bazaar, and Monotone removed
-# >= 2.12: SlaveShellCommand no longer accepts 'keep_stdin_open'
-# >= 2.13: SlaveFileUploadCommand supports option 'keepstamp'
-# >= 2.14: RemoveDirectory can delete multiple directories
-# >= 2.15: 'interruptSignal' option is added to SlaveShellCommand
-
-class Command:
- implements(ISlaveCommand)
-
- """This class defines one command that can be invoked by the build master.
- The command is executed on the slave side, and always sends back a
- completion message when it finishes. It may also send intermediate status
- as it runs (by calling builder.sendStatus). Some commands can be
- interrupted (either by the build master or a local timeout), in which
- case the step is expected to complete normally with a status message that
- indicates an error occurred.
-
- These commands are used by BuildSteps on the master side. Each kind of
- BuildStep uses a single Command. The slave must implement all the
- Commands required by the set of BuildSteps used for any given build:
- this is checked at startup time.
-
- All Commands are constructed with the same signature:
- c = CommandClass(builder, stepid, args)
- where 'builder' is the parent SlaveBuilder object, and 'args' is a
- dict that is interpreted per-command.
-
- The setup(args) method is available for setup, and is run from __init__.
-
- The Command is started with start(). This method must be implemented in a
- subclass, and it should return a Deferred. When your step is done, you
- should fire the Deferred (the results are not used). If the command is
- interrupted, it should fire the Deferred anyway.
-
- While the command runs. it may send status messages back to the
- buildmaster by calling self.sendStatus(statusdict). The statusdict is
- interpreted by the master-side BuildStep however it likes.
-
- A separate completion message is sent when the deferred fires, which
- indicates that the Command has finished, but does not carry any status
- data. If the Command needs to return an exit code of some sort, that
- should be sent as a regular status message before the deferred is fired .
- Once builder.commandComplete has been run, no more status messages may be
- sent.
-
- If interrupt() is called, the Command should attempt to shut down as
- quickly as possible. Child processes should be killed, new ones should
- not be started. The Command should send some kind of error status update,
- then complete as usual by firing the Deferred.
-
- .interrupted should be set by interrupt(), and can be tested to avoid
- sending multiple error status messages.
-
- If .running is False, the bot is shutting down (or has otherwise lost the
- connection to the master), and should not send any status messages. This
- is checked in Command.sendStatus .
-
- """
-
- # builder methods:
- # sendStatus(dict) (zero or more)
- # commandComplete() or commandInterrupted() (one, at end)
-
- debug = False
- interrupted = False
- running = False # set by Builder, cleared on shutdown or when the
- # Deferred fires
-
- _reactor = reactor
-
- def __init__(self, builder, stepId, args):
- self.builder = builder
- self.stepId = stepId # just for logging
- self.args = args
- self.startTime = None
- self.setup(args)
-
- def setup(self, args):
- """Override this in a subclass to extract items from the args dict."""
- pass
-
- def doStart(self):
- self.running = True
- self.startTime = util.now(self._reactor)
- d = defer.maybeDeferred(self.start)
- def commandComplete(res):
- self.sendStatus({"elapsed": util.now(self._reactor) - self.startTime})
- self.running = False
- return res
- d.addBoth(commandComplete)
- return d
-
- def start(self):
- """Start the command. This method should return a Deferred that will
- fire when the command has completed. The Deferred's argument will be
- ignored.
-
- This method should be overridden by subclasses."""
- raise NotImplementedError, "You must implement this in a subclass"
-
- def sendStatus(self, status):
- """Send a status update to the master."""
- if self.debug:
- log.msg("sendStatus", status)
- if not self.running:
- log.msg("would sendStatus but not .running")
- return
- self.builder.sendUpdate(status)
-
- def doInterrupt(self):
- self.running = False
- self.interrupt()
-
- def interrupt(self):
- """Override this in a subclass to allow commands to be interrupted.
- May be called multiple times, test and set self.interrupted=True if
- this matters."""
- pass
-
- # utility methods, mostly used by SlaveShellCommand and the like
-
- def _abandonOnFailure(self, rc):
- if type(rc) is not int:
- log.msg("weird, _abandonOnFailure was given rc=%s (%s)" % \
- (rc, type(rc)))
- assert isinstance(rc, int)
- if rc != 0:
- raise AbandonChain(rc)
- return rc
-
- def _sendRC(self, res):
- self.sendStatus({'rc': 0})
-
- def _checkAbandoned(self, why):
- log.msg("_checkAbandoned", why)
- why.trap(AbandonChain)
- log.msg(" abandoning chain", why.value)
- self.sendStatus({'rc': why.value.args[0]})
- return None
-
-class SourceBaseCommand(Command):
- """Abstract base class for Version Control System operations (checkout
- and update). This class extracts the following arguments from the
- dictionary received from the master:
-
- - ['workdir']: (required) the subdirectory where the buildable sources
- should be placed
-
- - ['mode']: one of update/copy/clobber/export, defaults to 'update'
-
- - ['revision']: (required) If not None, this is an int or string which indicates
- which sources (along a time-like axis) should be used.
- It is the thing you provide as the CVS -r or -D
- argument.
-
- - ['patch']: If not None, this is a tuple of (striplevel, patch)
- which contains a patch that should be applied after the
- checkout has occurred. Once applied, the tree is no
- longer eligible for use with mode='update', and it only
- makes sense to use this in conjunction with a
- ['revision'] argument. striplevel is an int, and patch
- is a string in standard unified diff format. The patch
- will be applied with 'patch -p%d <PATCH', with
- STRIPLEVEL substituted as %d. The command will fail if
- the patch process fails (rejected hunks).
-
- - ['timeout']: seconds of silence tolerated before we kill off the
- command
-
- - ['maxTime']: seconds before we kill off the command
-
- - ['retry']: If not None, this is a tuple of (delay, repeats)
- which means that any failed VC updates should be
- reattempted, up to REPEATS times, after a delay of
- DELAY seconds. This is intended to deal with slaves
- that experience transient network failures.
- """
-
- sourcedata = ""
-
- def setup(self, args):
- # if we need to parse the output, use this environment. Otherwise
- # command output will be in whatever the buildslave's native language
- # has been set to.
- self.env = os.environ.copy()
- self.env['LC_MESSAGES'] = "C"
- self.checkoutdir = args['srcdir']
- self.workdir = args['workdir']
- self.mode = args.get('mode', "update")
- self.revision = args.get('revision')
- self.patch = args.get('patch')
- self.timeout = args.get('timeout', 120)
- self.maxTime = args.get('maxTime', None)
- self.retry = args.get('retry')
- self.logEnviron = args.get('logEnviron',True)
- self._commandPaths = {}
- # VC-specific subclasses should override this to extract more args.
- # Make sure to upcall!
-
- def getCommand(self, name):
- """Wrapper around utils.getCommand that will output a resonable
- error message and raise AbandonChain if the command cannot be
- found"""
- if name not in self._commandPaths:
- try:
- self._commandPaths[name] = utils.getCommand(name)
- except RuntimeError:
- self.sendStatus({'stderr' : "could not find '%s'\n" % name})
- self.sendStatus({'stderr' : "PATH is '%s'\n" % os.environ.get('PATH', '')})
- raise AbandonChain(-1)
- return self._commandPaths[name]
-
- def start(self):
- self.sendStatus({'header': "starting " + self.header + "\n"})
- self.command = None
-
- # self.srcdir is where the VC system should put the sources
- if self.mode == "copy":
- self.srcdir = "source" # hardwired directory name, sorry
- else:
- self.srcdir = self.workdir
-
- self.sourcedatafile = os.path.join(self.builder.basedir,
- ".buildbot-sourcedata-" + b64encode(self.srcdir))
-
- # upgrade older versions to the new sourcedata location
- old_sd_path = os.path.join(self.builder.basedir, self.srcdir, ".buildbot-sourcedata")
- if os.path.exists(old_sd_path) and not os.path.exists(self.sourcedatafile):
- os.rename(old_sd_path, self.sourcedatafile)
-
- # also upgrade versions that didn't include the encoded version of the
- # source directory
- old_sd_path = os.path.join(self.builder.basedir, ".buildbot-sourcedata")
- if os.path.exists(old_sd_path) and not os.path.exists(self.sourcedatafile):
- os.rename(old_sd_path, self.sourcedatafile)
-
- d = defer.succeed(None)
- self.maybeClobber(d)
- if not (self.sourcedirIsUpdateable() and self.sourcedataMatches()):
- # the directory cannot be updated, so we have to clobber it.
- # Perhaps the master just changed modes from 'export' to
- # 'update'.
- d.addCallback(self.doClobber, self.srcdir)
-
- d.addCallback(self.doVC)
-
- if self.mode == "copy":
- d.addCallback(self.doCopy)
- if self.mode == "movecopy":
- d.addCallback(self.doCopy)
- if self.patch:
- d.addCallback(self.doPatch)
- d.addCallbacks(self._sendRC, self._checkAbandoned)
- return d
-
- def maybeClobber(self, d):
- # do we need to clobber anything?
- if self.mode in ("copy", "clobber", "export"):
- d.addCallback(self.doClobber, self.workdir)
-
- def interrupt(self):
- self.interrupted = True
- if self.command:
- self.command.kill("command interrupted")
-
- def doVC(self, res):
- if self.interrupted:
- raise AbandonChain(1)
- if self.sourcedirIsUpdateable() and self.sourcedataMatches():
- d = self.doVCUpdate()
- d.addBoth(self.maybeDoVCFallback)
- else:
- d = self.doVCFull()
- d.addBoth(self.maybeDoVCRetry)
- d.addCallback(self._abandonOnFailure)
- d.addCallback(self._handleGotRevision)
- d.addCallback(self.writeSourcedata)
- return d
-
- def sourcedataMatches(self):
- try:
- olddata = self.readSourcedata()
- if olddata != self.sourcedata:
- return False
- except IOError:
- return False
- return True
-
- def sourcedirIsPatched(self):
- return os.path.exists(os.path.join(self.builder.basedir,
- self.workdir,
- ".buildbot-patched"))
-
- def _handleGotRevision(self, res):
- d = defer.maybeDeferred(self.parseGotRevision)
- d.addCallback(lambda got_revision:
- self.sendStatus({'got_revision': got_revision}))
- return d
-
- def parseGotRevision(self):
- """Override this in a subclass. It should return a string that
- represents which revision was actually checked out, or a Deferred
- that will fire with such a string. If, in a future build, you were to
- pass this 'got_revision' string in as the 'revision' component of a
- SourceStamp, you should wind up with the same source code as this
- checkout just obtained.
-
- It is probably most useful to scan self.command.stdout for a string
- of some sort. Be sure to set keepStdout=True on the VC command that
- you run, so that you'll have something available to look at.
-
- If this information is unavailable, just return None."""
-
- return None
-
- def readSourcedata(self):
- """
- Read the sourcedata file and return its contents
-
- @returns: source data
- @raises: IOError if the file does not exist
- """
- return open(self.sourcedatafile, "r").read()
-
- def writeSourcedata(self, res):
- open(self.sourcedatafile, "w").write(self.sourcedata)
- return res
-
- def sourcedirIsUpdateable(self):
- """Returns True if the tree can be updated."""
- raise NotImplementedError("this must be implemented in a subclass")
-
- def doVCUpdate(self):
- """Returns a deferred with the steps to update a checkout."""
- raise NotImplementedError("this must be implemented in a subclass")
-
- def doVCFull(self):
- """Returns a deferred with the steps to do a fresh checkout."""
- raise NotImplementedError("this must be implemented in a subclass")
-
- def maybeDoVCFallback(self, rc):
- if type(rc) is int and rc == 0:
- return rc
- if self.interrupted:
- raise AbandonChain(1)
-
- # allow AssertionErrors to fall through, for benefit of the tests; for
- # all other errors, carry on to try the fallback
- if isinstance(rc, failure.Failure) and rc.check(AssertionError):
- return rc
-
- # Let VCS subclasses have an opportunity to handle
- # unrecoverable errors without having to clobber the repo
- self.maybeNotDoVCFallback(rc)
- msg = "update failed, clobbering and trying again"
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
- d = self.doClobber(None, self.srcdir)
- d.addCallback(self.doVCFallback2)
- return d
-
- def doVCFallback2(self, res):
- msg = "now retrying VC operation"
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
- d = self.doVCFull()
- d.addBoth(self.maybeDoVCRetry)
- d.addCallback(self._abandonOnFailure)
- return d
-
- def maybeNotDoVCFallback(self, rc):
- """Override this in a subclass if you want to detect unrecoverable
- checkout errors where clobbering the repo wouldn't help, and stop
- the current VC chain before it clobbers the repo for future builds.
-
- Use 'raise AbandonChain' to pass up a halt if you do detect such."""
- pass
-
- def maybeDoVCRetry(self, res):
- """We get here somewhere after a VC chain has finished. res could
- be::
-
- - 0: the operation was successful
- - nonzero: the operation failed. retry if possible
- - AbandonChain: the operation failed, someone else noticed. retry.
- - Failure: some other exception, re-raise
- """
-
- if isinstance(res, failure.Failure):
- if self.interrupted:
- return res # don't re-try interrupted builds
- res.trap(AbandonChain)
- else:
- if type(res) is int and res == 0:
- return res
- if self.interrupted:
- raise AbandonChain(1)
- # if we get here, we should retry, if possible
- if self.retry:
- delay, repeats = self.retry
- if repeats >= 0:
- self.retry = (delay, repeats-1)
- msg = ("update failed, trying %d more times after %d seconds"
- % (repeats, delay))
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
- d = defer.Deferred()
- # we are going to do a full checkout, so a clobber is
- # required first
- self.doClobber(d, self.workdir)
- if self.srcdir:
- self.doClobber(d, self.srcdir)
- d.addCallback(lambda res: self.doVCFull())
- d.addBoth(self.maybeDoVCRetry)
- self._reactor.callLater(delay, d.callback, None)
- return d
- return res
-
- def doClobber(self, dummy, dirname, chmodDone=False):
- d = os.path.join(self.builder.basedir, dirname)
- if runtime.platformType != "posix":
- d = threads.deferToThread(utils.rmdirRecursive, d)
- def cb(_):
- return 0 # rc=0
- def eb(f):
- self.sendStatus({'header' : 'exception from rmdirRecursive\n' + f.getTraceback()})
- return -1 # rc=-1
- d.addCallbacks(cb, eb)
- return d
- command = ["rm", "-rf", d]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=0, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
-
- self.command = c
- # sendRC=0 means the rm command will send stdout/stderr to the
- # master, but not the rc=0 when it finishes. That job is left to
- # _sendRC
- d = c.start()
- # The rm -rf may fail if there is a left-over subdir with chmod 000
- # permissions. So if we get a failure, we attempt to chmod suitable
- # permissions and re-try the rm -rf.
- if chmodDone:
- d.addCallback(self._abandonOnFailure)
- else:
- d.addCallback(lambda rc: self.doClobberTryChmodIfFail(rc, dirname))
- return d
-
- def doClobberTryChmodIfFail(self, rc, dirname):
- assert isinstance(rc, int)
- if rc == 0:
- return defer.succeed(0)
- # Attempt a recursive chmod and re-try the rm -rf after.
-
- command = ["chmod", "-Rf", "u+rwx", os.path.join(self.builder.basedir, dirname)]
- if sys.platform.startswith('freebsd'):
- # Work around a broken 'chmod -R' on FreeBSD (it tries to recurse into a
- # directory for which it doesn't have permission, before changing that
- # permission) by running 'find' instead
- command = ["find", os.path.join(self.builder.basedir, dirname),
- '-exec', 'chmod', 'u+rwx', '{}', ';' ]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=0, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
-
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- d.addCallback(lambda dummy: self.doClobber(dummy, dirname, True))
- return d
-
- def doCopy(self, res):
- # now copy tree to workdir
- fromdir = os.path.join(self.builder.basedir, self.srcdir)
- todir = os.path.join(self.builder.basedir, self.workdir)
- if runtime.platformType != "posix":
- d = threads.deferToThread(shutil.copytree, fromdir, todir)
- def cb(_):
- return 0 # rc=0
- def eb(f):
- self.sendStatus({'header' : 'exception from copytree\n' + f.getTraceback()})
- return -1 # rc=-1
- d.addCallbacks(cb, eb)
- return d
-
- if not os.path.exists(os.path.dirname(todir)):
- os.makedirs(os.path.dirname(todir))
- if os.path.exists(todir):
- # I don't think this happens, but just in case..
- log.msg("cp target '%s' already exists -- cp will not do what you think!" % todir)
-
- command = ['cp', '-R', '-P', '-p', fromdir, todir]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=False, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- return d
-
- def doPatch(self, res):
- patchlevel = self.patch[0]
- diff = self.patch[1]
- root = None
- if len(self.patch) >= 3:
- root = self.patch[2]
- command = [
- utils.getCommand("patch"),
- '-p%d' % patchlevel,
- '--remove-empty-files',
- '--force',
- '--forward',
- '-i', '.buildbot-diff',
- ]
- dir = os.path.join(self.builder.basedir, self.workdir)
- # Mark the directory so we don't try to update it later, or at least try
- # to revert first.
- open(os.path.join(dir, ".buildbot-patched"), "w").write("patched\n")
-
- # write the diff to a file, for reading later
- open(os.path.join(dir, ".buildbot-diff"), "w").write(diff)
-
- # Update 'dir' with the 'root' option. Make sure it is a subdirectory
- # of dir.
- if (root and
- os.path.abspath(os.path.join(dir, root)
- ).startswith(os.path.abspath(dir))):
- dir = os.path.join(dir, root)
-
- # now apply the patch
- c = runprocess.RunProcess(self.builder, command, dir,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- d = c.start()
-
- # clean up the temp file
- def cleanup(x):
- try:
- os.unlink(os.path.join(dir, ".buildbot-diff"))
- except:
- pass
- return x
- d.addBoth(cleanup)
-
- d.addCallback(self._abandonOnFailure)
- return d
-
- def setFileContents(self, filename, contents):
- """Put the given C{contents} in C{filename}; this is a bit more
- succinct than opening, writing, and closing, and has the advantage of
- being patchable in tests. Note that the enclosing directory is
- not automatically created, nor is this an "atomic" overwrite."""
- f = open(filename, 'w')
- f.write(contents)
- f.close()
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bk.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bk.py
deleted file mode 100644
index a8e5002e..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bk.py
+++ /dev/null
@@ -1,116 +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 import log
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-
-
-class BK(SourceBaseCommand):
- """BitKeeper-specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['bkurl'] (required): the BK repository string
- """
-
- header = "bk operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.bkurl = args['bkurl']
- self.sourcedata = '"%s\n"' % self.bkurl
-
- self.bk_args = []
- if args.get('extra_args', None) is not None:
- self.bk_args.extend(args['extra_args'])
-
- def sourcedirIsUpdateable(self):
- if os.path.exists(os.path.join(self.builder.basedir,
- self.srcdir, ".buildbot-patched")):
- return False
- return os.path.isfile(os.path.join(self.builder.basedir,
- self.srcdir, "BK/parent"))
-
- def doVCUpdate(self):
- bk = self.getCommand('bk')
- # XXX revision is never used!! - bug #1715
- # revision = self.args['revision'] or 'HEAD'
- # update: possible for mode in ('copy', 'update')
- d = os.path.join(self.builder.basedir, self.srcdir)
-
- # Revision is ignored since the BK free client doesn't support it.
- command = [bk, 'pull']
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- keepStdout=True, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
-
- def doVCFull(self):
- bk = self.getCommand('bk')
-
- revision_arg = ''
- if self.args['revision']:
- revision_arg = "-r%s" % self.args['revision']
-
- d = self.builder.basedir
-
- command = [bk, 'clone', revision_arg] + self.bk_args + \
- [self.bkurl, self.srcdir]
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- logEnviron=self.logEnviron, usePTY=False)
- self.command = c
- return c.start()
-
- def getBKVersionCommand(self):
- """
- Get the (shell) command used to determine BK revision number
- of checked-out code
-
- return: list of strings, passable as the command argument to RunProcess
- """
- bk = self.getCommand('bk')
- return [bk, "changes", "-r+", "-d:REV:"]
-
- def parseGotRevision(self):
- c = runprocess.RunProcess(self.builder,
- self.getBKVersionCommand(),
- os.path.join(self.builder.basedir, self.srcdir),
- environ=self.env, timeout=self.timeout,
- sendStdout=False, sendStderr=False, sendRC=False,
- keepStdout=True, logEnviron=self.logEnviron,
- usePTY=False)
- d = c.start()
- def _parse(res):
- r_raw = c.stdout.strip()
- try:
- r = r_raw
- except:
- msg = ("BK.parseGotRevision unable to parse output: (%s)" % r_raw)
- log.msg(msg)
- self.sendStatus({'header': msg + "\n"})
- raise ValueError(msg)
- return r
- d.addCallback(_parse)
- return d
-
-
-
-
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bzr.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bzr.py
deleted file mode 100644
index d64265e7..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/bzr.py
+++ /dev/null
@@ -1,193 +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 import log
-from twisted.internet import defer
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-
-
-class Bzr(SourceBaseCommand):
- """bzr-specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['repourl'] (required): the Bzr repository string
- ['forceSharedRepo']: force this to a shared repo
- """
-
- header = "bzr operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.repourl = args['repourl']
- self.sourcedata = "%s\n" % self.repourl
- self.revision = self.args.get('revision')
- self.forceSharedRepo = args.get('forceSharedRepo')
-
- def sourcedirIsUpdateable(self):
- # checking out a specific revision requires a full 'bzr checkout'
- return (not self.revision and
- not self.sourcedirIsPatched() and
- os.path.isdir(os.path.join(self.builder.basedir,
- self.srcdir, ".bzr")))
-
- def start(self):
- def cont(res):
- # Continue with start() method in superclass.
- return SourceBaseCommand.start(self)
-
- if self.forceSharedRepo:
- d = self.doForceSharedRepo();
- d.addCallback(cont)
- return d
- else:
- return cont(None)
-
- def doVCUpdate(self):
- bzr = self.getCommand('bzr')
- assert not self.revision
- # update: possible for mode in ('copy', 'update')
- srcdir = os.path.join(self.builder.basedir, self.srcdir)
- command = [bzr, 'update']
- c = runprocess.RunProcess(self.builder, command, srcdir,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
-
- def doVCFull(self):
- bzr = self.getCommand('bzr')
-
- # checkout or export
- d = self.builder.basedir
- if self.mode == "export":
- # exporting in bzr requires a separate directory
- return self.doVCExport()
- # originally I added --lightweight here, but then 'bzr revno' is
- # wrong. The revno reported in 'bzr version-info' is correct,
- # however. Maybe this is a bzr bug?
- #
- # In addition, you cannot perform a 'bzr update' on a repo pulled
- # from an HTTP repository that used 'bzr checkout --lightweight'. You
- # get a "ERROR: Cannot lock: transport is read only" when you try.
- #
- # So I won't bother using --lightweight for now.
-
- command = [bzr, 'checkout']
- if self.revision:
- command.append('--revision')
- command.append(str(self.revision))
- command.append(self.repourl)
- command.append(self.srcdir)
-
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- d = c.start()
- return d
-
- def doVCExport(self):
- bzr = self.getCommand('bzr')
- tmpdir = os.path.join(self.builder.basedir, "export-temp")
- srcdir = os.path.join(self.builder.basedir, self.srcdir)
- command = [bzr, 'checkout', '--lightweight']
- if self.revision:
- command.append('--revision')
- command.append(str(self.revision))
- command.append(self.repourl)
- command.append(tmpdir)
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- d = c.start()
- def _export(res):
- command = [bzr, 'export', srcdir]
- c = runprocess.RunProcess(self.builder, command, tmpdir,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
- d.addCallback(_export)
- return d
-
- def doForceSharedRepo(self):
- bzr = self.getCommand('bzr')
-
- # Don't send stderr. When there is no shared repo, this might confuse
- # users, as they will see a bzr error message. But having no shared
- # repo is not an error, just an indication that we need to make one.
- c = runprocess.RunProcess(self.builder, [bzr, 'info', '.'],
- self.builder.basedir,
- sendStderr=False, sendRC=False,
- logEnviron=self.logEnviron,usePTY=False)
- d = c.start()
- def afterCheckSharedRepo(res):
- if type(res) is int and res != 0:
- log.msg("No shared repo found, creating it")
- # bzr info fails, try to create shared repo.
- c = runprocess.RunProcess(self.builder, [bzr, 'init-repo', '.'],
- self.builder.basedir,
- sendRC=False, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
- else:
- return defer.succeed(res)
- d.addCallback(afterCheckSharedRepo)
- return d
-
- def get_revision_number(self, out):
- # it feels like 'bzr revno' sometimes gives different results than
- # the 'revno:' line from 'bzr version-info', and the one from
- # version-info is more likely to be correct.
- for line in out.split("\n"):
- colon = line.find(":")
- if colon != -1:
- key, value = line[:colon], line[colon+2:]
- if key == "revno":
- return int(value)
- raise ValueError("unable to find revno: in bzr output: '%s'" % out)
-
- def parseGotRevision(self):
- bzr = self.getCommand('bzr')
- command = [bzr, "version-info"]
- c = runprocess.RunProcess(self.builder, command,
- os.path.join(self.builder.basedir, self.srcdir),
- environ=self.env,
- sendStdout=False, sendStderr=False, sendRC=False,
- keepStdout=True, logEnviron=self.logEnviron,
- usePTY=False)
- d = c.start()
- def _parse(res):
- try:
- return self.get_revision_number(c.stdout)
- except ValueError:
- msg =("Bzr.parseGotRevision unable to parse output "
- "of bzr version-info: '%s'" % c.stdout.strip())
- log.msg(msg)
- self.sendStatus({'header': msg + "\n"})
- return None
- d.addCallback(_parse)
- return d
-
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/cvs.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/cvs.py
deleted file mode 100644
index b5939061..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/cvs.py
+++ /dev/null
@@ -1,134 +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
-import time
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-
-class CVS(SourceBaseCommand):
- """CVS-specific VC operation. In addition to the arguments handled by
- SourceBaseCommand, this command reads the following keys:
-
- ['cvsroot'] (required): the CVSROOT repository string
- ['cvsmodule'] (required): the module to be retrieved
- ['branch']: a '-r' tag or branch name to use for the checkout/update
- ['login']: a string for use as a password to 'cvs login'
- ['global_options']: a list of strings to use before the CVS verb
- ['checkout_options']: a list of strings to use after checkout,
- but before revision and branch specifiers
- ['checkout_options']: a list of strings to use after export,
- but before revision and branch specifiers
- ['extra_options']: a list of strings to use after export and checkout,
- but before revision and branch specifiers
- """
-
- header = "cvs operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.cvsroot = args['cvsroot']
- self.cvsmodule = args['cvsmodule']
- self.global_options = args.get('global_options', [])
- self.checkout_options = args.get('checkout_options', [])
- self.export_options = args.get('export_options', [])
- self.extra_options = args.get('extra_options', [])
- self.branch = args.get('branch')
- self.login = args.get('login')
- self.sourcedata = "%s\n%s\n%s\n" % (self.cvsroot, self.cvsmodule,
- self.branch)
-
- def sourcedirIsUpdateable(self):
- return (not self.sourcedirIsPatched() and
- os.path.isdir(os.path.join(self.builder.basedir,
- self.srcdir, "CVS")))
-
- def start(self):
- cvs = self.getCommand("cvs")
- if self.login is not None:
- # need to do a 'cvs login' command first
- d = self.builder.basedir
- command = ([cvs, '-d', self.cvsroot] + self.global_options
- + ['login'])
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime,
- initialStdin=self.login+"\n",
- logEnviron=self.logEnviron,usePTY=False)
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- d.addCallback(self._didLogin)
- return d
- else:
- return self._didLogin(None)
-
- def _didLogin(self, res):
- # now we really start
- return SourceBaseCommand.start(self)
-
- def doVCUpdate(self):
- cvs = self.getCommand("cvs")
- d = os.path.join(self.builder.basedir, self.srcdir)
- command = [cvs, '-z3'] + self.global_options + ['update', '-dP']
- if self.branch:
- command += ['-r', self.branch]
- if self.revision:
- command += ['-D', self.revision]
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
-
- def doVCFull(self):
- cvs = self.getCommand("cvs")
- d = self.builder.basedir
- if self.mode == "export":
- verb = "export"
- else:
- verb = "checkout"
- command = ([cvs, '-d', self.cvsroot, '-z3'] +
- self.global_options +
- [verb, '-d', self.srcdir])
-
- if verb == "checkout":
- command += self.checkout_options
- else:
- command += self.export_options
- command += self.extra_options
-
- if self.branch:
- command += ['-r', self.branch]
- if self.revision:
- command += ['-D', self.revision]
- command += [self.cvsmodule]
-
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
-
- def parseGotRevision(self):
- # CVS does not have any kind of revision stamp to speak of. We return
- # the current timestamp as a best-effort guess, but this depends upon
- # the local system having a clock that is
- # reasonably-well-synchronized with the repository.
- return time.strftime("%Y-%m-%d %H:%M:%S +0000", time.gmtime())
-
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/darcs.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/darcs.py
deleted file mode 100644
index be1a9c6d..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/darcs.py
+++ /dev/null
@@ -1,101 +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 buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-
-
-class Darcs(SourceBaseCommand):
- """Darcs-specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['repourl'] (required): the Darcs repository string
- """
-
- header = "darcs operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.repourl = args['repourl']
- self.sourcedata = "%s\n" % self.repourl
- self.revision = self.args.get('revision')
-
- def sourcedirIsUpdateable(self):
- # checking out a specific revision requires a full 'darcs get'
- return (not self.revision and
- not self.sourcedirIsPatched() and
- os.path.isdir(os.path.join(self.builder.basedir,
- self.srcdir, "_darcs")))
-
- def doVCUpdate(self):
- darcs = self.getCommand('darcs')
- assert not self.revision
- # update: possible for mode in ('copy', 'update')
- d = os.path.join(self.builder.basedir, self.srcdir)
- command = [darcs, 'pull', '--all', '--verbose']
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- return c.start()
-
- def doVCFull(self):
- darcs = self.getCommand('darcs')
- # checkout or export
- d = self.builder.basedir
- command = [darcs, 'get', '--verbose', '--lazy',
- '--repo-name', self.srcdir]
- if self.revision:
- # write the context to a file
- n = os.path.join(self.builder.basedir, ".darcs-context")
- f = open(n, "wb")
- f.write(self.revision)
- f.close()
- # tell Darcs to use that context
- command.append('--context')
- command.append(n)
- command.append(self.repourl)
-
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- d = c.start()
- if self.revision:
- d.addCallback(self.removeContextFile, n)
- return d
-
- def removeContextFile(self, res, n):
- os.unlink(n)
- return res
-
- def parseGotRevision(self):
- darcs = self.getCommand('darcs')
-
- # we use 'darcs context' to find out what we wound up with
- command = [darcs, "changes", "--context"]
- c = runprocess.RunProcess(self.builder, command,
- os.path.join(self.builder.basedir, self.srcdir),
- environ=self.env, timeout=self.timeout,
- sendStdout=False, sendStderr=False, sendRC=False,
- keepStdout=True, logEnviron=self.logEnviron,
- usePTY=False)
- d = c.start()
- d.addCallback(lambda res: c.stdout)
- return d
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/fs.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/fs.py
deleted file mode 100644
index ae720cdf..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/fs.py
+++ /dev/null
@@ -1,244 +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
-import sys
-import shutil
-
-from twisted.internet import threads, defer
-from twisted.python import runtime, log
-
-from buildslave import runprocess
-from buildslave.commands import base, utils
-
-class MakeDirectory(base.Command):
-
- header = "mkdir"
-
- def start(self):
- args = self.args
- # args['dir'] is relative to Builder directory, and is required.
- assert args['dir'] is not None
- dirname = os.path.join(self.builder.basedir, args['dir'])
-
- try:
- if not os.path.isdir(dirname):
- os.makedirs(dirname)
- self.sendStatus({'rc': 0})
- except:
- self.sendStatus({'rc': 1})
-
-class RemoveDirectory(base.Command):
-
- header = "rmdir"
-
- def setup(self,args):
- self.logEnviron = args.get('logEnviron',True)
-
-
- @defer.deferredGenerator
- def start(self):
- args = self.args
- # args['dir'] is relative to Builder directory, and is required.
- assert args['dir'] is not None
- dirnames = args['dir']
-
- self.timeout = args.get('timeout', 120)
- self.maxTime = args.get('maxTime', None)
- self.rc = 0
- if type(dirnames) is list:
- assert len(dirnames) != 0
- for dirname in dirnames:
- wfd = defer.waitForDeferred(self.removeSingleDir(dirname))
- yield wfd
- res = wfd.getResult()
- # Even if single removal of single file/dir consider it as
- # failure of whole command, but continue removing other files
- # Send 'rc' to master to handle failure cases
- if res != 0:
- self.rc = res
- else:
- wfd = defer.waitForDeferred(self.removeSingleDir(dirnames))
- yield wfd
- self.rc = wfd.getResult()
-
- self.sendStatus({'rc': self.rc})
-
- def removeSingleDir(self, dirname):
- self.dir = os.path.join(self.builder.basedir, dirname)
- if runtime.platformType != "posix":
- d = threads.deferToThread(utils.rmdirRecursive, self.dir)
- def cb(_):
- return 0 # rc=0
- def eb(f):
- self.sendStatus({'header' : 'exception from rmdirRecursive\n' + f.getTraceback()})
- return -1 # rc=-1
- d.addCallbacks(cb, eb)
- else:
- d = self._clobber(None)
-
- return d
-
- def _clobber(self, dummy, chmodDone = False):
- command = ["rm", "-rf", self.dir]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=0, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
-
- self.command = c
- # sendRC=0 means the rm command will send stdout/stderr to the
- # master, but not the rc=0 when it finishes. That job is left to
- # _sendRC
- d = c.start()
- # The rm -rf may fail if there is a left-over subdir with chmod 000
- # permissions. So if we get a failure, we attempt to chmod suitable
- # permissions and re-try the rm -rf.
- if not chmodDone:
- d.addCallback(self._tryChmod)
- return d
-
- def _tryChmod(self, rc):
- assert isinstance(rc, int)
- if rc == 0:
- return defer.succeed(0)
- # Attempt a recursive chmod and re-try the rm -rf after.
-
- command = ["chmod", "-Rf", "u+rwx", os.path.join(self.builder.basedir, self.dir)]
- if sys.platform.startswith('freebsd'):
- # Work around a broken 'chmod -R' on FreeBSD (it tries to recurse into a
- # directory for which it doesn't have permission, before changing that
- # permission) by running 'find' instead
- command = ["find", os.path.join(self.builder.basedir, self.dir),
- '-exec', 'chmod', 'u+rwx', '{}', ';' ]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=0, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
-
- self.command = c
- d = c.start()
- d.addCallback(lambda dummy: self._clobber(dummy, True))
- return d
-
-class CopyDirectory(base.Command):
-
- header = "cpdir"
-
- def setup(self,args):
- self.logEnviron = args.get('logEnviron',True)
-
- def start(self):
- args = self.args
- # args['todir'] is relative to Builder directory, and is required.
- # args['fromdir'] is relative to Builder directory, and is required.
- assert args['todir'] is not None
- assert args['fromdir'] is not None
-
- fromdir = os.path.join(self.builder.basedir, args['fromdir'])
- todir = os.path.join(self.builder.basedir, args['todir'])
-
- self.timeout = args.get('timeout', 1200)
- self.maxTime = args.get('maxTime', None)
-
- if runtime.platformType != "posix":
- d = threads.deferToThread(shutil.copytree, fromdir, todir)
- def cb(_):
- return 0 # rc=0
- def eb(f):
- self.sendStatus({'header' : 'exception from copytree\n' + f.getTraceback()})
- return -1 # rc=-1
- d.addCallbacks(cb, eb)
- @d.addCallback
- def send_rc(rc):
- self.sendStatus({'rc' : rc})
- else:
- if not os.path.exists(os.path.dirname(todir)):
- os.makedirs(os.path.dirname(todir))
- if os.path.exists(todir):
- # I don't think this happens, but just in case..
- log.msg("cp target '%s' already exists -- cp will not do what you think!" % todir)
-
- command = ['cp', '-R', '-P', '-p', fromdir, todir]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=False, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
-
- d.addCallbacks(self._sendRC, self._checkAbandoned)
- return d
-
-class Move(base.Command):
-
- header = "mv"
-
- def setup(self,args):
- self.logEnviron = args.get('logEnviron',True)
-
- def start(self):
- args = self.args
- # args['todir'] is relative to Builder directory, and is required.
- # args['fromdir'] is relative to Builder directory, and is required.
- assert args['todir'] is not None
- assert args['fromdir'] is not None
-
- fromdir = os.path.join(self.builder.basedir, args['fromdir'])
- todir = args['todir']
-
- self.timeout = args.get('timeout', 1200)
- self.maxTime = args.get('maxTime', None)
-
- if runtime.platformType != "posix":
- d = threads.deferToThread(shutil.move, fromdir, todir)
- def cb(_):
- return 0 # rc=0
- def eb(f):
- self.sendStatus({'header' : 'exception from move\n' + f.getTraceback()})
- return -1 # rc=-1
- d.addCallbacks(cb, eb)
- @d.addCallback
- def send_rc(rc):
- self.sendStatus({'rc' : rc})
- else:
- if not os.path.exists(os.path.dirname(todir)):
- os.makedirs(os.path.dirname(todir))
-
- command = ['mv', fromdir, todir]
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=False, timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
-
- d.addCallbacks(self._sendRC, self._checkAbandoned)
- return d
-
-class StatFile(base.Command):
-
- header = "stat"
-
- def start(self):
- args = self.args
- # args['dir'] is relative to Builder directory, and is required.
- assert args['file'] is not None
- filename = os.path.join(self.builder.basedir, args['file'])
-
- try:
- stat = os.stat(filename)
- self.sendStatus({'stat': tuple(stat)})
- self.sendStatus({'rc': 0})
- except:
- self.sendStatus({'rc': 1})
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/git.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/git.py
deleted file mode 100644
index abef42ba..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/git.py
+++ /dev/null
@@ -1,218 +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.internet import defer
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-from buildslave.commands.base import AbandonChain
-
-
-class Git(SourceBaseCommand):
- """Git specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['repourl'] (required): the upstream GIT repository string
- ['branch'] (optional): which version (i.e. branch or tag)
- to retrieve. Default: "master".
- ['submodules'] (optional): whether to initialize and update
- submodules. Default: False.
- ['ignore_ignores'] (optional): ignore ignores when purging changes
- (default true)
- ['reference'] (optional): use this reference repository
- to fetch objects.
- ['gerrit_branch'] (optional): which virtual branch to retrieve.
- ['progress'] (optional): have git output progress markers,
- avoiding timeouts for long fetches;
- requires Git 1.7.2 or later.
- ['shallow'] (optional): if true, use shallow clones that do not
- also fetch history
- """
-
- header = "git operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.repourl = args['repourl']
- self.branch = args.get('branch')
- if not self.branch:
- self.branch = "master"
- self.sourcedata = "%s %s\n" % (self.repourl, self.branch)
- self.submodules = args.get('submodules')
- self.ignore_ignores = args.get('ignore_ignores', True)
- self.reference = args.get('reference', None)
- self.gerrit_branch = args.get('gerrit_branch', None)
-
- def _fullSrcdir(self):
- return os.path.join(self.builder.basedir, self.srcdir)
-
- def sourcedirIsUpdateable(self):
- return os.path.isdir(os.path.join(self._fullSrcdir(), ".git"))
-
- def _dovccmd(self, command, cb=None, stopOnFail=True, **kwargs):
- git = self.getCommand("git")
- c = runprocess.RunProcess(self.builder, [git] + command, self._fullSrcdir(),
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False, **kwargs)
- self.command = c
- d = c.start()
- if cb:
- if stopOnFail:
- d.addCallback(self._abandonOnFailure)
- d.addCallback(cb)
- return d
-
- def sourcedataMatches(self):
- # If the repourl matches the sourcedata file, then we can say that the
- # sourcedata matches. We can ignore branch changes, since Git can work
- # with many branches fetched, and we deal with it properly in
- # doVCUpdate. So, basically, as long as the file exists, consider it
- # to match
- try:
- self.readSourcedata()
- except IOError:
- return False
- return True
-
- def _cleanSubmodules(self, res):
- command = ['submodule', 'foreach', 'git', 'clean', '-f', '-d']
- if self.ignore_ignores:
- command.append('-x')
- return self._dovccmd(command)
-
- def _updateSubmodules(self, res):
- return self._dovccmd(['submodule', 'update'], self._cleanSubmodules)
-
- def _initSubmodules(self, res):
- if self.submodules:
- return self._dovccmd(['submodule', 'init'], self._updateSubmodules)
- else:
- return defer.succeed(0)
-
- def _didHeadCheckout(self, res):
- # Rename branch, so that the repo will have the expected branch name
- # For further information about this, see the commit message
- command = ['branch', '-M', self.branch]
- return self._dovccmd(command, self._initSubmodules, False)
-
- def _didFetch(self, res):
- if self.revision:
- head = self.revision
- else:
- head = 'FETCH_HEAD'
-
- # That is not sufficient. git will leave unversioned files and empty
- # directories. Clean them up manually in _didReset.
- command = ['reset', '--hard', head]
- return self._dovccmd(command, self._didHeadCheckout)
-
- def maybeNotDoVCFallback(self, res):
- # If we were unable to find the branch/SHA on the remote,
- # clobbering the repo won't help any, so just abort the chain
- if hasattr(self.command, 'stderr'):
- if "Couldn't find remote ref" in self.command.stderr:
- raise AbandonChain(-1)
-
- # Update first runs "git clean", removing local changes,
- # if the branch to be checked out has changed. This, combined
- # with the later "git reset" equates clobbering the repo,
- # but it's much more efficient.
- def doVCUpdate(self):
- try:
- # Check to see if our branch has changed
- diffbranch = self.sourcedata != self.readSourcedata()
- except IOError:
- diffbranch = False
- if diffbranch or self.sourcedirIsPatched():
- command = ['clean', '-f', '-d']
- if self.ignore_ignores:
- command.append('-x')
- return self._dovccmd(command, self._didClean)
- return self._didClean(None)
-
- def _doFetch(self, dummy, branch):
- # The plus will make sure the repo is moved to the branch's
- # head even if it is not a simple "fast-forward"
- command = ['fetch', '-t', self.repourl, '+%s' % branch]
- # If the 'progress' option is set, tell git fetch to output
- # progress information to the log. This can solve issues with
- # long fetches killed due to lack of output, but only works
- # with Git 1.7.2 or later.
- if self.args.get('progress'):
- command.append('--progress')
- self.sendStatus({"header": "fetching branch %s from %s\n"
- % (branch, self.repourl)})
- return self._dovccmd(command, self._didFetch, keepStderr=True)
-
- def _didClean(self, dummy):
- branch = self.gerrit_branch or self.branch
-
- # After a clean, try to use the given revision if we have one.
- if self.revision:
- # We know what revision we want. See if we have it.
- d = self._dovccmd(['reset', '--hard', self.revision],
- self._initSubmodules)
- # If we are unable to reset to the specified version, we
- # must do a fetch first and retry.
- d.addErrback(self._doFetch, branch)
- return d
- else:
- # No known revision, go grab the latest.
- return self._doFetch(None, branch)
-
- def _didInit(self, res):
- # If we have a reference repository specified, we need to also set that
- # up after the 'git init'.
- if self.reference:
- git_alts_path = os.path.join(self._fullSrcdir(), '.git', 'objects', 'info', 'alternates')
- git_alts_content = os.path.join(self.reference, 'objects')
- self.setFileContents(git_alts_path, git_alts_content)
- return self.doVCUpdate()
-
- def doVCFull(self):
- git = self.getCommand("git")
-
- # If they didn't ask for a specific revision, we can get away with a
- # shallow clone.
- if not self.args.get('revision') and self.args.get('shallow'):
- cmd = [git, 'clone', '--depth', '1']
- # If we have a reference repository, pass it to the clone command
- if self.reference:
- cmd.extend(['--reference', self.reference])
- cmd.extend([self.repourl, self._fullSrcdir()])
- c = runprocess.RunProcess(self.builder, cmd, self.builder.basedir,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- cmdexec = c.start()
- cmdexec.addCallback(self._didInit)
- return cmdexec
- else:
- os.makedirs(self._fullSrcdir())
- return self._dovccmd(['init'], self._didInit)
-
- def parseGotRevision(self):
- command = ['rev-parse', 'HEAD']
- def _parse(res):
- hash = self.command.stdout.strip()
- if len(hash) != 40:
- return None
- return hash
- return self._dovccmd(command, _parse, keepStdout=True)
-
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/hg.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/hg.py
deleted file mode 100644
index a7182c98..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/hg.py
+++ /dev/null
@@ -1,285 +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, re
-
-from twisted.python import log, runtime
-
-from buildslave.commands.base import SourceBaseCommand, AbandonChain
-from buildslave import runprocess
-from buildslave.util import remove_userpassword
-
-
-class Mercurial(SourceBaseCommand):
- """Mercurial specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['repourl'] (required): the Mercurial repository string
- ['clobberOnBranchChange']: Document me. See ticket #462.
- """
-
- header = "mercurial operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.repourl = args['repourl']
- self.clobberOnBranchChange = args.get('clobberOnBranchChange', True)
- self.sourcedata = "%s\n" % self.repourl
- self.branchType = args.get('branchType', 'dirname')
- self.stdout = ""
- self.stderr = ""
- self.clobbercount = 0 # n times we've clobbered
-
- def sourcedirIsUpdateable(self):
- return os.path.isdir(os.path.join(self.builder.basedir,
- self.srcdir, ".hg"))
-
- def doVCUpdate(self):
- hg = self.getCommand('hg')
- d = os.path.join(self.builder.basedir, self.srcdir)
- command = [hg, 'pull', '--verbose', self.repourl]
- c = runprocess.RunProcess(self.builder, command, d,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, keepStdout=True,
- logEnviron=self.logEnviron, usePTY=False)
- self.command = c
- d = c.start()
- d.addCallback(self._handleEmptyUpdate)
- d.addCallback(self._update)
- return d
-
- def _handleEmptyUpdate(self, res):
- if type(res) is int and res == 1:
- if self.command.stdout.find("no changes found") != -1:
- # 'hg pull', when it doesn't have anything to do, exits with
- # rc=1, and there appears to be no way to shut this off. It
- # emits a distinctive message to stdout, though. So catch
- # this and pretend that it completed successfully.
- return 0
- return res
-
- def doVCFull(self):
- hg = self.getCommand('hg')
- command = [hg, 'clone', '--verbose', '--noupdate']
-
- # if got revision, clobbering and in dirname, only clone to specific revision
- # (otherwise, do full clone to re-use .hg dir for subsequent builds)
- if self.args.get('revision') and self.mode == 'clobber' and self.branchType == 'dirname':
- command.extend(['--rev', self.args.get('revision')])
- command.extend([self.repourl, self.srcdir])
-
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, logEnviron=self.logEnviron,
- usePTY=False)
- self.command = c
- cmd1 = c.start()
- cmd1.addCallback(self._update)
- return cmd1
-
- def _clobber(self, dummy, dirname):
- self.clobbercount += 1
-
- if self.clobbercount > 3:
- raise Exception, "Too many clobber attempts. Aborting step"
-
- def _vcfull(res):
- return self.doVCFull()
-
- c = self.doClobber(dummy, dirname)
- c.addCallback(_vcfull)
-
- return c
-
- def _purge(self, dummy, dirname):
- hg = self.getCommand('hg')
- d = os.path.join(self.builder.basedir, self.srcdir)
- purge = [hg, 'purge', '--all']
- purgeCmd = runprocess.RunProcess(self.builder, purge, d,
- keepStdout=True, keepStderr=True,
- logEnviron=self.logEnviron, usePTY=False)
-
- def _clobber(res):
- if res != 0:
- # purge failed, we need to switch to a classic clobber
- msg = "'hg purge' failed: %s\n%s. Clobbering." % (purgeCmd.stdout, purgeCmd.stderr)
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
-
- return self._clobber(dummy, dirname)
-
- # Purge was a success, then we need to update
- return res
-
- p = purgeCmd.start()
- p.addCallback(_clobber)
- return p
-
- def _update(self, res):
- hg = self.getCommand('hg')
- if res != 0:
- return res
-
- # compare current branch to update
- self.update_branch = self.args.get('branch', 'default')
-
- d = os.path.join(self.builder.basedir, self.srcdir)
- parentscmd = [hg, 'identify', '--num', '--branch']
- cmd = runprocess.RunProcess(self.builder, parentscmd, d,
- sendRC=False, timeout=self.timeout, keepStdout=True,
- keepStderr=True, logEnviron=self.logEnviron,
- usePTY=False)
-
- self.clobber = None
-
- def _parseIdentify(res):
- if res != 0:
- msg = "'hg identify' failed."
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
- raise AbandonChain(-1)
-
- log.msg('Output: %s' % cmd.stdout)
-
- match = re.search(r'^(.+) (.+)$', cmd.stdout)
- if not match:
- msg = "'hg identify' did not give a recognizable output"
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
- raise AbandonChain(-1)
-
- rev = match.group(1)
- current_branch = match.group(2)
-
- if rev == '-1':
- msg = "Fresh hg repo, don't worry about in-repo branch name"
- log.msg(msg)
-
- elif self.sourcedirIsPatched():
- self.clobber = self._purge
-
- elif self.update_branch != current_branch:
- msg = "Working dir is on in-repo branch '%s' and build needs '%s'." % (current_branch, self.update_branch)
- if self.clobberOnBranchChange:
- msg += ' Cloberring.'
- else:
- msg += ' Updating.'
-
- self.sendStatus({'header': msg + "\n"})
- log.msg(msg)
-
- # Clobbers only if clobberOnBranchChange is set
- if self.clobberOnBranchChange:
- self.clobber = self._purge
-
- else:
- msg = "Working dir on same in-repo branch as build (%s)." % (current_branch)
- log.msg(msg)
-
- return 0
-
- def _checkRepoURL(res):
- hg = self.getCommand('hg')
- parentscmd = [hg, 'paths', 'default']
- cmd2 = runprocess.RunProcess(self.builder, parentscmd, d,
- keepStdout=True, keepStderr=True, usePTY=False,
- timeout=self.timeout, sendRC=False,
- logEnviron=self.logEnviron)
-
- def _parseRepoURL(res):
- if res == 1:
- if "not found!" == cmd2.stderr.strip():
- msg = "hg default path not set. Not checking repo url for clobber test"
- log.msg(msg)
- return 0
- else:
- msg = "'hg paths default' failed."
- log.msg(msg)
- return 1
-
- oldurl = cmd2.stdout.strip()
-
- log.msg("Repo cloned from: '%s'" % oldurl)
-
- if runtime.platformType == 'win32':
- oldurl = oldurl.lower().replace('\\', '/')
- repourl = self.repourl.lower().replace('\\', '/')
- else:
- repourl = self.repourl
-
- if repourl.startswith('file://'):
- repourl = repourl.split('file://')[1]
- if oldurl.startswith('file://'):
- oldurl = oldurl.split('file://')[1]
-
- oldurl = remove_userpassword(oldurl)
- repourl = remove_userpassword(repourl)
-
- if oldurl.rstrip('/') != repourl.rstrip('/'):
- self.clobber = self._clobber
- msg = "RepoURL changed from '%s' in wc to '%s' in update. Clobbering" % (oldurl, repourl)
- log.msg(msg)
-
- return 0
-
- c = cmd2.start()
- c.addCallback(_parseRepoURL)
- return c
-
- def _maybeClobber(res):
- if self.clobber:
- msg = "Clobber flag set. Doing clobbering"
- log.msg(msg)
-
- return self.clobber(None, self.srcdir)
-
- return 0
-
- c = cmd.start()
- c.addCallback(_parseIdentify)
- c.addCallback(_checkRepoURL)
- c.addCallback(_maybeClobber)
- c.addCallback(self._update2)
- return c
-
- def _update2(self, res):
- hg = self.getCommand('hg')
- updatecmd=[hg, 'update', '--clean', '--repository', self.srcdir]
- if self.args.get('revision'):
- updatecmd.extend(['--rev', self.args['revision']])
- else:
- updatecmd.extend(['--rev', self.args.get('branch', 'default')])
- self.command = runprocess.RunProcess(self.builder, updatecmd,
- self.builder.basedir, sendRC=False,
- timeout=self.timeout, maxTime=self.maxTime,
- logEnviron=self.logEnviron, usePTY=False)
- return self.command.start()
-
- def parseGotRevision(self):
- hg = self.getCommand('hg')
- # we use 'hg parents' to find out what we wound up with
- command = [hg, "parents", "--template", "{node}\\n"] # get full rev id
- c = runprocess.RunProcess(self.builder, command,
- os.path.join(self.builder.basedir, self.srcdir),
- environ=self.env, timeout=self.timeout,
- sendRC=False,
- keepStdout=True, usePTY=False,
- logEnviron=self.logEnviron)
- d = c.start()
- def _parse(res):
- m = re.search(r'^(\w+)', c.stdout)
- return m.group(1)
- d.addCallback(_parse)
- return d
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/mtn.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/mtn.py
deleted file mode 100644
index 99cae5d4..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/mtn.py
+++ /dev/null
@@ -1,202 +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 import log
-from twisted.internet import defer
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-#from buildslave.util import remove_userpassword
-
-class MonotoneError(Exception):
- """Error class for this module."""
-
-
-class Monotone(SourceBaseCommand):
- """Monotone specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['repourl'] (required): the Monotone repository string
- ['branch'] (required): which branch to retrieve.
-
- ['revision'] (optional): which revision (revision selector)
- to retrieve.
- ['progress'] (optional): have mtn output progress markers,
- avoiding timeouts for long fetches;
- """
-
- header = "monotone operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
-
- self.repourl = args['repourl']
- self.branch = args['branch']
-
- self.revision = args.get('revision', None)
- self.progress = args.get('progress', False)
-
- self._pull_timeout = args.get("timeout")
-
- self.sourcedata = "%s?%s" % (self.repourl, self.branch)
- self.stdout = ""
- self.stderr = ""
- self.database = os.path.join(self.builder.basedir, 'db.mtn')
- self.mtn = self.getCommand("mtn")
-
- def start(self):
- def cont(res):
- # Continue with start() method in superclass.
- return SourceBaseCommand.start(self)
-
- d = self._checkDb();
- d.addCallback(cont)
- return d
-
- def doVCUpdate(self):
- return self._dovccmd(self._update, True)
-
- def doVCFull(self):
- return self._dovccmd(self._checkout, True)
-
- def _fullSrcdir(self):
- return os.path.join(self.builder.basedir, self.srcdir)
-
- def sourcedirIsUpdateable(self):
- return os.path.isdir(os.path.join(self._fullSrcdir(), "_MTN"))
-
- def _dovccmd(self, fn, dopull, cb=None, **kwargs):
- if dopull:
- command = [self.mtn, 'pull', self.sourcedata,
- '--db', self.database]
- if self.progress:
- command.extend(['--ticker=dot'])
- else:
- command.extend(['--ticker=none'])
- c = runprocess.RunProcess(self.builder, command,
- self.builder.basedir,
- environ=self.env, sendRC=False,
- timeout=self.timeout,
- maxTime=self.maxTime,
- keepStdout=True, usePTY=False,
- logEnviron=self.logEnviron)
- self.sendStatus({"header": "pulling %s from %s\n"
- % (self.branch, self.sourcedata)})
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- d.addCallback(fn)
- else:
- d = fn(None)
- if cb:
- d.addCallback(cb)
- return d
-
- def _update(self, res):
- command = [self.mtn, 'update',
- '--db', self.database]
- if self.revision:
- command.extend(['--revision', self.revision])
- else:
- command.extend(["-r", "h:" + self.branch])
- command.extend(["-b", self.branch])
- c = runprocess.RunProcess(self.builder, command, self._fullSrcdir(),
- environ=self.env, sendRC=False,
- timeout=self.timeout, maxTime=self.maxTime,
- keepStdout=True, usePTY=False,
- logEnviron=self.logEnviron)
- d = c.start()
- return d
-
- def _checkout(self, res):
- command = [self.mtn, 'checkout', self._fullSrcdir(),
- '--db', self.database]
- if self.revision:
- command.extend(['--revision', self.revision])
- command.extend(['--branch', self.branch])
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- environ=self.env, sendRC=False,
- timeout=self.timeout, maxTime=self.maxTime,
- keepStdout=True, usePTY=False,
- logEnviron=self.logEnviron)
- d = c.start()
- return d
-
- def _checkDb(self):
- # Don't send stderr. When there is no database, this might confuse
- # users, as they will see a mtn error message. But having no database
- # repo is not an error, just an indication that we need to pull one.
- c = runprocess.RunProcess(self.builder, [self.mtn, 'db', 'info',
- '--db', self.database],
- self.builder.basedir,
- environ=self.env, sendRC=False,
- keepStdout=True, sendStderr=False,
- usePTY=False, logEnviron=self.logEnviron)
- d = c.start()
- def afterCheckRepo(res, cdi):
- if type(res) is int and res != 0:
- log.msg("No database found, creating it")
- # mtn info fails, try to create shared repo.
- # We'll be doing an initial pull, so up the timeout to
- # 3 hours to make sure it will have time to complete.
- self._pull_timeout = max(self._pull_timeout, 3 * 60 * 60)
- c = runprocess.RunProcess(self.builder, [self.mtn, 'db', 'init',
- '--db', self.database],
- self.builder.basedir,
- environ=self.env,
- sendRC=False, usePTY=False,
- logEnviron=self.logEnviron)
- self.command = c
- return c.start()
- elif cdi.stdout.find("(migration needed)") > 0:
- log.msg("Older format database found, migrating it")
- # mtn info fails, try to create shared repo.
- c = runprocess.RunProcess(self.builder, [self.mtn,
- 'db', 'migrate',
- '--db', self.database],
- self.builder.basedir,
- environ=self.env,
- sendRC=False, usePTY=False,
- logEnviron=self.logEnviron)
- self.command = c
- return c.start()
- elif cdi.stdout.find("(too new, cannot use)") > 0:
- raise MonotoneError, "The database is of a newer format than mtn can handle... Abort!"
- else:
- return defer.succeed(res)
- d.addCallback(afterCheckRepo, c)
- return d
-
- def parseGotRevision(self):
- def _parse(res):
- hash = self.command.stdout.strip()
- if len(hash) != 40:
- return None
- return hash
- return self._dovccmd(self._get_base_revision, False, _parse)
-
- def _get_base_revision(self, res):
- c = runprocess.RunProcess(self.builder,
- [self.mtn, 'automate', 'select', 'w:'],
- self._fullSrcdir(),
- sendRC=False,
- timeout=self.timeout, maxTime=self.maxTime,
- keepStdout=True, usePTY=False,
- logEnviron=self.logEnviron)
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- return d
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/p4.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/p4.py
deleted file mode 100644
index 7aa17d8e..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/p4.py
+++ /dev/null
@@ -1,221 +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, re
-
-from twisted.python import log
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-from buildslave.util import Obfuscated
-
-
-class P4Base(SourceBaseCommand):
- """Base class for P4 source-updaters
-
- ['p4port'] (required): host:port for server to access
- ['p4user'] (optional): user to use for access
- ['p4passwd'] (optional): passwd to try for the user
- ['p4client'] (optional): client spec to use
- """
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.p4port = args['p4port']
- self.p4client = args['p4client']
- self.p4user = args['p4user']
- self.p4passwd = args['p4passwd']
-
- def parseGotRevision(self):
- # Executes a p4 command that will give us the latest changelist number
- # of any file under the current (or default) client:
- command = ['p4']
- if self.p4port:
- command.extend(['-p', self.p4port])
- if self.p4user:
- command.extend(['-u', self.p4user])
- if self.p4passwd:
- command.extend(['-P', Obfuscated(self.p4passwd, "XXXXXXXX")])
- if self.p4client:
- command.extend(['-c', self.p4client])
- # add '-s submitted' for bug #626
- command.extend(['changes', '-s', 'submitted', '-m', '1', '#have'])
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- environ=self.env, timeout=self.timeout,
- maxTime=self.maxTime, sendStdout=True,
- sendRC=False, keepStdout=True,
- usePTY=False, logEnviron=self.logEnviron)
- self.command = c
- d = c.start()
-
- def _parse(res):
- # 'p4 -c clien-name change -m 1 "#have"' will produce an output like:
- # "Change 28147 on 2008/04/07 by p4user@hostname..."
- # The number after "Change" is the one we want.
- m = re.match('Change\s+(\d+)\s+', c.stdout)
- if m:
- return m.group(1)
- return None
- d.addCallback(_parse)
- return d
-
-
-class P4(P4Base):
- """A P4 source-updater.
-
- ['p4port'] (required): host:port for server to access
- ['p4user'] (required): user to use for access
- ['p4passwd'] (required): passwd to try for the user
- ['p4client'] (required): client spec to use
- ['p4extra_views'] (required): additional client views to use
- ['p4base'] (required): view into the Perforce depot without branch name or trailing "..."
- ['p4line_end'] (optional): value of the LineEnd client specification property
- """
-
- header = "p4"
-
- def setup(self, args):
- P4Base.setup(self, args)
- self.p4base = args['p4base']
- self.p4extra_views = args['p4extra_views']
- self.p4line_end = args.get('p4line_end', None)
- self.p4mode = args['mode']
- self.p4branch = args['branch']
-
- # sourcedata is encoded to utf-8, since otherwise unicode strings
- # appear with a leading "u", causing comparisons to fail. In
- # retrospect, comparing str() output is not the best technique!
- def enc(x):
- if isinstance(x, unicode):
- return x.encode('utf8')
- return x
- self.sourcedata = str([
- enc(x) for x in [
- # Perforce server.
- self.p4port,
-
- # Client spec.
- self.p4client,
-
- # Depot side of view spec.
- self.p4base,
- self.p4branch,
- self.p4extra_views,
- self.p4line_end,
-
- # Local side of view spec (srcdir is made from these).
- self.builder.basedir,
- self.mode,
- self.workdir
- ]])
-
-
- def sourcedirIsUpdateable(self):
- # We assume our client spec is still around.
- # We just say we aren't updateable if the dir doesn't exist so we
- # don't get ENOENT checking the sourcedata.
- return (not self.sourcedirIsPatched() and
- os.path.isdir(os.path.join(self.builder.basedir,
- self.srcdir)))
-
- def doVCUpdate(self):
- return self._doP4Sync(force=False)
-
- def _doP4Sync(self, force):
- command = ['p4']
-
- if self.p4port:
- command.extend(['-p', self.p4port])
- if self.p4user:
- command.extend(['-u', self.p4user])
- if self.p4passwd:
- command.extend(['-P', Obfuscated(self.p4passwd, "XXXXXXXX")])
- if self.p4client:
- command.extend(['-c', self.p4client])
- command.extend(['sync'])
- if force:
- command.extend(['-f'])
- if self.revision:
- command.extend(['@' + str(self.revision)])
- env = {}
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- environ=env, sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, usePTY=False,
- logEnviron=self.logEnviron)
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- return d
-
-
- def doVCFull(self):
- env = {}
- command = ['p4']
- client_spec = ''
- client_spec += "Client: %s\n\n" % self.p4client
- client_spec += "Owner: %s\n\n" % self.p4user
- client_spec += "Description:\n\tCreated by %s\n\n" % self.p4user
- client_spec += "Root:\t%s\n\n" % self.builder.basedir
- client_spec += "Options:\tallwrite rmdir\n\n"
- if self.p4line_end:
- client_spec += "LineEnd:\t%s\n\n" % self.p4line_end
- else:
- client_spec += "LineEnd:\tlocal\n\n"
-
- # Setup a view
- client_spec += "View:\n\t%s" % (self.p4base)
- if self.p4branch:
- client_spec += "%s/" % (self.p4branch)
- client_spec += "... //%s/%s/...\n" % (self.p4client, self.srcdir)
- if self.p4extra_views:
- for k, v in self.p4extra_views:
- client_spec += "\t%s/... //%s/%s%s/...\n" % (k, self.p4client,
- self.srcdir, v)
- if self.p4port:
- command.extend(['-p', self.p4port])
- if self.p4user:
- command.extend(['-u', self.p4user])
- if self.p4passwd:
- command.extend(['-P', Obfuscated(self.p4passwd, "XXXXXXXX")])
- command.extend(['client', '-i'])
- log.msg(client_spec)
-
- # from bdbaddog in github comments:
- # I'm pretty sure the issue is that perforce client specs can't be
- # non-ascii (unless you configure at initial config to be unicode). I
- # floated a question to perforce mailing list. From reading the
- # internationalization notes..
- # http://www.perforce.com/perforce/doc.092/user/i18nnotes.txt
- # I'm 90% sure that's the case.
- # (http://github.com/bdbaddog/buildbot/commit/8420149b2b804efcf5f81a13e18aa62da0424d21)
-
- # Clean client spec to plain ascii
- client_spec=client_spec.encode('ascii','ignore')
-
- c = runprocess.RunProcess(self.builder, command, self.builder.basedir,
- environ=env, sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, initialStdin=client_spec,
- usePTY=False, logEnviron=self.logEnviron)
- self.command = c
- d = c.start()
- d.addCallback(self._abandonOnFailure)
- d.addCallback(lambda _: self._doP4Sync(force=True))
- return d
-
- def parseGotRevision(self):
- if self.revision:
- return str(self.revision)
- else:
- return P4Base.parseGotRevision(self)
-
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/registry.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/registry.py
deleted file mode 100644
index 22dc3ee6..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/registry.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.python import reflect
-
-commandRegistry = {
- # command name : fully qualified factory name (callable)
- "shell" : "buildslave.commands.shell.SlaveShellCommand",
- "uploadFile" : "buildslave.commands.transfer.SlaveFileUploadCommand",
- "uploadDirectory" : "buildslave.commands.transfer.SlaveDirectoryUploadCommand",
- "downloadFile" : "buildslave.commands.transfer.SlaveFileDownloadCommand",
- "downloadDirectory" : "buildslave.commands.transfer.SlaveDirectoryDownloadCommand",
- "svn" : "buildslave.commands.svn.SVN",
- "bk" : "buildslave.commands.bk.BK",
- "cvs" : "buildslave.commands.cvs.CVS",
- "darcs" : "buildslave.commands.darcs.Darcs",
- "git" : "buildslave.commands.git.Git",
- "repo" : "buildslave.commands.repo.Repo",
- "bzr" : "buildslave.commands.bzr.Bzr",
- "hg" : "buildslave.commands.hg.Mercurial",
- "p4" : "buildslave.commands.p4.P4",
- "mtn" : "buildslave.commands.mtn.Monotone",
- "mkdir" : "buildslave.commands.fs.MakeDirectory",
- "rmdir" : "buildslave.commands.fs.RemoveDirectory",
- "cpdir" : "buildslave.commands.fs.CopyDirectory",
- "mv" : "buildslave.commands.fs.Move",
- "stat" : "buildslave.commands.fs.StatFile",
-}
-
-def getFactory(command):
- factory_name = commandRegistry[command]
- factory = reflect.namedObject(factory_name)
- return factory
-
-def getAllCommandNames():
- return commandRegistry.keys()
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/repo.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/repo.py
deleted file mode 100644
index b445fa33..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/repo.py
+++ /dev/null
@@ -1,225 +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
-import re
-import textwrap
-
-from twisted.internet import defer
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-from buildslave.commands.base import AbandonChain
-
-
-class Repo(SourceBaseCommand):
- """Repo specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['manifest_url'] (required): The manifests repo repository.
- ['manifest_branch'] (optional): Which manifest repo version (i.e. branch or tag)
- to retrieve. Default: "master".
- ['manifest_file'] (optional): Which manifest file to use. Default: "default.xml".
- ['manifest_override_url'] (optional): Which manifest file to use as an overide. Default: None.
- This is usually set by forced build to build over a known working base
- ['tarball'] (optional): The tarball base to accelerate the fetch.
- ['repo_downloads'] (optional): Repo downloads to do. Computer from GerritChangeSource
- and forced build properties.
- ['jobs'] (optional): number of connections to run in parallel
- repo tool will use while syncing
- """
-
- header = "repo operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.manifest_url = args.get('manifest_url')
- self.manifest_branch = args.get('manifest_branch')
- self.manifest_file = args.get('manifest_file')
- self.manifest_override_url = args.get('manifest_override_url')
- self.tarball = args.get('tarball')
- self.repo_downloads = args.get('repo_downloads')
- # we're using string instead of an array here, because it will be transferred back
- # to the master as string anyway and using eval() could have security implications.
- self.repo_downloaded = ""
- self.jobs = args.get('jobs')
-
- self.sourcedata = "%s %s" % (self.manifest_url, self.manifest_file)
- self.re_change = re.compile(".* refs/changes/\d\d/(\d+)/(\d+) -> FETCH_HEAD$")
- self.re_head = re.compile("^HEAD is now at ([0-9a-f]+)...")
-
- def _fullSrcdir(self):
- return os.path.join(self.builder.basedir, self.srcdir)
-
- def sourcedirIsUpdateable(self):
- print os.path.join(self._fullSrcdir(), ".repo")
- print os.path.isdir(os.path.join(self._fullSrcdir(), ".repo"))
- return os.path.isdir(os.path.join(self._fullSrcdir(), ".repo"))
-
- def _repoCmd(self, command, cb=None, abandonOnFailure=True, **kwargs):
- repo = self.getCommand("repo")
- c = runprocess.RunProcess(self.builder, [repo] + command, self._fullSrcdir(),
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, usePTY=False,
- logEnviron=self.logEnviron, **kwargs)
- self.command = c
- d = c.start()
- if cb:
- if abandonOnFailure:
- d.addCallback(self._abandonOnFailure)
- d.addCallback(cb)
- return d
-
- def _Cmd(self, cmds, callback, abandonOnFailure=True):
- c = runprocess.RunProcess(self.builder, cmds, self._fullSrcdir(),
- sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, usePTY=False,
- logEnviron=self.logEnviron)
- self.command = c
- d = c.start()
- if abandonOnFailure:
- d.addCallback(self._abandonOnFailure)
- d.addCallback(callback)
- return d
-
- def sourcedataMatches(self):
- try:
- olddata = self.readSourcedata()
- return olddata == self.sourcedata
- except IOError:
- return False
-
- def doVCFull(self):
- os.makedirs(self._fullSrcdir())
- if self.tarball and os.path.exists(self.tarball):
- return self._Cmd(['tar', '-xvzf', self.tarball], self._doPreInitCleanUp)
- else:
- return self._doInit(None)
-
- def _doInit(self,res):
- # on fresh init, this file may confuse repo.
- if os.path.exists(os.path.join(self._fullSrcdir(), ".repo/project.list")):
- os.unlink(os.path.join(self._fullSrcdir(), ".repo/project.list"))
- return self._repoCmd(['init', '-u', self.manifest_url, '-b', self.manifest_branch, '-m', self.manifest_file], self._didInit)
-
- def _didInit(self, res):
- return self.doVCUpdate()
-
- def doVCUpdate(self):
- if self.repo_downloads:
- self.sendStatus({'header': "will download:\n" + "repo download "+ "\nrepo download ".join(self.repo_downloads) + "\n"})
- return self._doPreSyncCleanUp(None)
-
- # a simple shell script to gather all cleanup tweaks...
- # doing them one by one just complicate the stuff
- # and messup the stdio log
- def _cleanupCommand(self):
- command = textwrap.dedent("""\
- set -v
- if [ -d .repo/manifests ]
- then
- # repo just refuse to run if manifest is messed up
- # so ensure we are in a known state
- cd .repo/manifests
- git fetch origin
- git reset --hard remotes/origin/%(manifest_branch)s
- git config branch.default.merge %(manifest_branch)s
- cd ..
- ln -sf manifests/%(manifest_file)s manifest.xml
- cd ..
- fi
- repo forall -c rm -f .git/index.lock
- repo forall -c git clean -f -d -x 2>/dev/null
- repo forall -c git reset --hard HEAD 2>/dev/null
- """) % self.__dict__
- return "\n".join([ s.strip() for s in command.splitlines()])
-
- def _doPreInitCleanUp(self, dummy):
- command = self._cleanupCommand()
- return self._Cmd(["bash", "-c", command], self._doInit, abandonOnFailure=False)
-
- def _doPreSyncCleanUp(self, dummy):
- command = self._cleanupCommand()
- return self._Cmd(["bash", "-c", command], self._doManifestOveride, abandonOnFailure=False)
-
- def _doManifestOveride(self, dummy):
- if self.manifest_override_url:
- self.sendStatus({"header": "overriding manifest with %s\n" %(self.manifest_override_url)})
- if os.path.exists(os.path.join(self._fullSrcdir(), self.manifest_override_url)):
- os.system("cd %s; cp -f %s manifest_override.xml"%(self._fullSrcdir(),self.manifest_override_url))
- else:
- command = ["wget", self.manifest_override_url, '-O', 'manifest_override.xml']
- return self._Cmd(command, self._doSync)
- return self._doSync(None)
-
- def _doSync(self, dummy):
- if self.manifest_override_url:
- os.system("cd %s/.repo; ln -sf ../manifest_override.xml manifest.xml"%(self._fullSrcdir()))
- command = ['sync']
- if self.jobs:
- command.append('-j' + str(self.jobs))
- self.sendStatus({"header": "synching manifest %s from branch %s from %s\n"
- % (self.manifest_file, self.manifest_branch, self.manifest_url)})
- return self._repoCmd(command, self._didSync)
-
- def _didSync(self, dummy):
- if self.tarball and not os.path.exists(self.tarball):
- return self._Cmd(['tar', '-cvzf', self.tarball, ".repo"], self._doManifest)
- else:
- return self._doManifest(None)
-
- def _doManifest(self, dummy):
- command = ['manifest', '-r', '-o', 'manifest-original.xml']
- return self._repoCmd(command, self._doDownload, abandonOnFailure=False)
-
-
- def _doDownload(self, dummy):
- if hasattr(self.command, 'stderr') and self.command.stderr:
- if "Automatic cherry-pick failed" in self.command.stderr or "Automatic revert failed" in self.command.stderr:
- command = ['forall','-c' ,'git' ,'diff', 'HEAD']
- self.cherry_pick_failed = True
- return self._repoCmd(command, self._DownloadAbandon, abandonOnFailure = False, keepStderr=True) # call again
-
- lines = self.command.stderr.split('\n')
- if len(lines) > 2:
- match1 = self.re_change.match(lines[1])
- match2 = self.re_head.match(lines[-2])
- if match1 and match2:
- self.repo_downloaded += "%s/%s %s " % (match1.group(1), match1.group(2), match2.group(1))
-
- if self.repo_downloads:
- # download each changeset while the self.download variable is not empty
- download = self.repo_downloads.pop(0)
- command = ['download'] + download.split(' ')
- self.sendStatus({"header": "downloading changeset %s\n"
- % (download)})
- return self._repoCmd(command, self._doDownload, abandonOnFailure = False, keepStderr=True) # call again
-
- if self.repo_downloaded:
- self.sendStatus({"repo_downloaded": self.repo_downloaded[:-1]})
- return defer.succeed(0)
-
- def maybeNotDoVCFallback(self, res):
- # If we were unable to find the branch/SHA on the remote,
- # clobbering the repo won't help any, so just abort the chain
- if hasattr(self.command, 'stderr'):
- if "Couldn't find remote ref" in self.command.stderr:
- raise AbandonChain(-1)
- if hasattr(self, 'cherry_pick_failed') or "Automatic cherry-pick failed" in self.command.stderr:
- raise AbandonChain(-1)
- def _DownloadAbandon(self,dummy):
- self.sendStatus({"header": "abandonned due to merge failure\n"})
- raise AbandonChain(-1)
-
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/shell.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/shell.py
deleted file mode 100644
index be85eb9d..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/shell.py
+++ /dev/null
@@ -1,58 +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 buildslave.commands import base
-from buildslave import runprocess
-
-class SlaveShellCommand(base.Command):
- def start(self):
- args = self.args
- # args['workdir'] is relative to Builder directory, and is required.
- assert args['workdir'] is not None
- workdir = os.path.join(self.builder.basedir, args['workdir'])
-
- c = runprocess.RunProcess(
- self.builder,
- args['command'],
- workdir,
- environ=args.get('env'),
- timeout=args.get('timeout', None),
- maxTime=args.get('maxTime', None),
- sendStdout=args.get('want_stdout', True),
- sendStderr=args.get('want_stderr', True),
- sendRC=True,
- initialStdin=args.get('initial_stdin'),
- logfiles=args.get('logfiles', {}),
- usePTY=args.get('usePTY', "slave-config"),
- logEnviron=args.get('logEnviron', True),
- )
- if args.get('interruptSignal'):
- c.interruptSignal = args['interruptSignal']
- c._reactor = self._reactor
- self.command = c
- d = self.command.start()
- return d
-
- def interrupt(self):
- self.interrupted = True
- self.command.kill("command interrupted")
-
- def writeStdin(self, data):
- self.command.writeStdin(data)
-
- def closeStdin(self):
- self.command.closeStdin()
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/svn.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/svn.py
deleted file mode 100644
index f1c051d7..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/svn.py
+++ /dev/null
@@ -1,210 +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 xml.dom.minidom import parseString
-
-from twisted.python import log
-from twisted.internet import defer
-
-from buildslave.commands.base import SourceBaseCommand
-from buildslave import runprocess
-from buildslave.commands import utils
-from buildslave.util import Obfuscated
-
-class SVN(SourceBaseCommand):
- """Subversion-specific VC operation. In addition to the arguments
- handled by SourceBaseCommand, this command reads the following keys:
-
- ['svnurl'] (required): the SVN repository string
- ['username']: Username passed to the svn command
- ['password']: Password passed to the svn command
- ['keep_on_purge']: Files and directories to keep between updates
- ['ignore_ignores']: Ignore ignores when purging changes
- ['always_purge']: Always purge local changes after each build
- ['depth']: Pass depth argument to subversion 1.5+
- """
-
- header = "svn operation"
-
- def setup(self, args):
- SourceBaseCommand.setup(self, args)
- self.svnurl = args['svnurl']
- self.sourcedata = "%s\n" % self.svnurl
- self.keep_on_purge = args.get('keep_on_purge', [])
- self.keep_on_purge.append(".buildbot-sourcedata")
- self.ignore_ignores = args.get('ignore_ignores', True)
- self.always_purge = args.get('always_purge', False)
-
- self.exported_rev = 'HEAD'
-
- self.svn_args = []
- if args.has_key('username'):
- self.svn_args.extend(["--username", args['username']])
- if args.has_key('password'):
- self.svn_args.extend(["--password", Obfuscated(args['password'], "XXXX")])
- if args.get('extra_args', None) is not None:
- self.svn_args.extend(args['extra_args'])
-
- if args.has_key('depth'):
- self.svn_args.extend(["--depth",args['depth']])
-
- def _dovccmd(self, command, args, rootdir=None, cb=None, **kwargs):
- svn = self.getCommand("svn")
- if rootdir is None:
- rootdir = os.path.join(self.builder.basedir, self.srcdir)
- fullCmd = [svn, command, '--non-interactive', '--no-auth-cache']
- fullCmd.extend(self.svn_args)
- fullCmd.extend(args)
- c = runprocess.RunProcess(self.builder, fullCmd, rootdir,
- environ=self.env, sendRC=False, timeout=self.timeout,
- maxTime=self.maxTime, usePTY=False,
- logEnviron=self.logEnviron, **kwargs)
- self.command = c
- d = c.start()
- if cb:
- d.addCallback(self._abandonOnFailure)
- d.addCallback(cb)
- return d
-
- def sourcedirIsUpdateable(self):
- return os.path.isdir(os.path.join(self.builder.basedir,
- self.srcdir, ".svn"))
-
- def doVCUpdate(self):
- if self.sourcedirIsPatched() or self.always_purge:
- return self._purgeAndUpdate()
- revision = self.args['revision'] or 'HEAD'
- # update: possible for mode in ('copy', 'update')
- return self._dovccmd('update', ['--revision', str(revision)])
-
- def doVCFull(self):
- revision = self.args['revision'] or 'HEAD'
- args = ['--revision', str(revision), "%s@%s" % (self.svnurl, str(revision)), self.srcdir]
-
- if self.mode == 'export':
- if revision == 'HEAD': return self.doSVNExport()
- else: command = 'export'
- else:
- # mode=='clobber', or copy/update on a broken workspace
- command = 'checkout'
- return self._dovccmd(command, args, rootdir=self.builder.basedir)
-
- def doSVNExport(self):
- ''' Since svnversion cannot be used on a svn export, we find the HEAD
- revision from the repository and pass it to the --revision arg'''
-
- def parseInfo(res):
- answer = [i.split(': ') for i in self.command.stdout.splitlines() if i]
- answer = dict(answer)
- self.exported_rev = answer['Revision']
- return self.exported_rev
-
- def exportCmd(res):
- args = ['--revision', str(res), self.svnurl, self.srcdir]
- return self._dovccmd('export', args, rootdir=self.builder.basedir)
-
- svn_info_d = self._dovccmd('info', (self.svnurl,), rootdir=self.builder.basedir, keepStdout=True)
-
- svn_info_d.addCallbacks(parseInfo, self._abandonOnFailure)
- svn_info_d.addCallbacks(exportCmd)
-
- return svn_info_d
-
- def _purgeAndUpdate(self):
- """svn revert has several corner cases that make it unpractical.
-
- Use the Force instead and delete everything that shows up in status."""
- args = ['--xml']
- if self.ignore_ignores:
- args.append('--no-ignore')
- return self._dovccmd('status', args, keepStdout=True, sendStdout=False,
- cb=self._purgeAndUpdate2)
-
- @staticmethod
- def getUnversionedFiles(stdout, keep_on_purge):
- """Delete everything that shown up on status."""
- result_xml = parseString(stdout)
- for entry in result_xml.getElementsByTagName('entry'):
- (wc_status,) = entry.getElementsByTagName('wc-status')
- if wc_status.getAttribute('item') == 'external':
- continue
- if wc_status.getAttribute('item') == 'missing':
- continue
- filename = entry.getAttribute('path')
- if filename in keep_on_purge:
- continue
- yield filename
-
- def _purgeAndUpdate2(self, res):
- for filename in self.getUnversionedFiles(self.command.stdout, self.keep_on_purge):
- filepath = os.path.join(self.builder.basedir, self.workdir,
- filename)
- self.sendStatus({'stdout': "%s\n" % filepath})
- if os.path.isfile(filepath):
- os.chmod(filepath, 0700)
- os.remove(filepath)
- else:
- utils.rmdirRecursive(filepath)
- # Now safe to update.
- revision = self.args['revision'] or 'HEAD'
- return self._dovccmd('update', ['--revision', str(revision)],
- keepStdout=True)
-
- def getSvnVersionCommand(self):
- """
- Get the (shell) command used to determine SVN revision number
- of checked-out code
-
- return: list of strings, passable as the command argument to RunProcess
- """
- # svn checkout operations finish with 'Checked out revision 16657.'
- # svn update operations finish the line 'At revision 16654.'
- # But we don't use those. Instead, run 'svnversion'.
- svnversion_command = utils.getCommand("svnversion")
- # older versions of 'svnversion' (1.1.4) require the WC_PATH
- # argument, newer ones (1.3.1) do not.
- return [svnversion_command, "."]
-
- def parseGotRevision(self):
- if self.mode == 'export':
- ss_rev = self.args['revision']
- got_revision = ss_rev and ss_rev or self.exported_rev
- return defer.succeed(got_revision)
-
- c = runprocess.RunProcess(self.builder,
- self.getSvnVersionCommand(),
- os.path.join(self.builder.basedir, self.srcdir),
- environ=self.env, timeout=self.timeout,
- sendStdout=False, sendStderr=False, sendRC=False,
- keepStdout=True, usePTY=False,
- logEnviron=self.logEnviron)
- d = c.start()
- def _parse(res):
- r_raw = c.stdout.strip()
- # Extract revision from the version "number" string
- r = r_raw.rstrip('MSP')
- r = r.split(':')[-1]
- got_version = None
- try:
- got_version = int(r)
- except ValueError:
- msg =("SVN.parseGotRevision unable to parse output "
- "of svnversion: '%s'" % r_raw)
- log.msg(msg)
- self.sendStatus({'header': msg + "\n"})
- return got_version
- d.addCallback(_parse)
- return d
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/transfer.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/transfer.py
deleted file mode 100644
index e51e8b90..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/transfer.py
+++ /dev/null
@@ -1,435 +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, tarfile, tempfile
-
-from twisted.python import log
-from twisted.internet import defer
-
-from buildslave.commands.base import Command
-
-class TransferCommand(Command):
-
- def finished(self, res):
- if self.debug:
- log.msg('finished: stderr=%r, rc=%r' % (self.stderr, self.rc))
-
- # don't use self.sendStatus here, since we may no longer be running
- # if we have been interrupted
- upd = {'rc': self.rc}
- if self.stderr:
- upd['stderr'] = self.stderr
- self.builder.sendUpdate(upd)
- return res
-
- def interrupt(self):
- if self.debug:
- log.msg('interrupted')
- if self.interrupted:
- return
- self.rc = 1
- self.interrupted = True
- # now we wait for the next trip around the loop. It abandon the file
- # when it sees self.interrupted set.
-
-
-class SlaveFileUploadCommand(TransferCommand):
- """
- Upload a file from slave to build master
- Arguments:
-
- - ['workdir']: base directory to use
- - ['slavesrc']: name of the slave-side file to read from
- - ['writer']: RemoteReference to a transfer._FileWriter object
- - ['maxsize']: max size (in bytes) of file to write
- - ['blocksize']: max size for each data block
- - ['keepstamp']: whether to preserve file modified and accessed times
- """
- debug = False
-
- def setup(self, args):
- self.workdir = args['workdir']
- self.filename = args['slavesrc']
- self.writer = args['writer']
- self.remaining = args['maxsize']
- self.blocksize = args['blocksize']
- self.keepstamp = args.get('keepstamp', False)
- self.stderr = None
- self.rc = 0
-
- def start(self):
- if self.debug:
- log.msg('SlaveFileUploadCommand started')
-
- # Open file
- self.path = os.path.join(self.builder.basedir,
- self.workdir,
- os.path.expanduser(self.filename))
- accessed_modified = None
- try:
- if self.keepstamp:
- accessed_modified = (os.path.getatime(self.path),
- os.path.getmtime(self.path))
-
- self.fp = open(self.path, 'rb')
- if self.debug:
- log.msg("Opened '%s' for upload" % self.path)
- except:
- self.fp = None
- self.stderr = "Cannot open file '%s' for upload" % self.path
- self.rc = 1
- if self.debug:
- log.msg("Cannot open file '%s' for upload" % self.path)
-
- self.sendStatus({'header': "sending %s" % self.path})
-
- d = defer.Deferred()
- self._reactor.callLater(0, self._loop, d)
- def _close_ok(res):
- self.fp = None
- d1 = self.writer.callRemote("close")
- def _utime_ok(res):
- return self.writer.callRemote("utime", accessed_modified)
- if self.keepstamp:
- d1.addCallback(_utime_ok)
- return d1
- def _close_err(f):
- self.rc = 1
- self.fp = None
- # call remote's close(), but keep the existing failure
- d1 = self.writer.callRemote("close")
- def eb(f2):
- log.msg("ignoring error from remote close():")
- log.err(f2)
- d1.addErrback(eb)
- d1.addBoth(lambda _ : f) # always return _loop failure
- return d1
-
- d.addCallbacks(_close_ok, _close_err)
- d.addBoth(self.finished)
- return d
-
- def _loop(self, fire_when_done):
- d = defer.maybeDeferred(self._writeBlock)
- def _done(finished):
- if finished:
- fire_when_done.callback(None)
- else:
- self._loop(fire_when_done)
- def _err(why):
- fire_when_done.errback(why)
- d.addCallbacks(_done, _err)
- return None
-
- def _writeBlock(self):
- """Write a block of data to the remote writer"""
-
- if self.interrupted or self.fp is None:
- if self.debug:
- log.msg('SlaveFileUploadCommand._writeBlock(): end')
- return True
-
- length = self.blocksize
- if self.remaining is not None and length > self.remaining:
- length = self.remaining
-
- if length <= 0:
- if self.stderr is None:
- self.stderr = 'Maximum filesize reached, truncating file \'%s\'' \
- % self.path
- self.rc = 1
- data = ''
- else:
- data = self.fp.read(length)
-
- if self.debug:
- log.msg('SlaveFileUploadCommand._writeBlock(): '+
- 'allowed=%d readlen=%d' % (length, len(data)))
- if len(data) == 0:
- log.msg("EOF: callRemote(close)")
- return True
-
- if self.remaining is not None:
- self.remaining = self.remaining - len(data)
- assert self.remaining >= 0
- d = self.writer.callRemote('write', data)
- d.addCallback(lambda res: False)
- return d
-
-
-class SlaveDirectoryUploadCommand(SlaveFileUploadCommand):
- debug = False
-
- def setup(self, args):
- self.workdir = args['workdir']
- self.dirname = args['slavesrc']
- self.writer = args['writer']
- self.remaining = args['maxsize']
- self.blocksize = args['blocksize']
- self.compress = args['compress']
- self.stderr = None
- self.rc = 0
-
- def start(self):
- if self.debug:
- log.msg('SlaveDirectoryUploadCommand started')
-
- self.path = os.path.join(self.builder.basedir,
- self.workdir,
- os.path.expanduser(self.dirname))
- if self.debug:
- log.msg("path: %r" % self.path)
-
- # Create temporary archive
- fd, self.tarname = tempfile.mkstemp()
- fileobj = os.fdopen(fd, 'w')
- if self.compress == 'bz2':
- mode='w|bz2'
- elif self.compress == 'gz':
- mode='w|gz'
- else:
- mode = 'w'
- archive = tarfile.open(name=self.tarname, mode=mode, fileobj=fileobj)
- archive.add(self.path, '')
- archive.close()
- fileobj.close()
-
- # Transfer it
- self.fp = open(self.tarname, 'rb')
-
- self.sendStatus({'header': "sending %s" % self.path})
-
- d = defer.Deferred()
- self._reactor.callLater(0, self._loop, d)
- def unpack(res):
- d1 = self.writer.callRemote("unpack")
- def unpack_err(f):
- self.rc = 1
- return f
- d1.addErrback(unpack_err)
- d1.addCallback(lambda ignored: res)
- return d1
- d.addCallback(unpack)
- d.addBoth(self.finished)
- return d
-
- def finished(self, res):
- self.fp.close()
- os.remove(self.tarname)
- return TransferCommand.finished(self, res)
-
-
-class SlaveFileDownloadCommand(TransferCommand):
- """
- Download a file from master to slave
- Arguments:
-
- - ['workdir']: base directory to use
- - ['slavedest']: name of the slave-side file to be created
- - ['reader']: RemoteReference to a transfer._FileReader object
- - ['maxsize']: max size (in bytes) of file to write
- - ['blocksize']: max size for each data block
- - ['mode']: access mode for the new file
- """
- debug = False
-
- def setup(self, args):
- self.workdir = args['workdir']
- self.filename = args['slavedest']
- self.reader = args['reader']
- self.bytes_remaining = args['maxsize']
- self.blocksize = args['blocksize']
- self.mode = args['mode']
- self.stderr = None
- self.rc = 0
-
- def start(self):
- if self.debug:
- log.msg('SlaveFileDownloadCommand starting')
-
- # Open file
- self.path = os.path.join(self.builder.basedir,
- self.workdir,
- os.path.expanduser(self.filename))
-
- dirname = os.path.dirname(self.path)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
-
- try:
- self.fp = open(self.path, 'wb')
- if self.debug:
- log.msg("Opened '%s' for download" % self.path)
- if self.mode is not None:
- # note: there is a brief window during which the new file
- # will have the buildslave's default (umask) mode before we
- # set the new one. Don't use this mode= feature to keep files
- # private: use the buildslave's umask for that instead. (it
- # is possible to call os.umask() before and after the open()
- # call, but cleaning up from exceptions properly is more of a
- # nuisance that way).
- os.chmod(self.path, self.mode)
- except IOError:
- # TODO: this still needs cleanup
- self.fp = None
- self.stderr = "Cannot open file '%s' for download" % self.path
- self.rc = 1
- if self.debug:
- log.msg("Cannot open file '%s' for download" % self.path)
-
- d = defer.Deferred()
- self._reactor.callLater(0, self._loop, d)
- def _close(res):
- # close the file, but pass through any errors from _loop
- d1 = self.reader.callRemote('close')
- d1.addErrback(log.err, 'while trying to close reader')
- d1.addCallback(lambda ignored: res)
- return d1
- d.addBoth(_close)
- d.addBoth(self.finished)
- return d
-
- def _loop(self, fire_when_done):
- d = defer.maybeDeferred(self._readBlock)
- def _done(finished):
- if finished:
- fire_when_done.callback(None)
- else:
- self._loop(fire_when_done)
- def _err(why):
- fire_when_done.errback(why)
- d.addCallbacks(_done, _err)
- return None
-
- def _readBlock(self):
- """Read a block of data from the remote reader."""
-
- if self.interrupted or self.fp is None:
- if self.debug:
- log.msg('SlaveFileDownloadCommand._readBlock(): end')
- return True
-
- length = self.blocksize
- if self.bytes_remaining is not None and length > self.bytes_remaining:
- length = self.bytes_remaining
-
- if length <= 0:
- if self.stderr is None:
- self.stderr = "Maximum filesize reached, truncating file '%s'" \
- % self.path
- self.rc = 1
- return True
- else:
- d = self.reader.callRemote('read', length)
- d.addCallback(self._writeData)
- return d
-
- def _writeData(self, data):
- if self.debug:
- log.msg('SlaveFileDownloadCommand._readBlock(): readlen=%d' %
- len(data))
- if len(data) == 0:
- return True
-
- if self.bytes_remaining is not None:
- self.bytes_remaining = self.bytes_remaining - len(data)
- assert self.bytes_remaining >= 0
- self.fp.write(data)
- return False
-
- def finished(self, res):
- if self.fp is not None:
- self.fp.close()
-
- return TransferCommand.finished(self, res)
-
-class SlaveDirectoryDownloadCommand(SlaveFileDownloadCommand):
- debug = False
-
- def setup(self, args):
- self.workdir = args['workdir']
-
- self.dirname = os.path.expanduser(args['slavedest'])
- self.reader = args['reader']
- self.bytes_remaining = args['maxsize']
- self.blocksize = args['blocksize']
- self.compress = args['compress']
- self.mode = args['mode']
- self.stderr = None
- self.rc = 0
-
- def start(self):
- if self.debug:
- log.msg('SlaveDirectoryDownloadCommand starting')
-
- if not os.path.exists(self.dirname):
- os.makedirs(self.dirname)
-
- try:
- fd, self.tarname = tempfile.mkstemp()
- self.fp = os.fdopen(fd, 'w')
- if self.debug:
- log.msg("Opened '%s' for download" % self.tarname)
- except IOError:
- # TODO: this still needs cleanup
- self.fp = None
- self.stderr = "Cannot open file '%s' for download" % self.tarname
- self.rc = 1
- if self.debug:
- log.msg("Cannot open file '%s' for download" % self.tarname)
-
- d = defer.Deferred()
- self._reactor.callLater(0, self._loop, d)
- def _close(res):
- # close the file, but pass through any errors from _loop
- d1 = self.reader.callRemote('close')
- d1.addErrback(log.err, 'while trying to close reader')
- d1.addCallback(lambda ignored: res)
- return d1
- d.addBoth(_close)
- d.addBoth(self.finished)
- return d
-
- def finished(self, res):
- if self.fp is not None:
- self.fp.close()
-
- # decompress
- if self.compress == 'bz2':
- mode='r|bz2'
- elif self.compress == 'gz':
- mode='r|gz'
- else:
- mode = 'r'
- if not hasattr(tarfile.TarFile, 'extractall'):
- tarfile.TarFile.extractall = _extractall
- archive = tarfile.open(name=self.tarname, mode=mode)
- archive.extractall(path=self.dirname)
- archive.close()
- os.remove(self.tarname)
-
- # note: there is a brief window during which the new file
- # will have the buildslave's default (umask) mode before we
- # set the new one. Don't use this mode= feature to keep files
- # private: use the buildslave's umask for that instead. (it
- # is possible to call os.umask() before and after the open()
- # call, but cleaning up from exceptions properly is more of a
- # nuisance that way).
- if self.mode is not None:
- for f in os.listdir(self.dirname):
- full_f = os.path.join(self.dirname, f)
- os.chmod(full_f, self.mode)
-
- return TransferCommand.finished(self, res)
diff --git a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/utils.py b/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/utils.py
deleted file mode 100644
index 6483a597..00000000
--- a/lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/utils.py
+++ /dev/null
@@ -1,100 +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 import log
-from twisted.python.procutils import which
-from twisted.python import runtime
-
-def getCommand(name):
- possibles = which(name)
- if not possibles:
- raise RuntimeError("Couldn't find executable for '%s'" % name)
- #
- # Under windows, if there is more than one executable "thing"
- # that matches (e.g. *.bat, *.cmd and *.exe), we not just use
- # the first in alphabet (*.bat/*.cmd) if there is a *.exe.
- # e.g. under MSysGit/Windows, there is both a git.cmd and a
- # git.exe on path, but we want the git.exe, since the git.cmd
- # does not seem to work properly with regard to errors raised
- # and catched in buildbot slave command (vcs.py)
- #
- if runtime.platformType == 'win32' and len(possibles) > 1:
- possibles_exe = which(name + ".exe")
- if possibles_exe:
- return possibles_exe[0]
- return possibles[0]
-
-# this just keeps pyflakes happy on non-Windows systems
-if runtime.platformType != 'win32':
- WindowsError = RuntimeError
-
-if runtime.platformType == 'win32':
- 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) or os.path.isfile(dir):
- os.remove(dir)
- return
-
- # Verify the directory is read/write/execute for the current user
- os.chmod(dir, 0700)
-
- # os.listdir below only returns a list of unicode filenames if the parameter is unicode
- # Thus, if a non-unicode-named dir contains a unicode filename, that filename will get garbled.
- # So force dir to be unicode.
- if not isinstance(dir, unicode):
- try:
- dir = unicode(dir, "utf-8")
- except:
- log.err("rmdirRecursive: decoding from UTF-8 failed (ignoring)")
-
- try:
- list = os.listdir(dir)
- except WindowsError, e:
- msg = ("rmdirRecursive: unable to listdir %s (%s). Trying to "
- "remove like a dir" % (dir, e.strerror.decode('mbcs')))
- log.msg(msg.encode('utf-8'))
- os.rmdir(dir)
- return
-
- for name in list:
- 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.islink(full_name):
- os.remove(full_name) # as suggested in bug #792
- elif os.path.isdir(full_name):
- rmdirRecursive(full_name)
- else:
- if os.path.isfile(full_name):
- os.chmod(full_name, 0700)
- os.remove(full_name)
- os.rmdir(dir)
-else:
- # use rmtree on POSIX
- import shutil
- rmdirRecursive = shutil.rmtree