global: calculate suitable number of jobs
[buildbot.git] / phase1 / master.cfg
1 # -*- python -*-
2 # ex: set syntax=python:
3
4 import os
5 import re
6 import subprocess
7 import ConfigParser
8
9 from buildbot import locks
10
11 # This is a sample buildmaster config file. It must be installed as
12 # 'master.cfg' in your buildmaster's base directory.
13
14 ini = ConfigParser.ConfigParser()
15 ini.read("./config.ini")
16
17 # This is the dictionary that the buildmaster pays attention to. We also use
18 # a shorter alias to save typing.
19 c = BuildmasterConfig = {}
20
21 ####### BUILDSLAVES
22
23 # The 'slaves' list defines the set of recognized buildslaves. Each element is
24 # a BuildSlave object, specifying a unique slave name and password. The same
25 # slave name and password must be configured on the slave.
26 from buildbot.buildslave import BuildSlave
27
28 slave_port = 9989
29
30 if ini.has_option("general", "port"):
31 slave_port = ini.getint("general", "port")
32
33 c['slaves'] = []
34 max_builds = dict()
35
36 for section in ini.sections():
37 if section.startswith("slave "):
38 if ini.has_option(section, "name") and ini.has_option(section, "password"):
39 name = ini.get(section, "name")
40 password = ini.get(section, "password")
41 max_builds[name] = 1
42 if ini.has_option(section, "builds"):
43 max_builds[name] = ini.getint(section, "builds")
44 c['slaves'].append(BuildSlave(name, password, max_builds = max_builds[name]))
45
46 # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
47 # This must match the value configured into the buildslaves (with their
48 # --master option)
49 c['slavePortnum'] = slave_port
50
51 # coalesce builds
52 c['mergeRequests'] = True
53
54 ####### CHANGESOURCES
55
56 home_dir = os.path.abspath(ini.get("general", "homedir"))
57 tree_expire = 0
58 other_builds = 0
59
60 if ini.has_option("general", "expire"):
61 tree_expire = ini.getint("general", "expire")
62
63 if ini.has_option("general", "other_builds"):
64 other_builds = ini.getint("general", "other_builds")
65
66 repo_url = ini.get("repo", "url")
67 repo_branch = "master"
68
69 if ini.has_option("repo", "branch"):
70 repo_branch = ini.get("repo", "branch")
71
72 rsync_bin_url = ini.get("rsync", "binary_url")
73 rsync_bin_key = ini.get("rsync", "binary_password")
74
75 rsync_src_url = None
76 rsync_src_key = None
77
78 if ini.has_option("rsync", "source_url"):
79 rsync_src_url = ini.get("rsync", "source_url")
80 rsync_src_key = ini.get("rsync", "source_password")
81
82 gpg_home = "~/.gnupg"
83 gpg_keyid = None
84 gpg_comment = "Unattended build signature"
85 gpg_passfile = "/dev/null"
86
87 if ini.has_option("gpg", "home"):
88 gpg_home = ini.get("gpg", "home")
89
90 if ini.has_option("gpg", "keyid"):
91 gpg_keyid = ini.get("gpg", "keyid")
92
93 if ini.has_option("gpg", "comment"):
94 gpg_comment = ini.get("gpg", "comment")
95
96 if ini.has_option("gpg", "passfile"):
97 gpg_passfile = ini.get("gpg", "passfile")
98
99
100 # find targets
101 targets = [ ]
102
103 if not os.path.isdir(home_dir+'/source.git'):
104 subprocess.call(["git", "clone", "--depth=1", "--branch="+repo_branch, repo_url, home_dir+'/source.git'])
105 else:
106 subprocess.call(["git", "pull"], cwd = home_dir+'/source.git')
107
108 findtargets = subprocess.Popen([home_dir+'/dumpinfo.pl', 'targets'],
109 stdout = subprocess.PIPE, cwd = home_dir+'/source.git')
110
111 while True:
112 line = findtargets.stdout.readline()
113 if not line:
114 break
115 ta = line.strip().split(' ')
116 targets.append(ta[0])
117
118
119 # the 'change_source' setting tells the buildmaster how it should find out
120 # about source code changes. Here we point to the buildbot clone of pyflakes.
121
122 from buildbot.changes.gitpoller import GitPoller
123 c['change_source'] = []
124 c['change_source'].append(GitPoller(
125 repo_url,
126 workdir=home_dir+'/work.git', branch=repo_branch,
127 pollinterval=300))
128
129 ####### SCHEDULERS
130
131 # Configure the Schedulers, which decide how to react to incoming changes. In this
132 # case, just kick off a 'basebuild' build
133
134 from buildbot.schedulers.basic import SingleBranchScheduler
135 from buildbot.schedulers.forcesched import ForceScheduler
136 from buildbot.changes import filter
137 c['schedulers'] = []
138 c['schedulers'].append(SingleBranchScheduler(
139 name="all",
140 change_filter=filter.ChangeFilter(branch=repo_branch),
141 treeStableTimer=60,
142 builderNames=targets))
143
144 c['schedulers'].append(ForceScheduler(
145 name="force",
146 builderNames=targets))
147
148 ####### BUILDERS
149
150 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
151 # what steps, and which slaves can execute them. Note that any particular build will
152 # only take place on one slave.
153
154 from buildbot.process.factory import BuildFactory
155 from buildbot.steps.source.git import Git
156 from buildbot.steps.shell import ShellCommand
157 from buildbot.steps.shell import SetProperty
158 from buildbot.steps.transfer import FileUpload
159 from buildbot.steps.transfer import FileDownload
160 from buildbot.steps.master import MasterShellCommand
161 from buildbot.process.properties import WithProperties
162
163
164 CleanTargetMap = [
165 [ "tools", "tools/clean" ],
166 [ "chain", "toolchain/clean" ],
167 [ "linux", "target/linux/clean" ],
168 [ "dir", "dirclean" ],
169 [ "dist", "distclean" ]
170 ]
171
172 def IsCleanRequested(pattern):
173 def CheckCleanProperty(step):
174 val = step.getProperty("clean")
175 if val and re.match(pattern, val):
176 return True
177 else:
178 return False
179
180 return CheckCleanProperty
181
182 def IsTaggingRequested(step):
183 val = step.getProperty("tag")
184 if val and re.match("^[0-9]+\.[0-9]+\.[0-9]+$", val):
185 return True
186 else:
187 return False
188
189 def IsNoTaggingRequested(step):
190 return not IsTaggingRequested(step)
191
192 def IsNoMasterBuild(step):
193 return repo_branch != "master"
194
195 def GetBaseVersion(props):
196 if re.match("^[^-]+-[0-9]+\.[0-9]+$", repo_branch):
197 return repo_branch.split('-')[1]
198 else:
199 return "master"
200
201 def GetVersionPrefix(props):
202 basever = GetBaseVersion(props)
203 if props.hasProperty("tag") and re.match("^[0-9]+\.[0-9]+\.[0-9]+$", props["tag"]):
204 return "%s/" % props["tag"]
205 elif basever != "master":
206 return "%s-SNAPSHOT/" % basever
207 else:
208 return ""
209
210 def GetNumJobs(props):
211 if props.hasProperty("slavename") and props.hasProperty("nproc"):
212 return ((int(props["nproc"]) / (max_builds[props["slavename"]] + other_builds)) + 1)
213 else:
214 return 1
215
216
217 c['builders'] = []
218
219 dlLock = locks.SlaveLock("slave_dl")
220 tagLock = locks.MasterLock("make_tag")
221
222 checkBuiltin = re.sub('[\t\n ]+', ' ', """
223 checkBuiltin() {
224 local symbol op path file;
225 for file in $CHANGED_FILES; do
226 case "$file" in
227 package/*/*) : ;;
228 *) return 0 ;;
229 esac;
230 done;
231 while read symbol op path; do
232 case "$symbol" in package-*)
233 symbol="${symbol##*(}";
234 symbol="${symbol%)}";
235 for file in $CHANGED_FILES; do
236 case "$file" in "package/$path/"*)
237 grep -qsx "$symbol=y" .config && return 0
238 ;; esac;
239 done;
240 esac;
241 done < tmp/.packagedeps;
242 return 1;
243 }
244 """).strip()
245
246
247 class IfBuiltinShellCommand(ShellCommand):
248 def _quote(self, str):
249 if re.search("[^a-zA-Z0-9/_.-]", str):
250 return "'%s'" %(re.sub("'", "'\"'\"'", str))
251 return str
252
253 def setCommand(self, command):
254 if not isinstance(command, (str, unicode)):
255 command = ' '.join(map(self._quote, command))
256 self.command = [
257 '/bin/sh', '-c',
258 '%s; if checkBuiltin; then %s; else exit 0; fi' %(checkBuiltin, command)
259 ]
260
261 def setupEnvironment(self, cmd):
262 slaveEnv = self.slaveEnvironment
263 if slaveEnv is None:
264 slaveEnv = { }
265 changedFiles = { }
266 for request in self.build.requests:
267 for source in request.sources:
268 for change in source.changes:
269 for file in change.files:
270 changedFiles[file] = True
271 fullSlaveEnv = slaveEnv.copy()
272 fullSlaveEnv['CHANGED_FILES'] = ' '.join(changedFiles.keys())
273 cmd.args['env'] = fullSlaveEnv
274
275 slaveNames = [ ]
276
277 for slave in c['slaves']:
278 slaveNames.append(slave.slavename)
279
280 for target in targets:
281 ts = target.split('/')
282
283 factory = BuildFactory()
284
285 # find number of cores
286 factory.addStep(SetProperty(
287 name = "nproc",
288 property = "nproc",
289 description = "Finding number of CPUs",
290 command = ["nproc"]))
291
292 # expire tree if needed
293 if tree_expire > 0:
294 factory.addStep(FileDownload(
295 mastersrc = "expire.sh",
296 slavedest = "../expire.sh",
297 mode = 0755))
298
299 factory.addStep(ShellCommand(
300 name = "expire",
301 description = "Checking for build tree expiry",
302 command = ["./expire.sh", str(tree_expire)],
303 workdir = ".",
304 haltOnFailure = True,
305 timeout = 2400))
306
307 # user-requested clean targets
308 for tuple in CleanTargetMap:
309 factory.addStep(ShellCommand(
310 name = tuple[1],
311 description = 'User-requested "make %s"' % tuple[1],
312 command = ["make", tuple[1], "V=s"],
313 doStepIf = IsCleanRequested(tuple[0])
314 ))
315
316 factory.addStep(MasterShellCommand(
317 name = "maketag",
318 description = "Tagging Git repository",
319 command = [home_dir+'/maketag.sh', '-i', '-k', str(gpg_keyid or ''),
320 '-p', str(gpg_passfile or ''), '-v', WithProperties("%(tag:-)s")],
321 path = home_dir+'/source.git',
322 env = {'GNUPGHOME': gpg_home},
323 haltOnFailure = True,
324 doStepIf = IsTaggingRequested,
325 locks = [tagLock.access('exclusive')]
326 ))
327
328 # switch to branch
329 factory.addStep(ShellCommand(
330 name = "switchbranch",
331 description = "Checking out Git branch",
332 command = "if [ -d .git ]; then git checkout '%s'; else exit 0; fi" % repo_branch,
333 haltOnFailure = True,
334 doStepIf = IsNoTaggingRequested
335 ))
336
337 # check out the source
338 factory.addStep(Git(
339 repourl = repo_url,
340 branch = repo_branch,
341 mode = 'incremental',
342 method = 'clean'))
343
344 # update remote refs
345 factory.addStep(ShellCommand(
346 name = "fetchrefs",
347 description = "Fetching Git remote refs",
348 command = ["git", "fetch", "origin", "+refs/heads/%s:refs/remotes/origin/%s" %(repo_branch, repo_branch)],
349 haltOnFailure = True
350 ))
351
352 # fetch tags
353 factory.addStep(ShellCommand(
354 name = "fetchtag",
355 description = "Fetching Git tags",
356 command = ["git", "fetch", "--tags", "--", repo_url],
357 haltOnFailure = True,
358 doStepIf = IsTaggingRequested
359 ))
360
361 # switch to tag
362 factory.addStep(ShellCommand(
363 name = "switchtag",
364 description = "Checking out Git tag",
365 command = ["git", "checkout", WithProperties("tags/v%(tag:-)s")],
366 haltOnFailure = True,
367 doStepIf = IsTaggingRequested
368 ))
369
370 factory.addStep(ShellCommand(
371 name = "rmtmp",
372 description = "Remove tmp folder",
373 command=["rm", "-rf", "tmp/"]))
374
375 # feed
376 # factory.addStep(ShellCommand(
377 # name = "feedsconf",
378 # description = "Copy the feeds.conf",
379 # command='''cp ~/feeds.conf ./feeds.conf''' ))
380
381 # feed
382 factory.addStep(ShellCommand(
383 name = "rmfeedlinks",
384 description = "Remove feed symlinks",
385 command=["rm", "-rf", "package/feeds/"]))
386
387 # feed
388 factory.addStep(ShellCommand(
389 name = "updatefeeds",
390 description = "Updating feeds",
391 command=["./scripts/feeds", "update"]))
392
393 # feed
394 factory.addStep(ShellCommand(
395 name = "installfeeds",
396 description = "Installing feeds",
397 command=["./scripts/feeds", "install", "-a"]))
398
399 # seed config
400 factory.addStep(FileDownload(
401 mastersrc = "config.seed",
402 slavedest = ".config",
403 mode = 0644
404 ))
405
406 # configure
407 factory.addStep(ShellCommand(
408 name = "newconfig",
409 description = "Seeding .config",
410 command = "printf 'CONFIG_TARGET_%s=y\\nCONFIG_TARGET_%s_%s=y\\n' >> .config" %(ts[0], ts[0], ts[1])
411 ))
412
413 factory.addStep(ShellCommand(
414 name = "delbin",
415 description = "Removing output directory",
416 command = ["rm", "-rf", "bin/"]
417 ))
418
419 factory.addStep(ShellCommand(
420 name = "defconfig",
421 description = "Populating .config",
422 command = ["make", "defconfig"]
423 ))
424
425 # check arch
426 factory.addStep(ShellCommand(
427 name = "checkarch",
428 description = "Checking architecture",
429 command = ["grep", "-sq", "CONFIG_TARGET_%s=y" %(ts[0]), ".config"],
430 logEnviron = False,
431 want_stdout = False,
432 want_stderr = False,
433 haltOnFailure = True
434 ))
435
436 # find libc suffix
437 factory.addStep(SetProperty(
438 name = "libc",
439 property = "libc",
440 description = "Finding libc suffix",
441 command = ["sed", "-ne", '/^CONFIG_LIBC=/ { s!^CONFIG_LIBC="\\(.*\\)"!\\1!; s!^musl$!!; s!.\\+!-&!p }', ".config"]))
442
443 # install build key
444 factory.addStep(FileDownload(mastersrc=home_dir+'/key-build', slavedest="key-build", mode=0600))
445 factory.addStep(FileDownload(mastersrc=home_dir+'/key-build.pub', slavedest="key-build.pub", mode=0600))
446
447 # prepare dl
448 factory.addStep(ShellCommand(
449 name = "dldir",
450 description = "Preparing dl/",
451 command = "mkdir -p $HOME/dl && rm -rf ./dl && ln -sf $HOME/dl ./dl",
452 logEnviron = False,
453 want_stdout = False
454 ))
455
456 # prepare tar
457 factory.addStep(ShellCommand(
458 name = "dltar",
459 description = "Building GNU tar",
460 command = ["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "tools/tar/install", "V=s"],
461 haltOnFailure = True
462 ))
463
464 # populate dl
465 factory.addStep(ShellCommand(
466 name = "dlrun",
467 description = "Populating dl/",
468 command = ["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "download", "V=s"],
469 logEnviron = False,
470 locks = [dlLock.access('exclusive')]
471 ))
472
473 factory.addStep(ShellCommand(
474 name = "cleanbase",
475 description = "Cleaning base-files",
476 command=["make", "package/base-files/clean", "V=s"]
477 ))
478
479 # build
480 factory.addStep(ShellCommand(
481 name = "tools",
482 description = "Building tools",
483 command = ["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "tools/install", "V=s"],
484 haltOnFailure = True
485 ))
486
487 factory.addStep(ShellCommand(
488 name = "toolchain",
489 description = "Building toolchain",
490 command=["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "toolchain/install", "V=s"],
491 haltOnFailure = True
492 ))
493
494 factory.addStep(ShellCommand(
495 name = "kmods",
496 description = "Building kmods",
497 command=["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "target/compile", "V=s", "IGNORE_ERRORS=n m", "BUILD_LOG=1"],
498 #env={'BUILD_LOG_DIR': 'bin/%s' %(ts[0])},
499 haltOnFailure = True
500 ))
501
502 factory.addStep(ShellCommand(
503 name = "pkgbuild",
504 description = "Building packages",
505 command=["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "package/compile", "V=s", "IGNORE_ERRORS=n m", "BUILD_LOG=1"],
506 #env={'BUILD_LOG_DIR': 'bin/%s' %(ts[0])},
507 haltOnFailure = True
508 ))
509
510 # factory.addStep(IfBuiltinShellCommand(
511 factory.addStep(ShellCommand(
512 name = "pkginstall",
513 description = "Installing packages",
514 command=["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "package/install", "V=s"],
515 haltOnFailure = True
516 ))
517
518 factory.addStep(ShellCommand(
519 name = "pkgindex",
520 description = "Indexing packages",
521 command=["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "package/index", "V=s"],
522 haltOnFailure = True
523 ))
524
525 #factory.addStep(IfBuiltinShellCommand(
526 factory.addStep(ShellCommand(
527 name = "images",
528 description = "Building images",
529 command=["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "target/install", "V=s"],
530 haltOnFailure = True
531 ))
532
533 factory.addStep(ShellCommand(
534 name = "checksums",
535 description = "Calculating checksums",
536 command=["make", "-j1", "checksum", "V=s"],
537 haltOnFailure = True
538 ))
539
540 # sign
541 if gpg_keyid is not None:
542 factory.addStep(MasterShellCommand(
543 name = "signprepare",
544 description = "Preparing temporary signing directory",
545 command = ["mkdir", "-p", "%s/signing" %(home_dir)],
546 haltOnFailure = True
547 ))
548
549 factory.addStep(ShellCommand(
550 name = "signpack",
551 description = "Packing files to sign",
552 command = WithProperties("find bin/targets/%s/%s%%(libc)s/ -mindepth 1 -maxdepth 2 -type f -name sha256sums -print0 -or -name Packages -print0 | xargs -0 tar -czf sign.tar.gz" %(ts[0], ts[1])),
553 haltOnFailure = True
554 ))
555
556 factory.addStep(FileUpload(
557 slavesrc = "sign.tar.gz",
558 masterdest = "%s/signing/%s.%s.tar.gz" %(home_dir, ts[0], ts[1]),
559 haltOnFailure = True
560 ))
561
562 factory.addStep(MasterShellCommand(
563 name = "signfiles",
564 description = "Signing files",
565 command = ["%s/signall.sh" %(home_dir), "%s/signing/%s.%s.tar.gz" %(home_dir, ts[0], ts[1]), gpg_keyid, gpg_comment],
566 env = {'GNUPGHOME': gpg_home, 'PASSFILE': gpg_passfile},
567 haltOnFailure = True
568 ))
569
570 factory.addStep(FileDownload(
571 mastersrc = "%s/signing/%s.%s.tar.gz" %(home_dir, ts[0], ts[1]),
572 slavedest = "sign.tar.gz",
573 haltOnFailure = True
574 ))
575
576 factory.addStep(ShellCommand(
577 name = "signunpack",
578 description = "Unpacking signed files",
579 command = ["tar", "-xzf", "sign.tar.gz"],
580 haltOnFailure = True
581 ))
582
583 # upload
584 factory.addStep(ShellCommand(
585 name = "dirprepare",
586 description = "Preparing upload directory structure",
587 command = ["mkdir", "-p", WithProperties("tmp/upload/%%(prefix)stargets/%s/%s" %(ts[0], ts[1]), prefix=GetVersionPrefix)],
588 haltOnFailure = True
589 ))
590
591 factory.addStep(ShellCommand(
592 name = "linkprepare",
593 description = "Preparing repository symlink",
594 command = ["ln", "-s", "-f", WithProperties("../packages-%(basever)s", basever=GetBaseVersion), WithProperties("tmp/upload/%(prefix)spackages", prefix=GetVersionPrefix)],
595 doStepIf = IsNoMasterBuild,
596 haltOnFailure = True
597 ))
598
599 factory.addStep(ShellCommand(
600 name = "dirupload",
601 description = "Uploading directory structure",
602 command = ["rsync", "-avz", "tmp/upload/", "%s/" %(rsync_bin_url)],
603 env={'RSYNC_PASSWORD': rsync_bin_key},
604 haltOnFailure = True,
605 logEnviron = False
606 ))
607
608 factory.addStep(ShellCommand(
609 name = "targetupload",
610 description = "Uploading target files",
611 command=["rsync", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]),
612 "-avz", WithProperties("bin/targets/%s/%s%%(libc)s/" %(ts[0], ts[1])),
613 WithProperties("%s/%%(prefix)stargets/%s/%s/" %(rsync_bin_url, ts[0], ts[1]), prefix=GetVersionPrefix)],
614 env={'RSYNC_PASSWORD': rsync_bin_key},
615 haltOnFailure = True,
616 logEnviron = False
617 ))
618
619 if rsync_src_url is not None:
620 factory.addStep(ShellCommand(
621 name = "sourceupload",
622 description = "Uploading source archives",
623 command=["rsync", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", "dl/", "%s/" %(rsync_src_url)],
624 env={'RSYNC_PASSWORD': rsync_src_key},
625 haltOnFailure = True,
626 logEnviron = False
627 ))
628
629 if False:
630 factory.addStep(ShellCommand(
631 name = "packageupload",
632 description = "Uploading package files",
633 command=["rsync", "--delete", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", "bin/packages/", "%s/packages/" %(rsync_bin_url)],
634 env={'RSYNC_PASSWORD': rsync_bin_key},
635 haltOnFailure = False,
636 logEnviron = False
637 ))
638
639 # logs
640 if False:
641 factory.addStep(ShellCommand(
642 name = "upload",
643 description = "Uploading logs",
644 command=["rsync", "--delete", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", "logs/", "%s/logs/%s/%s/" %(rsync_bin_url, ts[0], ts[1])],
645 env={'RSYNC_PASSWORD': rsync_bin_key},
646 haltOnFailure = False,
647 alwaysRun = True,
648 logEnviron = False
649 ))
650
651 from buildbot.config import BuilderConfig
652
653 c['builders'].append(BuilderConfig(name=target, slavenames=slaveNames, factory=factory))
654
655
656 ####### STATUS TARGETS
657
658 # 'status' is a list of Status Targets. The results of each build will be
659 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
660 # including web pages, email senders, and IRC bots.
661
662 c['status'] = []
663
664 from buildbot.status import html
665 from buildbot.status.web import authz, auth
666
667 if ini.has_option("status", "bind"):
668 if ini.has_option("status", "user") and ini.has_option("status", "password"):
669 authz_cfg=authz.Authz(
670 # change any of these to True to enable; see the manual for more
671 # options
672 auth=auth.BasicAuth([(ini.get("status", "user"), ini.get("status", "password"))]),
673 gracefulShutdown = 'auth',
674 forceBuild = 'auth', # use this to test your slave once it is set up
675 forceAllBuilds = 'auth',
676 pingBuilder = False,
677 stopBuild = 'auth',
678 stopAllBuilds = 'auth',
679 cancelPendingBuild = 'auth',
680 )
681 c['status'].append(html.WebStatus(http_port=ini.get("status", "bind"), authz=authz_cfg))
682 else:
683 c['status'].append(html.WebStatus(http_port=ini.get("status", "bind")))
684
685
686 from buildbot.status import words
687
688 if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.has_option("irc", "channel"):
689 irc_host = ini.get("irc", "host")
690 irc_port = 6667
691 irc_chan = ini.get("irc", "channel")
692 irc_nick = ini.get("irc", "nickname")
693 irc_pass = None
694
695 if ini.has_option("irc", "port"):
696 irc_port = ini.getint("irc", "port")
697
698 if ini.has_option("irc", "password"):
699 irc_pass = ini.get("irc", "password")
700
701 irc = words.IRC(irc_host, irc_nick, port = irc_port, password = irc_pass,
702 channels = [{ "channel": irc_chan }],
703 notify_events = {
704 'exception': 1,
705 'successToFailure': 1,
706 'failureToSuccess': 1
707 }
708 )
709
710 c['status'].append(irc)
711
712
713 ####### PROJECT IDENTITY
714
715 # the 'title' string will appear at the top of this buildbot
716 # installation's html.WebStatus home page (linked to the
717 # 'titleURL') and is embedded in the title of the waterfall HTML page.
718
719 c['title'] = ini.get("general", "title")
720 c['titleURL'] = ini.get("general", "title_url")
721
722 # the 'buildbotURL' string should point to the location where the buildbot's
723 # internal web server (usually the html.WebStatus page) is visible. This
724 # typically uses the port number set in the Waterfall 'status' entry, but
725 # with an externally-visible host name which the buildbot cannot figure out
726 # without some help.
727
728 c['buildbotURL'] = ini.get("general", "buildbot_url")
729
730 ####### DB URL
731
732 c['db'] = {
733 # This specifies what database buildbot uses to store its state. You can leave
734 # this at its default for all but the largest installations.
735 'db_url' : "sqlite:///state.sqlite",
736 }