def test_getCommand_multi_exe(self): self.set_which_results({ 'xeyes' : [ r'c:\program files\xeyes.com', r'c:\program files\xeyes.exe' ], 'xeyes.exe' : [ r'c:\program files\xeyes.exe' ], }) # this one will work out differently depending on platform.. if runtime.platformType == 'win32': self.assertEqual(utils.getCommand('xeyes'), r'c:\program files\xeyes.exe') else: self.assertEqual(utils.getCommand('xeyes'), r'c:\program files\xeyes.com')
def test_getCommand_multi_exe(self): self.set_which_results({ 'xeyes': [r'c:\program files\xeyes.com', r'c:\program files\xeyes.exe'], 'xeyes.exe': [r'c:\program files\xeyes.exe'], }) # this one will work out differently depending on platform.. if runtime.platformType == 'win32': self.assertEqual(utils.getCommand('xeyes'), r'c:\program files\xeyes.exe') else: self.assertEqual(utils.getCommand('xeyes'), r'c:\program files\xeyes.com')
def test_getCommand_multi_exe(self): self.set_which_results( { "xeyes": [r"c:\program files\xeyes.com", r"c:\program files\xeyes.exe"], "xeyes.exe": [r"c:\program files\xeyes.exe"], } ) # this one will work out differently depending on platform.. if runtime.platformType == "win32": self.assertEqual(utils.getCommand("xeyes"), r"c:\program files\xeyes.exe") else: self.assertEqual(utils.getCommand("xeyes"), r"c:\program files\xeyes.com")
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', ] 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. marker = open(os.path.join(dir, ".buildbot-patched"), "w") marker.write("patched\n") marker.close() # 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, initialStdin=diff, usePTY=False) self.command = c d = c.start() d.addCallback(self._abandonOnFailure) return d
def setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("bzr") self.repourl = args['repourl'] self.sourcedata = "%s\n" % self.repourl self.revision = self.args.get('revision') self.forceSharedRepo = args.get('forceSharedRepo')
def test_getCommand_single_exe(self): self.set_which_results({ 'xeyes': ['/usr/bin/xeyes'], # it should not select this option, since only one matched # to begin with 'xeyes.exe': [r'c:\program files\xeyes.exe'], }) self.assertEqual(utils.getCommand('xeyes'), '/usr/bin/xeyes')
def setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("bk") 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 setup(self, args): Arch.setup(self, args, no_getCommand=True) self.vcexe = utils.getCommand("baz") # baz doesn't emit the repository name after registration (and # grepping through the output of 'baz archives' is too hard), so we # require that the buildmaster configuration to provide both the # archive name and the URL. self.archive = args['archive'] # required for Baz self.sourcedata = "%s\n%s\n%s\n" % (self.url, self.version, self.buildconfig)
def setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("git") 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)
def test_getCommand_single_exe(self): self.set_which_results( { "xeyes": ["/usr/bin/xeyes"], # it should not select this option, since only one matched # to begin with "xeyes.exe": [r"c:\program files\xeyes.exe"], } ) self.assertEqual(utils.getCommand("xeyes"), "/usr/bin/xeyes")
def setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("hg") 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 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 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 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 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 OSError: pass return x d.addBoth(cleanup) d.addCallback(self._abandonOnFailure) return d
def setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("cvs") 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 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 setup(self, args, no_getCommand=False): SourceBaseCommand.setup(self, args) # avoid doing this if used via a subclass if not no_getCommand: self.vcexe = utils.getCommand("tla") self.archive = args.get('archive') self.url = args['url'] self.version = args['version'] self.revision = args.get('revision') self.buildconfig = args.get('build-config') self.sourcedata = "%s\n%s\n%s\n" % (self.url, self.version, self.buildconfig)
def setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("svn") 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.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 setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("svn") 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.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 setup(self, args): SourceBaseCommand.setup(self, args) self.vcexe = utils.getCommand("darcs") self.repourl = args['repourl'] self.sourcedata = "%s\n" % self.repourl self.revision = self.args.get('revision')
def test_getCommand_multi(self): self.set_which_results({ 'xeyes': ['/usr/bin/xeyes', '/usr/X11/bin/xeyes'], }) self.assertEqual(utils.getCommand('xeyes'), '/usr/bin/xeyes')
def test_getCommand_empty(self): self.set_which_results({ 'xeyes': [], }) self.assertRaises(RuntimeError, lambda: utils.getCommand('xeyes'))
def test_getCommand_multi(self): self.set_which_results({"xeyes": ["/usr/bin/xeyes", "/usr/X11/bin/xeyes"]}) self.assertEqual(utils.getCommand("xeyes"), "/usr/bin/xeyes")
def test_getCommand_empty(self): self.set_which_results({"xeyes": []}) self.assertRaises(RuntimeError, lambda: utils.getCommand("xeyes"))
def testGetCommand(self): self.failUnlessEqual(sys.executable, getCommand(sys.executable))
def setup(self, args): P4Base.setup(self, args) self.vcexe = utils.getCommand("p4")