[r5657]: build / tg_master / tg_master / tgbuilder.py Maximize Restore History

Download this file

tgbuilder.py    409 lines (346 with data), 17.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
"""
This module contains functions to automate creation of BuildFactories and
other helpful functions to use in master.cfg
"""
from buildbot.process import factory
from buildbot.steps.shell import ShellCommand
from buildbot.steps.transfer import FileDownload
from buildbot.steps import source
from ppath import modifyppath
from buildbot.buildslave import BuildSlave
from tg_mbuildsteps import *
#################### TG 1.0 builder ###################################
def tg10builder(quick, pythonpath = "bin:lib"):
"""tg10builder returns a BuildFactory which downloads TG1.0 from SVN,
installs all dependencies, runs the core tests, creates all posible
quickstart projects, runs the tests for all of this projects and
builds the egg.
:parameter pythonpath: This is the path, which is used for all
python scripts. pythonpath must fit the pattern: "binDir:libDir".
:type pythonpath: string
:param quick: Sets quick build mode
:type quick: boolean"""
ftg1 = factory.BuildFactory()
if quick:
ftg1.addStep(source.SVN(mode='update',
svnurl="http://svn.turbogears.org/"\
"branches/1.0"))
else:
ftg1.addStep(source.SVN(mode='clobber',
svnurl="http://svn.turbogears.org/"\
"branches/1.0"))
ftg1.addStep(FileDownload, mastersrc="autobuild_quickstarts.py",
slavedest="autobuild_quickstarts.py")
ftg1.addStep(FileDownload, mastersrc="upload_script.py",
slavedest="upload_script.py")
ftg1.addStep(VirtualEnv, env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg1.addStep(InterOSShellCommand, command=["cp", "python2.3", "python"],
description="Rename python23", workdir="build/bin",
flunkOnFailure=False)
if quick:
ftg1.addStep(EasyInstall, package=["cherrypy"],
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
else:
ftg1.addStep(Python, script="externals.py", workdir="build/thirdparty",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg1.addStep(RunSetup, description="Installing TG1",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg1.addStep(EasyInstall, package=["SQLAlchemy", "SQLObject", "Genshi",
"gsquickstart", "docutils"], env={'PYTHONPATH':pythonpath},
haltOnFailure=True)
ftg1.addStep(EasyInstall, package=["nose"],
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg1.addStep(Nose, verbose=True, testdir="turbogears/tests",
description="Running nosetest TG",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
if quick == False:
ftg1.addStep(Python, script="autobuild_quickstarts.py",
description="Creating quickstart projects",
env={'PYTHONPATH':pythonpath})
ftg1.addStep(Nose, description="Running nosetest Quickstart",
env={'PYTHONPATH':pythonpath}, testdir="build")
ftg1.addStep(BuildEgg, description="Building TG1 egg",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg1.addStep(EasyInstall, env={'PYTHONPATH':pythonpath},
localinstall = True, haltOnFailure = True)
if quick == False:
ftg1.addStep(UploadEgg, env={'PYTHONPATH':pythonpath},
package=["TurboGears 1"])
return ftg1
##################### TG 1.1 -Builder ######################
def tg11builder(quick, pythonpath = "bin:lib"):
"""
tg11builder returns a BuildFactory which downloads TG1.1 from SVN,
installs all dependencies,runs the core tests, creates all posible
quickstart projects, runs the tests for all of this projects and builds
the egg.
:parameter pythonpath: This is the path, which is used for all python
scripts. pythonpath must fit the pattern: "binDir:libDir".
:type pythonpath: string
:param quick: Sets quick build mode
:type quick: boolean
"""
ftg11 = factory.BuildFactory()
if quick:
ftg11.addStep(source.SVN(mode='update',
svnurl='http://svn.turbogears.org/branches/1.1'))
ftg11.addStep(VirtualEnv, env={'PYTHONPATH':pythonpath},
haltOnFailure=True)
ftg11.addStep(EasyInstall, package=["configobj", "SQLAlchemy",
"webtest", "sqlobject",
"formencode", "mochikit",
"decoratortools",
"peak-rules", "simplejson",
"genshi", "elixir","paste",
"pastescript"])
else:
ftg11.addStep(source.SVN(mode='clobber',
svnurl='http://svn.turbogears.org/branches/1.1'))
ftg11.addStep(FileDownload, mastersrc="autobuild_quickstarts.py",
slavedest="autobuild_quickstarts.py")
ftg11.addStep(FileDownload, mastersrc="upload_script.py",
slavedest="upload_script.py")
ftg11.addStep(VirtualEnv, env={'PYTHONPATH':pythonpath},
haltOnFailure=True)
ftg11.addStep(InterOSShellCommand, command=["cp", "python2.3", "python"],
description="Rename python23",
workdir="build/bin", flunkOnFailure=False)
if not quick:
ftg11.addStep(EasyInstall, package=["SQLAlchemy", "SQLObject",
"Genshi", "gsquickstart", "docutils"],
description="Installing Dependencies",
env={"PYTHONPATH":pythonpath}, haltOnFailure=True)
ftg11.addStep(Python, script="externals.py",
description="Running externals.py",
workdir="build/thirdparty",
env={'PYTHONPATH':pythonpath},
haltOnFailure=True)
ftg11.addStep(RunSetup, description="Installing TG11",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg11.addStep(EasyInstall, package=["nose", "webtest"],
description="installing nose + webtest",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg11.addStep(Nose, testdir="turbogears/tests", verbose=True,
description="Running nosetest TG",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
if not quick:
ftg11.addStep(Python, script="autobuild_quickstarts.py",
description="Creating quickstart projects",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg11.addStep(Nose, description="Running nosetest Quickstart",
env={'PYTHONPATH':pythonpath})
ftg11.addStep(BuildEgg, description="Building TG11 egg",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg11.addStep(EasyInstall, env={'PYTHONPATH':pythonpath},
localinstall = True, haltOnFailure = True)
if quick == False:
ftg11.addStep(UploadEgg, env={'PYTHONPATH':pythonpath},
package=["TurboGears 1.1"])
return ftg11
######################### TG 2 -Builder ########################
def tg2builder(quick, pythonpath = "bin:lib"):
"""
tg2builder returns a BuildFactory which downloads TG2 from SVN,
downloads pylons from mercurial, installs all dependencies,
runs the core tests, creates all posible quickstart projects,runs
the tests for all of this projects and builds the egg.
:parameter pythonpath: This is the path, which is used for all
python scripts. pythonpath must fit the pattern: "binDir:libDir".
:type pythonpath: string
:param quick: Sets quick build mode
:type quick: boolean
"""
ftg2 = factory.BuildFactory()
if quick:
update_mode = 'update'
else:
update_mode = 'clobber'
ftg2.addStep(source.Mercurial(repourl="http://pylonshq.com/hg/pylons-dev",
alwaysUseLatest = True, mode=update_mode,
workdir="build/pylons"), haltOnFailure=True)
ftg2.addStep(source.SVN(mode=update_mode,
svnurl="http://svn.turbogears.org/" \
"projects/tg.devtools/trunk",
alwaysUseLatest = True,
workdir='build/tgdev'),haltOnFailure=True)
ftg2.addStep(source.SVN(mode=update_mode,
svnurl='http://svn.turbogears.org/trunk',
workdir='build/tg2', haltOnFailure = False))
ftg2.addStep(source.SVN(mode=update_mode,
svnurl="http://svn.turbogears.org/projects/"\
"tgrepozewho/trunk", workdir='build/tgreoz',
alwaysUseLatest = True), haltOnFailure=True)
if not quick:
ftg2.addStep(source.Mercurial(
repourl="https://www.knowledgetap.com"\
"/hg/webhelpers",mode='clobber',
workdir="build/webhelpers",
alwaysUseLatest = True),
haltOnFailure=True)
ftg2.addStep(FileDownload, mastersrc="upload_script.py",
slavedest="upload_script.py")
ftg2.addStep(FileDownload, mastersrc="autobuild_quickstarts.py",
slavedest="autobuild_quickstarts.py")
ftg2.addStep(VirtualEnv, env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg2.addStep(EasyInstall, package=["nose"], description="installing nose",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg2.addStep(EasyInstall, package=["paver"], description="Installing paver",
env={'PYTHONPATH':pythonpath})
if quick == False:
ftg2.addStep(EasyInstall, URL="http://turbogears.org/download/",
package=["RuleDispatch", "PyProtocols"],
description="Installing RuleDispatch + Pyprotocols",
env={'PYTHONPATH':pythonpath})
newppath = modifyppath(pythonpath, "..")
ftg2.addStep(RunSetup, devmode=True, description="Installing webhelpers",
env={'PYTHONPATH':newppath}, workdir="build/webhelpers")
ftg2.addStep(RunSetup, devmode=True, description="Installing pylons",
env={'PYTHONPATH':newppath}, workdir="build/pylons",
haltOnFailure=True)
ftg2.addStep(RunSetup, devmode=True, description="Installing tgreozewho",
env={'PYTHONPATH':newppath}, workdir="build/tgreoz")
ftg2.addStep(Paver, description="Installing tg2", mode='develop',
env={'PYTHONPATH':newppath}, workdir="build/tg2",
haltOnFailure=True)
ftg2.addStep(RunSetup, devmode=True, description="Installing tgdev",
env={'PYTHONPATH':newppath}, workdir="build/tgdev")
ftg2.addStep(Nose, testdir="tg2/tg", verbose=True, haltOnFailure=True)
ftg2.addStep(Nose, testdir="tgdev/devtools", verbose=True)
ftg2.addStep(Nose, testdir="tgreoz/tgrepozewho", verbose=True)
if quick == False:
ftg2.addStep(Python, script="autobuild_quickstarts.py",
script_args=["TG2"], env={'PYTHONPATH':pythonpath},
description="Creating quickstart projects",
workdir="build")
ftg2.addStep(Nose, description="Running nosetest Quickstart",
env={'PYTHONPATH':pythonpath})
ftg2.addStep(Paver, mode="bdist_egg", description="Building TG2 egg",
env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
ftg2.addStep(EasyInstall, env={'PYTHONPATH':pythonpath},
localinstall = True, haltOnFailure = True)
if quick == False:
ftg2.addStep(UploadEgg, env={'PYTHONPATH':pythonpath},
package=["TurboGears 2"])
return ftg2
def dependencybuildersvn(svn_url, pythonpath, name, dependencyfromtg=None):
"""
dependencybuildersvn creates a build factory which does a
checkout from svnURL, downloads the dependencies specified
in DependencyFromTG from the TurboGears server,
runs setup.py and builds the egg."""
fdb = factory.BuildFactory()
fdb.addStep(source.SVN(svnurl=svn_url, mode='clobber'))
fdb.addStep(FileDownload, mastersrc="upload_script.py",
slavedest="upload_script.py")
fdb.addStep(VirtualEnv, env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
fdb.addStep(EasyInstall, package=["nose"], env={'PYTHONPATH':pythonpath},
haltOnFailure=True)
if dependencyfromtg is not None :
fdb.addStep(EasyInstall, URL="http://turbogears.org/download/",
description="Installing Dependencies",
package=dependencyfromtg, env={'PYTHONPATH':pythonpath})
fdb.addStep(RunSetup, description="Installing " + name,
env={'PYTHONPATH':pythonpath})
fdb.addStep(Python, script="setup.py", script_args=["test"],
description="Testing " + name, env={'PYTHONPATH':pythonpath},
workdir="build", haltOnFailure=True)
fdb.addStep(BuildEgg, env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
fdb.addStep(EasyInstall, env={'PYTHONPATH':pythonpath},
localinstall = True, haltOnFailure = True)
fdb.addStep(UploadEgg, env={'PYTHONPATH':pythonpath}, package=[name])
return fdb
def dependencybuilderee(name, pythonpath = "bin:lib"):
"""dependencybuilderee creates a build factory which downloads the
source of the dependency via easy_install and builds the egg."""
fdb = factory.BuildFactory()
fdb.addStep(CleanDir)
fdb.addStep(FileDownload, mastersrc="upload_script.py",
slavedest="upload_script.py")
fdb.addStep(VirtualEnv, env={'PYTHONPATH':pythonpath}, haltOnFailure=True)
fdb.addStep(EasyInstall, package=["Nose"])
fdb.addStep(BuildEggEE, package=name[0], env={'PYTHONPATH':pythonpath})
fdb.addStep(EasyInstall, env={'PYTHONPATH':pythonpath},
localinstall = True, haltOnFailure = True)
fdb.addStep(UploadEgg, env={'PYTHONPATH':pythonpath}, package=name)
return fdb
def tg_ng_setupbuilder():
"""
Tests next generation install scipt
"""
fng = factory.BuildFactory()
fng.addStep(CleanDir)
fng.addStep(FileDownload, mastersrc="create-tgsetupng.py",
slavedest="create-tgsetupng.py")
fng.addStep(Python, script="create-tgsetupng.py", haltOnFailure=True)
fng.addStep(Python, script="tgsetupng.py",
script_args=["tg"], haltOnFailure=True)
return fng
def doc_builder(**kwargs):
"""
Creates documentation of a project. doc_builder takes an package name or
an SVN repository as a source.
:keyword framework: specifies the framework to use: sphinx or epydoc
:type framework: string
:keyword doc_dir: path to the files that should be documentated
:type doc_dir: string
:keyword package: Use this package as source
(DocBuilder downloads it from pypi.python.org)
:type package: string
:keyword svnurl: Use this repository as source
:type svnurl: string
:keyword needed_conf_file: path to a needed config file
that has to be downloaded from the build master
:type needed_conf_file: string
"""
fdoc = factory.BuildFactory()
if 'framework' not in kwargs:
kwargs['framework'] = 'epydoc'
if 'doc_dir' not in kwargs:
kwargs['doc_dir'] = ''
if 'package' in kwargs:
fdoc.addStep(CleanDir)
fdoc.addStep(DownloadSourceEE, package=kwargs['package'])
else:
fdoc.addStep(source.SVN, svnurl=kwargs['svnurl'], mode='clobber')
if 'needed_conf_file' in kwargs:
fdoc.addStep(FileDownload, mastersrc=kwargs['needed_conf_file'],
slavedest=kwargs['needed_conf_file'])
if kwargs['framework'] == 'epydoc':
if 'needed_conf_file' in kwargs:
fdoc.addStep(BuildDocEpy, doc_dir = kwargs['doc_dir'],
needed_conf_file = kwargs['needed_conf_file'])
elif kwargs['framework'] == 'sphinx':
fdoc.addStep(BuildDocSphinx, doc_dir=kwargs['doc_dir'])
if kwargs['framework'] == 'epydoc':
fdoc.addStep(ShellCommand,
command = ['tar', '-cf', 'apidoc.tar', 'api'])
return fdoc
def createnamelist(namelist, string):
"""
createnamelist creates a list of slaves names which name contains string
:parameter namelist: List of slave names
:type namelist: list of strings
:parameter string: part of slave name to look for
:type string: string
"""
temp = []
for element in namelist:
if string in element:
temp.append(element)
return temp
def createslavelist():
"""
creates a list of slaves from the slaves.cfg file
:return: returns list of names of the slave and
list of BuildSlave objects
"""
slavelist = []
namelist = []
slave_file = open("slaves.cfg", "r")
temp = slave_file.readlines()
for line in temp:
temp2 = line.split(" ", 2)
temp2[1] = temp2[1].replace("\n", "")
slavelist.append(BuildSlave(temp2[0], temp2[1]))
namelist.append(temp2[0])
return slavelist, namelist