1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 import os
17 import time
18
19 from buildslave.commands.base import SourceBaseCommand
20 from buildslave import runprocess
21
22 -class CVS(SourceBaseCommand):
23 """CVS-specific VC operation. In addition to the arguments handled by
24 SourceBaseCommand, this command reads the following keys:
25
26 ['cvsroot'] (required): the CVSROOT repository string
27 ['cvsmodule'] (required): the module to be retrieved
28 ['branch']: a '-r' tag or branch name to use for the checkout/update
29 ['login']: a string for use as a password to 'cvs login'
30 ['global_options']: a list of strings to use before the CVS verb
31 ['checkout_options']: a list of strings to use after checkout,
32 but before revision and branch specifiers
33 ['checkout_options']: a list of strings to use after export,
34 but before revision and branch specifiers
35 ['extra_options']: a list of strings to use after export and checkout,
36 but before revision and branch specifiers
37 """
38
39 header = "cvs operation"
40
42 SourceBaseCommand.setup(self, args)
43 self.cvsroot = args['cvsroot']
44 self.cvsmodule = args['cvsmodule']
45 self.global_options = args.get('global_options', [])
46 self.checkout_options = args.get('checkout_options', [])
47 self.export_options = args.get('export_options', [])
48 self.extra_options = args.get('extra_options', [])
49 self.branch = args.get('branch')
50 self.login = args.get('login')
51 self.sourcedata = "%s\n%s\n%s\n" % (self.cvsroot, self.cvsmodule,
52 self.branch)
53
58
77
81
83 cvs = self.getCommand("cvs")
84 d = os.path.join(self.builder.basedir, self.srcdir)
85 command = [cvs, '-z3'] + self.global_options + ['update', '-dP']
86 if self.branch:
87 command += ['-r', self.branch]
88 if self.revision:
89 command += ['-D', self.revision]
90 c = runprocess.RunProcess(self.builder, command, d,
91 sendRC=False, timeout=self.timeout,
92 maxTime=self.maxTime, usePTY=False)
93 self.command = c
94 return c.start()
95
97 cvs = self.getCommand("cvs")
98 d = self.builder.basedir
99 if self.mode == "export":
100 verb = "export"
101 else:
102 verb = "checkout"
103 command = ([cvs, '-d', self.cvsroot, '-z3'] +
104 self.global_options +
105 [verb, '-d', self.srcdir])
106
107 if verb == "checkout":
108 command += self.checkout_options
109 else:
110 command += self.export_options
111 command += self.extra_options
112
113 if self.branch:
114 command += ['-r', self.branch]
115 if self.revision:
116 command += ['-D', self.revision]
117 command += [self.cvsmodule]
118
119 c = runprocess.RunProcess(self.builder, command, d,
120 sendRC=False, timeout=self.timeout,
121 maxTime=self.maxTime, usePTY=False)
122 self.command = c
123 return c.start()
124
126
127
128
129
130 return time.strftime("%Y-%m-%d %H:%M:%S +0000", time.gmtime())
131