-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaster.cfg
executable file
·270 lines (228 loc) · 9.24 KB
/
master.cfg
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
# -*- python -*-
# ex: set syntax=python:
# TODO
# - setup scheduler for tags (master)
# - setup scheduler for commits (next)
# - fix mergechanges step
# - test debian build steps http://docs.buildbot.net/latest/manual/cfg-buildsteps.html#debian-build-steps
# - cron check & restart
# IMPORT
import glob
from buildbot.buildslave import BuildSlave
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.changes import filter
from buildbot.process.factory import BuildFactory
from buildbot.steps.source.git import Git
from buildbot.steps.package.deb.pbuilder import DebCowbuilder
from buildbot.steps.package.deb.lintian import DebLintian
from buildbot.steps.shell import ShellCommand, SetPropertyFromCommand
from buildbot.process.properties import WithProperties, Property, Interpolate
from buildbot.steps.slave import RemoveDirectory
from buildbot.config import BuilderConfig
from buildbot.status import words
import BuildbotStatusShields as shields
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), 'buildbot-config'))
from archeos_secret import slave_cred
from archeos_repos import all_repos as repos
from archeos_sources import sources
from archeos_auth import all_auth
# END IMPORT
build_area = "/home/builder/build-area/autobuild"
c = BuildmasterConfig = {}
# MISC
c['title'] = "ArcheOS builder"
c['titleURL'] = "http://www.archeos.eu"
c['buildbotURL'] = "http://build.archeos.it/"
c['db'] = {'db_url' : "sqlite:///state.sqlite"}
c['protocols'] = {'pb': {'port': 9989}}
# END MISC
# SLAVES
c['slaves'] = []
for slave in slave_cred:
c['slaves'].append(BuildSlave(slave[0], slave[1]))
# END SLAVES
# CHANGESOURCES
c['change_source'] = []
for source in sources:
c['change_source'].append(source)
# END CHANGESOURCES
# SCHEDULERS
c['schedulers'] = []
for p in repos.keys():
names = []
names.append(p)
# This is for all projects, on branch master
c['schedulers'].append(SingleBranchScheduler(
name=p,
change_filter=filter.ChangeFilter(project=p,branch='master'),
builderNames=names)
)
c['schedulers'].append(ForceScheduler(
name=p+'-force',
builderNames=names))
# FACTORIES
### COMMON STEPS
class NecessaryCommand(ShellCommand):
def __init__(self, **kw):
if 'description' not in kw and 'name' in kw:
kw['description'] = kw['name']
ShellCommand.__init__(self, **kw)
haltOnFailure = True
class GitBuildPackage(NecessaryCommand):
'''
Builds a debian package with git-buildpackage
Mandatory:
arch: Architecture (i386, amd64)
package: the package name
Example:
GitBuildPackage(package='archeos-test',arch='amd64')
'''
def __init__(self, **kw):
if 'arch' not in kw:
# build for all packages
# not tested
kw['arch'] = ['amd64', 'i386']
NecessaryCommand.__init__(self, **kw)
self.name = kw.get('name', "gbp_" + kw['arch'])
self.description = kw.get('description', "GitBuildPackage {0} for {1}".format(kw['package'], kw['arch']))
distribution = kw.get('distribution', 'jessie')
git_arch = "--git-dist={0}".format(distribution)
git_export_dir = "--git-export-dir={0}/{1}".format(build_area, kw['package'])
git_dist = "--git-dist={0}".format(distribution)
git_builder = "--git-pbuiler"
git_upstream_tree = "--git-upstream-tree=master"
self.command = ['git-buildpackage',
git_arch,
git_builder,
git_upstream_tree,
git_dist,
git_export_dir]
def run(self):
NecessaryCommand(name=name,description=description,command=command)
def gbp(arch=None,package=None,distribution='jessie'):
'''
Simple Helper
'''
name = "gbp_" + arch
description = "GBP {0} for {1}".format(package, arch)
git_arch = "--git-arch={0}".format(arch)
distribution = "--git-dist={0}".format(distribution)
export_dir = "--git-export-dir={0}/{1}".format(build_area, package)
upstream_tree = "--git-upstream-tree=master"
s = NecessaryCommand(name=name,
haltOnFailure=True,
description=description,
command=['git-buildpackage',
git_arch,
'--git-pbuilder',
upstream_tree,
distribution,
export_dir])
return s
def common_package_steps(factory, package_name):
'''
Common package steps
'''
factory.addStep(gbp(arch='amd64',package=package_name))
factory.addStep(SetPropertyFromCommand(command="ls {0}/{1}/*.changes".format(build_area, package_name),
property="deb-changes"))
factory.addStep(DebLintian(fileloc=Interpolate("%(prop:deb-changes)s"),
suppressTags=['bad-distribution-in-changes-file']))
factory.addStep(RemoveDirectory(dir=build_area + "/" + package_name))
factory.addStep(gbp(arch='i386',package=package_name))
factory.addStep(SetPropertyFromCommand(command="ls {0}/{1}/*.changes".format(build_area, package_name),
property="deb-changes"))
factory.addStep(DebLintian(fileloc=Interpolate("%(prop:deb-changes)s"),
suppressTags=['bad-distribution-in-changes-file']))
factory.addStep(RemoveDirectory(dir=build_area + "/" + package_name))
### END COMMON STEP
# TEST
def new_steps(factory, package_name):
factory.addStep(GitBuildPackage(arch='i386', package=package_name))
factory.addStep(SetPropertyFromCommand(command="ls {0}/{1}/*.changes".format(build_area, package_name),
property="deb-changes"))
factory.addStep(DebLintian(fileloc=Interpolate("%(prop:deb-changes)s"),
suppressTags=['bad-distribution-in-changes-file']))
factory.addStep(RemoveDirectory(dir=build_area + "/" + package_name))
# END TEST
# STARTING FACTORIES DEFINITIONS
factory = {}
p='archeos-meta'
factory[p]= BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/archeos-meta.git',
mode='full'))
common_package_steps(factory=factory[p], package_name=p)
p='archeos-manual'
factory[p]= BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/archeos-manual.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='archeos-desktop-base'
factory[p]= BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/archeos-desktop-base.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='cloudcompare-archeos'
factory[p] = BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/cloudcompare-archeos.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='micmac-archeos'
factory[p] = BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/micmac-archeos.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='archeos-keyring'
factory[p] = BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/archeos-keyring.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='archeos-menu'
factory[p] = BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/archeos-menu.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='totalopenstation'
factory[p] = BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/totalopenstation.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
p='archeos-apt-setup'
factory[p] = BuildFactory()
factory[p].workdir=p
factory[p].addStep(Git(repourl='git://github.com/archeos/archeos-apt-setup.git',
mode='full'))
common_package_steps(factory=factory[p],package_name=p)
# END FACTORIES
# START BUILDERS
c['builders'] = []
for p in repos.keys():
for slave in slave_cred:
c['builders'].append(
BuilderConfig(name=p,
slavenames=slave[0],
factory=factory[p]))
####### STATUS TARGETS
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
c['status'] = []
for auth in all_auth:
c['status'].append(shields.bind(auth))
c['status'].append(words.IRC(host="irc.freenode.org",
nick="archeos-buildbot",
channels=["#archeos"],
notify_events={
'exception': 1,
'success': 1,
'failure': 1}))