Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 import os 17 18 from twisted.python import log 19 20 from buildslave.commands.base import SourceBaseCommand 21 from buildslave import runprocess 22 2325 """BitKeeper-specific VC operation. In addition to the arguments 26 handled by SourceBaseCommand, this command reads the following keys: 27 28 ['bkurl'] (required): the BK repository string 29 """ 30 31 header = "bk operation" 3211334 SourceBaseCommand.setup(self, args) 35 self.bkurl = args['bkurl'] 36 self.sourcedata = '"%s\n"' % self.bkurl 37 38 self.bk_args = [] 39 if args.get('extra_args', None) is not None: 40 self.bk_args.extend(args['extra_args'])4143 if os.path.exists(os.path.join(self.builder.basedir, 44 self.srcdir, ".buildbot-patched")): 45 return False 46 return os.path.isfile(os.path.join(self.builder.basedir, 47 self.srcdir, "BK/parent"))4850 bk = self.getCommand('bk') 51 # XXX revision is never used!! - bug #1715 52 # revision = self.args['revision'] or 'HEAD' 53 # update: possible for mode in ('copy', 'update') 54 d = os.path.join(self.builder.basedir, self.srcdir) 55 56 # Revision is ignored since the BK free client doesn't support it. 57 command = [bk, 'pull'] 58 c = runprocess.RunProcess(self.builder, command, d, 59 sendRC=False, timeout=self.timeout, 60 keepStdout=True, logEnviron=self.logEnviron, 61 usePTY=False) 62 self.command = c 63 return c.start()6466 bk = self.getCommand('bk') 67 68 revision_arg = '' 69 if self.args['revision']: 70 revision_arg = "-r%s" % self.args['revision'] 71 72 d = self.builder.basedir 73 74 command = [bk, 'clone', revision_arg] + self.bk_args + \ 75 [self.bkurl, self.srcdir] 76 c = runprocess.RunProcess(self.builder, command, d, 77 sendRC=False, timeout=self.timeout, 78 logEnviron=self.logEnviron, usePTY=False) 79 self.command = c 80 return c.start()8183 """ 84 Get the (shell) command used to determine BK revision number 85 of checked-out code 86 87 return: list of strings, passable as the command argument to RunProcess 88 """ 89 bk = self.getCommand('bk') 90 return [bk, "changes", "-r+", "-d:REV:"]9193 c = runprocess.RunProcess(self.builder, 94 self.getBKVersionCommand(), 95 os.path.join(self.builder.basedir, self.srcdir), 96 environ=self.env, timeout=self.timeout, 97 sendStdout=False, sendStderr=False, sendRC=False, 98 keepStdout=True, logEnviron=self.logEnviron, 99 usePTY=False) 100 d = c.start() 101 def _parse(res): 102 r_raw = c.stdout.strip() 103 try: 104 r = r_raw 105 except: 106 msg = ("BK.parseGotRevision unable to parse output: (%s)" % r_raw) 107 log.msg(msg) 108 self.sendStatus({'header': msg + "\n"}) 109 raise ValueError(msg) 110 return r111 d.addCallback(_parse) 112 return d
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 25 19:40:43 2012 | http://epydoc.sourceforge.net |