1
2
3 from buildbot import util
4 from buildbot.process.base import Build
5 from buildbot.process.buildstep import BuildStep
6 from buildbot.steps.source import CVS, SVN
7 from buildbot.steps.shell import Configure, Compile, Test, PerlModuleTest
8
9
10 -def s(steptype, **kwargs):
11
12
13 return (steptype, kwargs)
14
16 """
17 @cvar buildClass: class to use when creating builds
18 @type buildClass: L{buildbot.process.base.Build}
19 """
20 buildClass = Build
21 useProgress = 1
22 compare_attrs = ['buildClass', 'steps', 'useProgress']
23
28
33
35 """Create a new Build instance.
36 @param request: a L{base.BuildRequest} describing what is to be built
37 """
38 b = self.buildClass(request)
39 b.useProgress = self.useProgress
40 b.setStepFactories(self.steps)
41 return b
42
43 - def addStep(self, step_or_factory, **kwargs):
44 if isinstance(step_or_factory, BuildStep):
45 s = step_or_factory.getStepFactory()
46 else:
47 s = (step_or_factory, dict(kwargs))
48 self.steps.append(s)
49
52
53
54
56 - def __init__(self, source, configure="./configure",
57 configureEnv={},
58 configureFlags=[],
59 compile=["make", "all"],
60 test=["make", "check"]):
80
81 -class CPAN(BuildFactory):
82 - def __init__(self, source, perl="perl"):
87
89 - def __init__(self, source, python="python", test=None):
94
95 -class Trial(BuildFactory):
96 """Build a python module that uses distutils and trial. Set 'tests' to
97 the module in which the tests can be found, or set useTestCaseNames=True
98 to always have trial figure out which tests to run (based upon which
99 files have been changed).
100
101 See docs/factories.xhtml for usage samples. Not all of the Trial
102 BuildStep options are available here, only the most commonly used ones.
103 To get complete access, you will need to create a custom
104 BuildFactory."""
105
106 trial = "trial"
107 randomly = False
108 recurse = False
109
110 - def __init__(self, source,
111 buildpython=["python"], trialpython=[], trial=None,
112 testpath=".", randomly=None, recurse=None,
113 tests=None, useTestCaseNames=False, env=None):
114 BuildFactory.__init__(self, [source])
115 assert tests or useTestCaseNames, "must use one or the other"
116 if trial is not None:
117 self.trial = trial
118 if randomly is not None:
119 self.randomly = randomly
120 if recurse is not None:
121 self.recurse = recurse
122
123 from buildbot.steps.python_twisted import Trial
124 buildcommand = buildpython + ["./setup.py", "build"]
125 self.addStep(Compile, command=buildcommand, env=env)
126 self.addStep(Trial,
127 python=trialpython, trial=self.trial,
128 testpath=testpath,
129 tests=tests, testChanges=useTestCaseNames,
130 randomly=self.randomly,
131 recurse=self.recurse,
132 env=env,
133 )
134
135
136
137
138
139
140 ConfigurableBuildFactory = BuildFactory
141
143
144
145 - def __init__(self, cvsroot, cvsmodule,
146 configure=None, configureEnv={},
147 compile="make all",
148 test="make check", cvsCopy=False):
149 mode = "clobber"
150 if cvsCopy:
151 mode = "copy"
152 source = s(CVS, cvsroot=cvsroot, cvsmodule=cvsmodule, mode=mode)
153 GNUAutoconf.__init__(self, source,
154 configure=configure, configureEnv=configureEnv,
155 compile=compile,
156 test=test)
157
159 useProgress = False
160
161 - def __init__(self, cvsroot, cvsmodule,
162 configure=None, configureEnv={},
163 compile="make all",
164 test="make check", cvsCopy=False):
165 mode = "update"
166 source = s(CVS, cvsroot=cvsroot, cvsmodule=cvsmodule, mode=mode)
167 GNUAutoconf.__init__(self, source,
168 configure=configure, configureEnv=configureEnv,
169 compile=compile,
170 test=test)
171
173
174 - def __init__(self, svnurl,
175 configure=None, configureEnv={},
176 compile="make all",
177 test="make check"):
178 source = s(SVN, svnurl=svnurl, mode="update")
179 GNUAutoconf.__init__(self, source,
180 configure=configure, configureEnv=configureEnv,
181 compile=compile,
182 test=test)
183