[154410] contrib/buildbot-test/master.cfg
larryv at macports.org
larryv at macports.org
Sat Oct 29 02:29:11 CEST 2016
Revision: 154410
https://trac.macports.org/changeset/154410
Author: larryv at macports.org
Date: 2016-10-29 02:29:10 +0200 (Sat, 29 Oct 2016)
Log Message:
-----------
buildbot: Attempt to standardize formatting
Mostly taken from PEP 8 (https://www.python.org/dev/peps/pep-0008), with
some additional arbitrary choices to impose some consistency.
- Use typical Python whitespacing
(https://www.python.org/dev/peps/pep-0008/#id26).
- Avoid multiline collections where feasible. Otherwise, put the closing
brace/bracket on its own line, aligned with the last element. (This
looks more like typical Python indenting and less like C or JSON.)
- When calls span multiple lines, place the closing parenthesis at the
end of the final line.
- Remove unnecessary parentheses.
- Prefer hanging indents, especially for calls with many arguments.
- Indent continuation lines and hanging indents one level when possible.
- Sundry tweaks to comments.
Modified Paths:
--------------
contrib/buildbot-test/master.cfg
Modified: contrib/buildbot-test/master.cfg
===================================================================
--- contrib/buildbot-test/master.cfg 2016-10-28 23:04:18 UTC (rev 154409)
+++ contrib/buildbot-test/master.cfg 2016-10-29 00:29:10 UTC (rev 154410)
@@ -2,10 +2,15 @@
# ex: set syntax=python:
# vim:ft=python
+# This is a buildmaster config file. It must be installed as
+# 'master.cfg' in your buildmaster's base directory.
+
import json
import os
import re
+####### HELPER FUNCTIONS #######
+
def _path(name):
return os.path.join(os.path.dirname(__file__), name)
@@ -15,8 +20,6 @@
res.update(d)
return res
-# This is a buildmaster config file. It must be installed as
-# 'master.cfg' in your buildmaster's base directory.
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
@@ -27,19 +30,19 @@
# it has to be)
config = {
- 'production': False,
- 'privkey': '',
- 'slaveport': 9989,
- 'httpport': 8010,
- 'buildboturl': 'http://localhost:8010/',
+ 'production': False,
+ 'privkey': '',
+ 'slaveport': 9989,
+ 'httpport': 8010,
+ 'buildboturl': 'http://localhost:8010/',
'htpasswdfile': 'htpasswd',
- 'mpbbsvnurl': 'https://svn.macports.org/repository/macports/contrib/mp-buildbot',
- 'svnurl': 'https://svn.macports.org/repository/macports/trunk',
- 'archivesite': 'https://packages.macports.org',
- 'slaveprefix': '/opt/local',
- 'toolsprefix': '/opt/mports',
+ 'mpbbsvnurl': 'https://svn.macports.org/repository/macports/contrib/mp-buildbot',
+ 'svnurl': 'https://svn.macports.org/repository/macports/trunk',
+ 'archivesite': 'https://packages.macports.org',
+ 'slaveprefix': '/opt/local',
+ 'toolsprefix': '/opt/mports',
'deploy': {}
-}
+ }
if os.path.exists(_path('config.json')):
with open(_path('config.json')) as f:
@@ -46,18 +49,17 @@
configdata = json.load(f)
config.update(configdata)
-path_base = '/usr/bin:/bin:/usr/sbin:/sbin'
+path_base = '/usr/bin:/bin:/usr/sbin:/sbin'
path_ports = os.path.join(config['toolsprefix'], 'bin') + ':' + path_base
path_docs = path_ports
# Allow spaces and tabs in property values
import re
-c['validation'] = {
- 'property_value': re.compile(r'^[ \t\w./~:-]*$')
-}
+c['validation'] = {'property_value': re.compile(r'^[ \t\w./~:-]*$')}
-####### BUILDSLAVES
+####### BUILDSLAVES #######
+
# The 'slaves' list defines the set of recognized buildslaves. Each element is
# a BuildSlave object, specifying a unique slave name and password. The same
# slave name and password must be configured on the slave.
@@ -75,14 +77,14 @@
for slave, pwd in slavedata['slaves'].items():
c['slaves'].append(BuildSlave(slave, pwd))
-
# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
# This must match the value configured into the buildslaves (with their
# --master option)
c['slavePortnum'] = config['slaveport']
-####### CHANGESOURCES
+####### CHANGESOURCES #######
+
# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes.
@@ -98,14 +100,14 @@
# c['change_source'] = PBChangeSource(user=sourcedata[0], passwd=sourcedata[1], port=sourcedata[2])
else:
from buildbot.changes.svnpoller import SVNPoller
- c['change_source'] = (SVNPoller(
+ c['change_source'] = SVNPoller(
svnurl='https://svn.macports.org/repository/macports/trunk',
#svnbin='/opt/local/bin/svn',
pollinterval=300,
category='macports',
- project='ports'))
+ project='ports')
-####### SCHEDULERS
+####### SCHEDULERS #######
def change_has_ports(change):
for f in change.files:
@@ -155,12 +157,12 @@
SingleBranchScheduler(
name='base',
treeStableTimer=None,
- change_filter = basefilter,
+ change_filter=basefilter,
builderNames=base_buildernames),
SingleBranchScheduler(
name='ports',
treeStableTimer=None,
- change_filter = portsfilter,
+ change_filter=portsfilter,
builderNames=portwatcher_buildernames),
ForceScheduler(
name='base_force',
@@ -182,8 +184,7 @@
label='Port list:',
default='',
size=30,
- required=True)
- ])
+ required=True)])
]
@@ -190,32 +191,36 @@
if 'www' in config['deploy']:
c['schedulers'] += [
SingleBranchScheduler(
- name='www',
- treeStableTimer=300,
- change_filter = wwwfilter,
- builderNames=['docs-www']),
+ name='www',
+ treeStableTimer=300,
+ change_filter=wwwfilter,
+ builderNames=['docs-www']),
ForceScheduler(
name='www_force',
- builderNames=['docs-www'])]
+ builderNames=['docs-www'])
+ ]
if 'guide' in config['deploy']:
c['schedulers'] += [
SingleBranchScheduler(
- name='guide',
- treeStableTimer=300,
- change_filter = guidefilter,
- builderNames=['docs-guide']),
+ name='guide',
+ treeStableTimer=300,
+ change_filter=guidefilter,
+ builderNames=['docs-guide']),
ForceScheduler(
name='guide_force',
- builderNames=['docs-www'])]
+ builderNames=['docs-www'])
+ ]
for i in range(len(portbuilder_buildernames)):
- c['schedulers'].append(Triggerable(
- name=portbuilder_triggerables[i],
- builderNames=[portbuilder_buildernames[i]]))
+ c['schedulers'].append(
+ Triggerable(
+ name=portbuilder_triggerables[i],
+ builderNames=[portbuilder_buildernames[i]]))
-####### BUILDERS
+####### BUILDERS #######
+
# WARNING: mergeRequests has to be False or Triggerable builds will not be scheduled correctly!
c['mergeRequests'] = False
@@ -287,20 +292,19 @@
# let ShellCommand describe
return ShellCommand.getText(self, cmd, results)
-
# can't run with prefix inside the workdir in production,
# because archives must be built with prefix=/opt/local
if config['production']:
- prefix='/opt/local'
- dlhost='packages at packages-origin.macports.org'
- dlpath='/var/www/html/packages'
+ prefix = '/opt/local'
+ dlhost = 'packages at packages-origin.macports.org'
+ dlpath = '/var/www/html/packages'
else:
- prefix=config['slaveprefix']
- dlhost=''
- dlpath='./deployed_archives'
+ prefix = config['slaveprefix']
+ dlhost = ''
+ dlpath = './deployed_archives'
-ulpath='archive_staging'
-ulpath_unique=ulpath+'-%(buildername)s'
+ulpath = 'archive_staging'
+ulpath_unique = ulpath+'-%(buildername)s'
from buildbot.steps.transfer import FileDownload, DirectoryUpload
from buildbot.steps.master import MasterShellCommand
@@ -426,11 +430,9 @@
name='install-port',
description=['installing', WithProperties('%(portname)s')],
descriptionDone=['install', WithProperties('%(portname)s')],
- logfiles={
- 'files': os.path.join(logdir, 'port-contents.txt'),
- 'statistics': os.path.join(logdir, 'port-statistics.txt'),
- 'main.log': os.path.join(logdir, 'main.log')
- },
+ logfiles={'files': os.path.join(logdir, 'port-contents.txt'),
+ 'statistics': os.path.join(logdir, 'port-statistics.txt'),
+ 'main.log': os.path.join(logdir, 'main.log')},
haltOnFailure=True))
portbuilder_factory.addStep(ShellCommand(
@@ -448,13 +450,12 @@
# XXX: move deploy_archives.sh functionality to mp-buildbot
# sign generated binaries and sync to download server (if distributable)
if config['production']:
- portbuilder_factory.addStep(MasterShellCommand(command=['./deploy_archives.sh', WithProperties(ulpath_unique)],
- name='deploy-archives',
- description=['deploying', 'archives'],
- descriptionDone=['deploy', 'archives'],
- env={'PRIVKEY': config['privkey'],
- 'DLHOST': dlhost,
- 'DLPATH': dlpath}))
+ portbuilder_factory.addStep(MasterShellCommand(
+ command=['./deploy_archives.sh', WithProperties(ulpath_unique)],
+ name='deploy-archives',
+ description=['deploying', 'archives'],
+ descriptionDone=['deploy', 'archives'],
+ env={'PRIVKEY': config['privkey'], 'DLHOST': dlhost, 'DLPATH': dlpath}))
# TODO: do we want to upload the individual logs so maintainers can review them?
portbuilder_factory.addStep(ShellCommand(
@@ -464,27 +465,29 @@
descriptionDone=['clean'],
alwaysRun=True))
-
def make_rsync_deploy_steps(host, user, sshkeyfile, sshknownhostsfile, srcpath, destpath):
return [
- FileDownload(name='ssh key',
- description='transferring',
- descriptionDone='transfer',
- mastersrc=sshkeyfile,
- slavedest='ssh_key',
- mode=0600),
- FileDownload(name='ssh known_hosts',
- description='transferring',
- descriptionDone='transfer',
- mastersrc=sshknownhostsfile,
- slavedest='ssh_known_hosts',
- mode=0600),
- ShellCommand(name='rsync',
- description='deploying',
- descriptionDone='deploy',
- command='rsync -avzhC --delay-updates --delete-delay %s/ %s@%s:%s/' % (srcpath, user, host, destpath),
- env={'RSYNC_RSH': 'ssh -i ssh_key -oUserKnownHostsFile=ssh_known_hosts'})
- ]
+ FileDownload(
+ name='ssh key',
+ description='transferring',
+ descriptionDone='transfer',
+ mastersrc=sshkeyfile,
+ slavedest='ssh_key',
+ mode=0600),
+ FileDownload(
+ name='ssh known_hosts',
+ description='transferring',
+ descriptionDone='transfer',
+ mastersrc=sshknownhostsfile,
+ slavedest='ssh_known_hosts',
+ mode=0600),
+ ShellCommand(
+ name='rsync',
+ description='deploying',
+ descriptionDone='deploy',
+ command='rsync -avzhC --delay-updates --delete-delay %s/ %s@%s:%s/' % (srcpath, user, host, destpath),
+ env={'RSYNC_RSH': 'ssh -i ssh_key -oUserKnownHostsFile=ssh_known_hosts'})
+ ]
if 'www' in config['deploy']:
docs_www_factory = BuildFactory()
@@ -532,7 +535,7 @@
destpath=config['deploy']['guide']['destpath']))
-# === BUILDER CONFIGURATION ===
+####### BUILDER CONFIGURATION #######
from buildbot.config import BuilderConfig
@@ -548,9 +551,9 @@
'BUILDBOT_BUILDERNAME': WithProperties('%(buildername)s'),
'BUILDBOT_BUILDNUMBER': WithProperties('%(buildnumber)s'),
'BUILDBOT_BUILDURL': make_build_url
-}
+ }
-c['builders']=[]
+c['builders'] = []
extract_os = re.compile(r'10\.\d+')
for plat in build_platforms:
os_match = extract_os.search(plat)
@@ -562,7 +565,8 @@
slavenames=['base-' + plat],
factory=base_factory,
tags=['base', os_version],
- env=merge_dicts(env_buildinfo, {'PATH': path_base}))]
+ env=merge_dicts(env_buildinfo, {'PATH': path_base}))
+ ]
if 'linux' not in plat and '10.5_ppc' != plat:
c['builders'] += [
BuilderConfig(
@@ -576,7 +580,8 @@
slavenames=['ports-' + plat],
factory=portbuilder_factory,
tags=['portbuilder', os_version],
- env=merge_dicts(env_buildinfo, {'PATH': path_ports}))]
+ env=merge_dicts(env_buildinfo, {'PATH': path_ports}))
+ ]
if 'www' in config['deploy']:
c['builders'].append(
@@ -595,8 +600,9 @@
tags=['docs', 'guide'],
env=merge_dicts(env_buildinfo, {'PATH': path_ports})))
-####### STATUS TARGETS
+####### 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.
@@ -610,16 +616,15 @@
htauth = HTPasswdAprAuth(config['htpasswdfile'])
-authz_cfg=authz.Authz(
- auth = htauth,
- gracefulShutdown = 'auth',
- forceBuild = 'auth',
- forceAllBuilds = 'auth',
- pingBuilder = 'auth',
- stopBuild = 'auth',
- stopAllBuilds = 'auth',
- cancelPendingBuild = 'auth',
-)
+authz_cfg = authz.Authz(
+ auth=htauth,
+ gracefulShutdown='auth',
+ forceBuild='auth',
+ forceAllBuilds='auth',
+ pingBuilder='auth',
+ stopBuild='auth',
+ stopAllBuilds='auth',
+ cancelPendingBuild='auth')
from buildbot.status.mail import MailNotifier
from twisted.internet import defer
@@ -681,8 +686,8 @@
# same as original, but calls portMessageFormatter with access to interested_users
def buildMessageDict(self, name, build, results):
self.interested_users.clear()
- msgdict = self.portMessageFormatter(self.mode, name, build, results,
- self.master_status, self.interested_users)
+ msgdict = self.portMessageFormatter(
+ self.mode, name, build, results, self.master_status, self.interested_users)
return msgdict
def useLookup(self, build):
@@ -765,11 +770,7 @@
subject += ', '.join(sorted(failed_ports)[:10])
if len(failed_ports) > 10:
subject += ', and {} more'.format(len(failed_ports) - 10)
- return {
- 'body' : '\n'.join(text),
- 'type' : 'plain',
- 'subject' : subject
- }
+ return {'body': '\n'.join(text), 'type': 'plain', 'subject': subject}
if config['production']:
# send mail about base failures to users on the blamelist
@@ -809,7 +810,7 @@
sendToInterestedUsers=False)
c['status'].append(mn)
-####### PROJECT IDENTITY
+####### PROJECT IDENTITY #######
from buildbot.plugins import util
@@ -824,24 +825,21 @@
c['status'].append(html.WebStatus(
http_port=config['httpport'],
authz=authz_cfg,
- changecommentlink=(r'#(\d+)', r'https://trac.macports.org/ticket/\1', r'Ticket \g<0>')
-))
+ changecommentlink=(r'#(\d+)', r'https://trac.macports.org/ticket/\1', r'Ticket \g<0>')))
c['revlink'] = util.RevlinkMatch([r'https://svn.macports.org/repository/macports/(.*)'],
r'https://trac.macports.org/changeset/%s')
-####### DB URL
+####### DATABASE #######
-c['db'] = {
- # This specifies what database buildbot uses to store its state. You can leave
- # this at its default for all but the largest installations.
- 'db_url' : 'sqlite:///state.sqlite',
-}
+# This specifies what database buildbot uses to store its state. You can
+# leave this at its default for all but the largest installations.
+c['db'] = {'db_url': 'sqlite:///state.sqlite'}
-######## Cache settings
-c['buildHorizon'] = 10000
-c['logHorizon'] = 5000
-c['eventHorizon'] = 2000
-c['buildCacheSize'] = 600
+####### DATA LIFETIME #######
+c['buildHorizon'] = 10000
+c['logHorizon'] = 5000
+c['eventHorizon'] = 2000
+c['buildCacheSize'] = 600
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-changes/attachments/20161029/57fa1364/attachment-0002.html>
More information about the macports-changes
mailing list