<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[154413] contrib/buildbot-test/master.cfg</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/154413">154413</a></dd>
<dt>Author</dt> <dd>larryv@macports.org</dd>
<dt>Date</dt> <dd>2016-10-29 02:50:08 +0200 (Sat, 29 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>buildbot: Simplify imports
- Access Buildbot components through the plugin infrastructure when
possible, reducing the number of imports required.
- As per PEP 8 [*], keep imports in one place instead of strewn
everywhere.
- Remove duplicate and unused imports.
[*]: https://www.python.org/dev/peps/pep-0008/#imports</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#contribbuildbottestmastercfg">contrib/buildbot-test/master.cfg</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="contribbuildbottestmastercfg"></a>
<div class="modfile"><h4>Modified: contrib/buildbot-test/master.cfg (154412 => 154413)</h4>
<pre class="diff"><span>
<span class="info">--- contrib/buildbot-test/master.cfg 2016-10-29 00:46:22 UTC (rev 154412)
+++ contrib/buildbot-test/master.cfg 2016-10-29 00:50:08 UTC (rev 154413)
</span><span class="lines">@@ -5,10 +5,18 @@
</span><span class="cx"> # This is a buildmaster config file. It must be installed as
</span><span class="cx"> # 'master.cfg' in your buildmaster's base directory.
</span><span class="cx">
</span><ins>+import datetime
</ins><span class="cx"> import json
</span><span class="cx"> import os
</span><span class="cx"> import re
</span><ins>+import subprocess
</ins><span class="cx">
</span><ins>+from buildbot.plugins import buildslave, changes, schedulers, status, steps, util
+# In 0.8.12, WebStatus can't be used as a plugin because it doesn't
+# actually implement the IStatusReceiver interface, as it claims to.
+from buildbot.status.web.baseweb import WebStatus
+from twisted.internet import defer
+
</ins><span class="cx"> ####### HELPER FUNCTIONS #######
</span><span class="cx">
</span><span class="cx"> def _path(name):
</span><span class="lines">@@ -65,7 +73,6 @@
</span><span class="cx"> path_docs = path_ports
</span><span class="cx">
</span><span class="cx"> # Allow spaces and tabs in property values
</span><del>-import re
</del><span class="cx"> c['validation'] = {'property_value': re.compile(r'^[ \t\w./~:-]*$')}
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -74,7 +81,6 @@
</span><span class="cx"> # The 'slaves' list defines the set of recognized buildslaves. Each element is
</span><span class="cx"> # a BuildSlave object, specifying a unique slave name and password. The same
</span><span class="cx"> # slave name and password must be configured on the slave.
</span><del>-from buildbot.buildslave import BuildSlave
</del><span class="cx">
</span><span class="cx"> c['slaves'] = []
</span><span class="cx"> slavedata = {}
</span><span class="lines">@@ -86,7 +92,7 @@
</span><span class="cx"> build_platforms = [s.encode('utf-8') for s in slavedata['build_platforms']]
</span><span class="cx">
</span><span class="cx"> for slave, pwd in slavedata['slaves'].items():
</span><del>- c['slaves'].append(BuildSlave(slave, pwd))
</del><ins>+ c['slaves'].append(buildslave.BuildSlave(slave, pwd))
</ins><span class="cx">
</span><span class="cx"> # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
</span><span class="cx"> # This must match the value configured into the buildslaves (with their
</span><span class="lines">@@ -104,14 +110,12 @@
</span><span class="cx">
</span><span class="cx"> if config['production']:
</span><span class="cx"> # TODO
</span><del>- from buildbot.changes.pb import PBChangeSource
</del><span class="cx"> sourcedata = []
</span><span class="cx"> # with open(_path('source.json')) as f:
</span><span class="cx"> # sourcedata = json.load(f)
</span><del>-# c['change_source'] = PBChangeSource(user=sourcedata[0], passwd=sourcedata[1], port=sourcedata[2])
</del><ins>+# c['change_source'] = changes.PBChangeSource(user=sourcedata[0], passwd=sourcedata[1], port=sourcedata[2])
</ins><span class="cx"> else:
</span><del>- from buildbot.changes.svnpoller import SVNPoller
- c['change_source'] = SVNPoller(
</del><ins>+ c['change_source'] = changes.SVNPoller(
</ins><span class="cx"> svnurl='https://svn.macports.org/repository/macports/trunk',
</span><span class="cx"> #svnbin='/opt/local/bin/svn',
</span><span class="cx"> pollinterval=300,
</span><span class="lines">@@ -139,49 +143,43 @@
</span><span class="cx"> return True
</span><span class="cx"> return False
</span><span class="cx">
</span><del>-from buildbot.changes.filter import ChangeFilter
-
</del><span class="cx"> base_buildernames = ['base-'+plat for plat in build_platforms if 'legacy' not in plat and '10.6_i386' not in plat]
</span><span class="cx"> portwatcher_buildernames = ['ports-'+plat+'-watcher' for plat in build_platforms if 'linux' not in plat and '10.5_ppc' != plat]
</span><span class="cx"> portbuilder_buildernames = ['ports-'+plat+'-builder' for plat in build_platforms if 'linux' not in plat and '10.5_ppc' != plat]
</span><span class="cx"> portbuilder_triggerables = ['ports-'+plat+'-trigger' for plat in build_platforms if 'linux' not in plat and '10.5_ppc' != plat]
</span><span class="cx">
</span><del>-from buildbot.schedulers.basic import SingleBranchScheduler
-from buildbot.schedulers.forcesched import ForceScheduler
-from buildbot.schedulers.forcesched import StringParameter
-from buildbot.schedulers.triggerable import Triggerable
</del><span class="cx">
</span><span class="cx"> c['schedulers'] = [
</span><del>- SingleBranchScheduler(
</del><ins>+ schedulers.SingleBranchScheduler(
</ins><span class="cx"> name='base',
</span><span class="cx"> treeStableTimer=None,
</span><del>- change_filter=ChangeFilter(
</del><ins>+ change_filter=util.ChangeFilter(
</ins><span class="cx"> filter_fn=change_has_base),
</span><span class="cx"> builderNames=base_buildernames),
</span><del>- SingleBranchScheduler(
</del><ins>+ schedulers.SingleBranchScheduler(
</ins><span class="cx"> name='ports',
</span><span class="cx"> treeStableTimer=None,
</span><del>- change_filter=ChangeFilter(
</del><ins>+ change_filter=util.ChangeFilter(
</ins><span class="cx"> # Should actually skip changes to files/ only, but only if
</span><span class="cx"> # we know the last build of the port succeeded.
</span><span class="cx"> filter_fn=lambda change: any(port_from_path(f) for f in change.files)),
</span><span class="cx"> builderNames=portwatcher_buildernames),
</span><del>- ForceScheduler(
</del><ins>+ schedulers.ForceScheduler(
</ins><span class="cx"> name='base_force',
</span><span class="cx"> builderNames=base_buildernames),
</span><del>-# ForceScheduler(
</del><ins>+# schedulers.ForceScheduler(
</ins><span class="cx"> # name='portbuilder_force',
</span><span class="cx"> # builderNames=portbuilder_buildernames,
</span><del>-# properties=[StringParameter(
</del><ins>+# properties=[util.StringParameter(
</ins><span class="cx"> # name='portname',
</span><span class="cx"> # label='Port name:',
</span><span class="cx"> # default='',
</span><span class="cx"> # required=True)
</span><span class="cx"> # ]),
</span><del>- ForceScheduler(
</del><ins>+ schedulers.ForceScheduler(
</ins><span class="cx"> name='portwatcher_force',
</span><span class="cx"> builderNames=portwatcher_buildernames,
</span><del>- properties=[StringParameter(
</del><ins>+ properties=[util.StringParameter(
</ins><span class="cx"> name='portlist',
</span><span class="cx"> label='Port list:',
</span><span class="cx"> default='',
</span><span class="lines">@@ -192,13 +190,13 @@
</span><span class="cx">
</span><span class="cx"> if 'www' in config['deploy']:
</span><span class="cx"> c['schedulers'].extend((
</span><del>- SingleBranchScheduler(
</del><ins>+ schedulers.SingleBranchScheduler(
</ins><span class="cx"> name='www',
</span><span class="cx"> treeStableTimer=300,
</span><del>- change_filter=ChangeFilter(
</del><ins>+ change_filter=util.ChangeFilter(
</ins><span class="cx"> filter_fn=change_has_www),
</span><span class="cx"> builderNames=['docs-www']),
</span><del>- ForceScheduler(
</del><ins>+ schedulers.ForceScheduler(
</ins><span class="cx"> name='www_force',
</span><span class="cx"> builderNames=['docs-www'])
</span><span class="cx"> ))
</span><span class="lines">@@ -205,13 +203,13 @@
</span><span class="cx">
</span><span class="cx"> if 'guide' in config['deploy']:
</span><span class="cx"> c['schedulers'].extend((
</span><del>- SingleBranchScheduler(
</del><ins>+ schedulers.SingleBranchScheduler(
</ins><span class="cx"> name='guide',
</span><span class="cx"> treeStableTimer=300,
</span><del>- change_filter=ChangeFilter(
</del><ins>+ change_filter=util.ChangeFilter(
</ins><span class="cx"> filter_fn=change_has_guide),
</span><span class="cx"> builderNames=['docs-guide']),
</span><del>- ForceScheduler(
</del><ins>+ schedulers.ForceScheduler(
</ins><span class="cx"> name='guide_force',
</span><span class="cx"> builderNames=['docs-www'])
</span><span class="cx"> ))
</span><span class="lines">@@ -218,7 +216,7 @@
</span><span class="cx">
</span><span class="cx"> for i in range(len(portbuilder_buildernames)):
</span><span class="cx"> c['schedulers'].append(
</span><del>- Triggerable(
</del><ins>+ schedulers.Triggerable(
</ins><span class="cx"> name=portbuilder_triggerables[i],
</span><span class="cx"> builderNames=[portbuilder_buildernames[i]]))
</span><span class="cx">
</span><span class="lines">@@ -232,21 +230,16 @@
</span><span class="cx"> # what steps, and which slaves can execute them. Note that any particular build will
</span><span class="cx"> # only take place on one slave.
</span><span class="cx">
</span><del>-from buildbot.process.factory import BuildFactory, GNUAutoconf
-from buildbot.process.properties import WithProperties, Interpolate
-from buildbot.steps.source.svn import SVN
-from buildbot.steps.shell import ShellCommand, Compile, Configure, SetPropertyFromCommand
-
-base_factory = BuildFactory()
</del><ins>+base_factory = util.BuildFactory()
</ins><span class="cx"> base_factory.workdir = '../build'
</span><span class="cx">
</span><del>-#base_factory.addStep(SVN(
-# repourl=Interpolate('https://svn.macports.org/repository/macports/%(src::branch:-trunk)s/base'),
-base_factory.addStep(SVN(
</del><ins>+#base_factory.addStep(steps.SVN(
+# repourl=util.Interpolate('https://svn.macports.org/repository/macports/%(src::branch:-trunk)s/base'),
+base_factory.addStep(steps.SVN(
</ins><span class="cx"> repourl='https://svn.macports.org/repository/macports/trunk/base',
</span><span class="cx"> method='copy',
</span><span class="cx"> env={'PATH': path_ports}))
</span><del>-base_factory.addStep(Configure(command=WithProperties("""
</del><ins>+base_factory.addStep(steps.Configure(command=util.WithProperties("""
</ins><span class="cx"> env PATH=/usr/bin:/bin:/usr/sbin:/sbin ./configure --enable-readline \
</span><span class="cx"> --prefix=%(workdir)s/opt/local \
</span><span class="cx"> --with-applications-dir=%(workdir)s/opt/local/Applications \
</span><span class="lines">@@ -253,27 +246,27 @@
</span><span class="cx"> --with-install-user=`id -un` \
</span><span class="cx"> --with-install-group=`id -gn` \
</span><span class="cx"> """),logfiles={'config.log': 'config.log'}))
</span><del>-base_factory.addStep(Compile(command='make -j`sysctl -n hw.activecpu`'))
-base_factory.addStep(ShellCommand(
</del><ins>+base_factory.addStep(steps.Compile(command='make -j`sysctl -n hw.activecpu`'))
+base_factory.addStep(steps.ShellCommand(
</ins><span class="cx"> command='make install',
</span><span class="cx"> name='install',
</span><span class="cx"> description=['installing'],
</span><span class="cx"> descriptionDone=['install']))
</span><del>-base_factory.addStep(ShellCommand(
</del><ins>+base_factory.addStep(steps.ShellCommand(
</ins><span class="cx"> command='make test',
</span><span class="cx"> name='test',
</span><span class="cx"> description=['testing'],
</span><span class="cx"> descriptionDone=['test']))
</span><del>-base_factory.addStep(ShellCommand(
- command=WithProperties('make distclean; rm -rf %(workdir)s/opt/local'),
</del><ins>+base_factory.addStep(steps.ShellCommand(
+ command=util.WithProperties('make distclean; rm -rf %(workdir)s/opt/local'),
</ins><span class="cx"> name='clean',
</span><span class="cx"> description=['cleaning'],
</span><span class="cx"> descriptionDone=['clean']))
</span><span class="cx">
</span><span class="cx"> # custom class to make the file list available on the slave...
</span><del>-class SetPropertyFromCommandWithPortlist(SetPropertyFromCommand):
</del><ins>+class SetPropertyFromCommandWithPortlist(steps.SetPropertyFromCommand):
</ins><span class="cx"> def setBuild(self, build):
</span><del>- SetPropertyFromCommand.setBuild(self, build)
</del><ins>+ steps.SetPropertyFromCommand.setBuild(self, build)
</ins><span class="cx">
</span><span class="cx"> portset = set()
</span><span class="cx"> # support forced build properties
</span><span class="lines">@@ -294,7 +287,7 @@
</span><span class="cx"> return ['Port list: %s' % (self.getProperty('subportlist'))]
</span><span class="cx"> else:
</span><span class="cx"> # let ShellCommand describe
</span><del>- return ShellCommand.getText(self, cmd, results)
</del><ins>+ return steps.ShellCommand.getText(self, cmd, results)
</ins><span class="cx">
</span><span class="cx"> # can't run with prefix inside the workdir in production,
</span><span class="cx"> # because archives must be built with prefix=/opt/local
</span><span class="lines">@@ -310,13 +303,7 @@
</span><span class="cx"> ulpath = 'archive_staging'
</span><span class="cx"> ulpath_unique = ulpath+'-%(buildername)s'
</span><span class="cx">
</span><del>-from buildbot.steps.transfer import FileDownload, DirectoryUpload
-from buildbot.steps.master import MasterShellCommand
-from buildbot.steps.trigger import Trigger
-
-from buildbot.process.properties import renderer
-
-@renderer
</del><ins>+@util.renderer
</ins><span class="cx"> def make_build_url(props):
</span><span class="cx"> buildername = props.getProperty('buildername')
</span><span class="cx"> buildnumber = props.getProperty('buildnumber')
</span><span class="lines">@@ -326,7 +313,7 @@
</span><span class="cx"> url += 'builders/%s/builds/%s' % (buildername, buildnumber)
</span><span class="cx"> return url
</span><span class="cx">
</span><del>-class TriggerWithPortlist(Trigger):
</del><ins>+class TriggerWithPortlist(steps.Trigger):
</ins><span class="cx"> def getSchedulersAndProperties(self):
</span><span class="cx"> sp = []
</span><span class="cx"> for scheduler in self.schedulerNames:
</span><span class="lines">@@ -340,12 +327,12 @@
</span><span class="cx"> # -- Port Watcher --
</span><span class="cx">
</span><span class="cx"> def make_portwatcher_factory(triggerable):
</span><del>- portwatcher_factory = BuildFactory()
</del><ins>+ portwatcher_factory = util.BuildFactory()
</ins><span class="cx"> portwatcher_factory.useProgress = False
</span><span class="cx"> portwatcher_factory.workdir = '../build'
</span><span class="cx">
</span><span class="cx"> # get mp-buildbot; we'll do the checkout of base and dports via these scripts
</span><del>- portwatcher_factory.addStep(SVN(
</del><ins>+ portwatcher_factory.addStep(steps.SVN(
</ins><span class="cx"> repourl=config['mpbbsvnurl'],
</span><span class="cx"> env={'PATH': path_ports},
</span><span class="cx"> alwaysUseLatest=True,
</span><span class="lines">@@ -354,21 +341,21 @@
</span><span class="cx"> workdir=os.path.join(portwatcher_factory.workdir, 'mpbb'),
</span><span class="cx"> haltOnFailure=True))
</span><span class="cx">
</span><del>- portwatcher_factory.addStep(ShellCommand(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'cleanup'],
</del><ins>+ portwatcher_factory.addStep(steps.ShellCommand(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'cleanup'],
</ins><span class="cx"> name='cleanup',
</span><span class="cx"> description=['cleaning'],
</span><span class="cx"> descriptionDone=['clean']))
</span><span class="cx">
</span><del>- portwatcher_factory.addStep(ShellCommand(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'selfupdate'],
</del><ins>+ portwatcher_factory.addStep(steps.ShellCommand(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'selfupdate'],
</ins><span class="cx"> name='selfupdate',
</span><span class="cx"> description=['updating', 'MacPorts'],
</span><span class="cx"> descriptionDone=['update', 'MacPorts'],
</span><span class="cx"> haltOnFailure=True))
</span><span class="cx">
</span><del>- portwatcher_factory.addStep(ShellCommand(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'checkout', '--svn-url', config['svnurl']],
</del><ins>+ portwatcher_factory.addStep(steps.ShellCommand(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'checkout', '--svn-url', config['svnurl']],
</ins><span class="cx"> timeout=3600,
</span><span class="cx"> name='checkout',
</span><span class="cx"> description=['syncing', 'ports'],
</span><span class="lines">@@ -393,7 +380,7 @@
</span><span class="cx"> return {'subportlist': ' '.join(sorted(subports))}
</span><span class="cx">
</span><span class="cx"> portwatcher_factory.addStep(SetPropertyFromCommandWithPortlist(
</span><del>- command=WithProperties('./mpbb/mpbb list-subports %(fullportlist)s'),
</del><ins>+ command=util.WithProperties('./mpbb/mpbb list-subports %(fullportlist)s'),
</ins><span class="cx"> extract_fn=extract_subportlist,
</span><span class="cx"> name='subports',
</span><span class="cx"> description=['listing', 'subports']))
</span><span class="lines">@@ -407,7 +394,7 @@
</span><span class="cx"> # make a logfile summarising the success/failure status for each port
</span><span class="cx"> # (Current approach is not so useful as it is not incremental;
</span><span class="cx"> # ideally this would already be displayed during the Trigger step.)
</span><del>- portwatcher_factory.addStep(ShellCommand(
</del><ins>+ portwatcher_factory.addStep(steps.ShellCommand(
</ins><span class="cx"> command=['cat', os.path.join(logdir, 'ports-progress.txt')],
</span><span class="cx"> name='summary',
</span><span class="cx"> description=['summary']))
</span><span class="lines">@@ -416,31 +403,31 @@
</span><span class="cx">
</span><span class="cx"> # -- Port Builder --
</span><span class="cx">
</span><del>-portbuilder_factory = BuildFactory()
</del><ins>+portbuilder_factory = util.BuildFactory()
</ins><span class="cx"> portbuilder_factory.useProgress = False
</span><span class="cx"> portbuilder_factory.workdir = '../build'
</span><span class="cx"> logdir = os.path.join(portbuilder_factory.workdir, 'logs')
</span><span class="cx">
</span><del>-portbuilder_factory.addStep(Compile(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'install-dependencies', WithProperties('%(portname)s')],
</del><ins>+portbuilder_factory.addStep(steps.Compile(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'install-dependencies', util.WithProperties('%(portname)s')],
</ins><span class="cx"> name='install-dependencies',
</span><del>- description=['installing', 'dependencies', 'of', WithProperties('%(portname)s')],
- descriptionDone=['install', 'dependencies', 'of', WithProperties('%(portname)s')],
</del><ins>+ description=['installing', 'dependencies', 'of', util.WithProperties('%(portname)s')],
+ descriptionDone=['install', 'dependencies', 'of', util.WithProperties('%(portname)s')],
</ins><span class="cx"> logfiles={'dependencies': os.path.join(logdir, 'dependencies-progress.txt')},
</span><span class="cx"> haltOnFailure=True))
</span><span class="cx">
</span><del>-portbuilder_factory.addStep(Compile(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'install-port', WithProperties('%(portname)s')],
</del><ins>+portbuilder_factory.addStep(steps.Compile(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'install-port', util.WithProperties('%(portname)s')],
</ins><span class="cx"> name='install-port',
</span><del>- description=['installing', WithProperties('%(portname)s')],
- descriptionDone=['install', WithProperties('%(portname)s')],
</del><ins>+ description=['installing', util.WithProperties('%(portname)s')],
+ descriptionDone=['install', util.WithProperties('%(portname)s')],
</ins><span class="cx"> logfiles={'files': os.path.join(logdir, 'port-contents.txt'),
</span><span class="cx"> 'statistics': os.path.join(logdir, 'port-statistics.txt'),
</span><span class="cx"> 'main.log': os.path.join(logdir, 'main.log')},
</span><span class="cx"> haltOnFailure=True))
</span><span class="cx">
</span><del>-portbuilder_factory.addStep(ShellCommand(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'gather-archives', '--archive-site', config['archivesite'], '--staging-dir', ulpath],
</del><ins>+portbuilder_factory.addStep(steps.ShellCommand(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'gather-archives', '--archive-site', config['archivesite'], '--staging-dir', ulpath],
</ins><span class="cx"> name='gather-archives',
</span><span class="cx"> description=['gathering', 'archives'],
</span><span class="cx"> descriptionDone=['gather', 'archives'],
</span><span class="lines">@@ -447,15 +434,15 @@
</span><span class="cx"> haltOnFailure=True))
</span><span class="cx">
</span><span class="cx"> # upload archives from build slave to master
</span><del>-portbuilder_factory.addStep(DirectoryUpload(
</del><ins>+portbuilder_factory.addStep(steps.DirectoryUpload(
</ins><span class="cx"> slavesrc=ulpath,
</span><del>- masterdest=WithProperties(ulpath_unique)))
</del><ins>+ masterdest=util.WithProperties(ulpath_unique)))
</ins><span class="cx">
</span><span class="cx"> # XXX: move deploy_archives.sh functionality to mp-buildbot
</span><span class="cx"> # sign generated binaries and sync to download server (if distributable)
</span><span class="cx"> if config['production']:
</span><del>- portbuilder_factory.addStep(MasterShellCommand(
- command=['./deploy_archives.sh', WithProperties(ulpath_unique)],
</del><ins>+ portbuilder_factory.addStep(steps.MasterShellCommand(
+ command=['./deploy_archives.sh', util.WithProperties(ulpath_unique)],
</ins><span class="cx"> name='deploy-archives',
</span><span class="cx"> description=['deploying', 'archives'],
</span><span class="cx"> descriptionDone=['deploy', 'archives'],
</span><span class="lines">@@ -462,8 +449,8 @@
</span><span class="cx"> env={'PRIVKEY': config['privkey'], 'DLHOST': dlhost, 'DLPATH': dlpath}))
</span><span class="cx">
</span><span class="cx"> # TODO: do we want to upload the individual logs so maintainers can review them?
</span><del>-portbuilder_factory.addStep(ShellCommand(
- command=['./mpbb/mpbb', '--prefix', WithProperties(prefix), 'cleanup'],
</del><ins>+portbuilder_factory.addStep(steps.ShellCommand(
+ command=['./mpbb/mpbb', '--prefix', util.WithProperties(prefix), 'cleanup'],
</ins><span class="cx"> name='cleanup',
</span><span class="cx"> description=['cleaning'],
</span><span class="cx"> descriptionDone=['clean'],
</span><span class="lines">@@ -471,7 +458,7 @@
</span><span class="cx">
</span><span class="cx"> def make_rsync_deploy_steps(host, user, sshkeyfile, sshknownhostsfile, srcpath, destpath):
</span><span class="cx"> return (
</span><del>- FileDownload(
</del><ins>+ steps.FileDownload(
</ins><span class="cx"> name='ssh key',
</span><span class="cx"> description='transferring',
</span><span class="cx"> descriptionDone='transfer',
</span><span class="lines">@@ -478,7 +465,7 @@
</span><span class="cx"> mastersrc=sshkeyfile,
</span><span class="cx"> slavedest='ssh_key',
</span><span class="cx"> mode=0600),
</span><del>- FileDownload(
</del><ins>+ steps.FileDownload(
</ins><span class="cx"> name='ssh known_hosts',
</span><span class="cx"> description='transferring',
</span><span class="cx"> descriptionDone='transfer',
</span><span class="lines">@@ -485,7 +472,7 @@
</span><span class="cx"> mastersrc=sshknownhostsfile,
</span><span class="cx"> slavedest='ssh_known_hosts',
</span><span class="cx"> mode=0600),
</span><del>- ShellCommand(
</del><ins>+ steps.ShellCommand(
</ins><span class="cx"> name='rsync',
</span><span class="cx"> description='deploying',
</span><span class="cx"> descriptionDone='deploy',
</span><span class="lines">@@ -494,9 +481,9 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> if 'www' in config['deploy']:
</span><del>- docs_www_factory = BuildFactory()
</del><ins>+ docs_www_factory = util.BuildFactory()
</ins><span class="cx"> # TODO: incremental mode with cleanup?
</span><del>- docs_www_factory.addStep(SVN(
</del><ins>+ docs_www_factory.addStep(steps.SVN(
</ins><span class="cx"> repourl='https://svn.macports.org/repository/macports/trunk/www',
</span><span class="cx"> mode='full',
</span><span class="cx"> method='copy',
</span><span class="lines">@@ -512,21 +499,21 @@
</span><span class="cx"> destpath=config['deploy']['www']['destpath']))
</span><span class="cx">
</span><span class="cx"> if 'guide' in config['deploy']:
</span><del>- docs_guide_factory = BuildFactory()
</del><ins>+ docs_guide_factory = util.BuildFactory()
</ins><span class="cx"> # TODO: incremental mode with cleanup?
</span><del>- docs_guide_factory.addStep(SVN(
</del><ins>+ docs_guide_factory.addStep(steps.SVN(
</ins><span class="cx"> repourl='https://svn.macports.org/repository/macports/trunk/doc-new',
</span><span class="cx"> mode='full',
</span><span class="cx"> method='copy',
</span><span class="cx"> workdir='guide'))
</span><span class="cx"> # TODO: check for existence of tools in toolsprefix
</span><del>- docs_guide_factory.addStep(Compile(
</del><ins>+ docs_guide_factory.addStep(steps.Compile(
</ins><span class="cx"> name='validate',
</span><span class="cx"> description='validating',
</span><span class="cx"> descriptionDone='validate',
</span><span class="cx"> command='make validate',
</span><span class="cx"> workdir='guide'))
</span><del>- docs_guide_factory.addStep(Compile(
</del><ins>+ docs_guide_factory.addStep(steps.Compile(
</ins><span class="cx"> command='make all',
</span><span class="cx"> workdir='guide'))
</span><span class="cx"> docs_guide_factory.addSteps(
</span><span class="lines">@@ -541,8 +528,6 @@
</span><span class="cx">
</span><span class="cx"> ####### BUILDER CONFIGURATION #######
</span><span class="cx">
</span><del>-from buildbot.config import BuilderConfig
-
</del><span class="cx"> # XXX: slavenames assignment should be automatic and more generic
</span><span class="cx"> portsslaves = {}
</span><span class="cx"> baseslaves = {}
</span><span class="lines">@@ -552,8 +537,8 @@
</span><span class="cx"> portsslaves[plat] = filter(lambda x: x.endswith(plat+'-ports'), slavenames)
</span><span class="cx">
</span><span class="cx"> env_buildinfo = {
</span><del>- 'BUILDBOT_BUILDERNAME': WithProperties('%(buildername)s'),
- 'BUILDBOT_BUILDNUMBER': WithProperties('%(buildnumber)s'),
</del><ins>+ 'BUILDBOT_BUILDERNAME': util.WithProperties('%(buildername)s'),
+ 'BUILDBOT_BUILDNUMBER': util.WithProperties('%(buildnumber)s'),
</ins><span class="cx"> 'BUILDBOT_BUILDURL': make_build_url
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -564,7 +549,7 @@
</span><span class="cx"> os_version = os_match.group(0) if os_match else plat
</span><span class="cx"> if 'legacy' not in plat and '10.6_i386' not in plat:
</span><span class="cx"> c['builders'].append(
</span><del>- BuilderConfig(
</del><ins>+ util.BuilderConfig(
</ins><span class="cx"> name='base-' + plat,
</span><span class="cx"> slavenames=['base-' + plat],
</span><span class="cx"> factory=base_factory,
</span><span class="lines">@@ -572,13 +557,13 @@
</span><span class="cx"> env=merge_dicts(env_buildinfo, {'PATH': path_base})))
</span><span class="cx"> if 'linux' not in plat and '10.5_ppc' != plat:
</span><span class="cx"> c['builders'].extend((
</span><del>- BuilderConfig(
</del><ins>+ util.BuilderConfig(
</ins><span class="cx"> name='ports-' + plat + '-watcher',
</span><span class="cx"> slavenames=['ports-' + plat],
</span><span class="cx"> factory=make_portwatcher_factory('ports-' + plat + '-trigger'),
</span><span class="cx"> tags=['portwatcher', os_version],
</span><span class="cx"> env=merge_dicts(env_buildinfo, {'PATH': path_ports})),
</span><del>- BuilderConfig(
</del><ins>+ util.BuilderConfig(
</ins><span class="cx"> name='ports-' + plat + '-builder',
</span><span class="cx"> slavenames=['ports-' + plat],
</span><span class="cx"> factory=portbuilder_factory,
</span><span class="lines">@@ -588,7 +573,7 @@
</span><span class="cx">
</span><span class="cx"> if 'www' in config['deploy']:
</span><span class="cx"> c['builders'].append(
</span><del>- BuilderConfig(
</del><ins>+ util.BuilderConfig(
</ins><span class="cx"> name='docs-www',
</span><span class="cx"> slavenames=['docs'],
</span><span class="cx"> factory=docs_www_factory,
</span><span class="lines">@@ -596,7 +581,7 @@
</span><span class="cx"> env=merge_dicts(env_buildinfo, {'PATH': path_ports})))
</span><span class="cx"> if 'guide' in config['deploy']:
</span><span class="cx"> c['builders'].append(
</span><del>- BuilderConfig(
</del><ins>+ util.BuilderConfig(
</ins><span class="cx"> name='docs-guide',
</span><span class="cx"> slavenames=['docs'],
</span><span class="cx"> factory=docs_guide_factory,
</span><span class="lines">@@ -612,14 +597,9 @@
</span><span class="cx">
</span><span class="cx"> c['status'] = []
</span><span class="cx">
</span><del>-from buildbot.status import html
-from buildbot.status.web import auth, authz
</del><ins>+htauth = util.HTPasswdAprAuth(config['htpasswdfile'])
</ins><span class="cx">
</span><del>-from buildbot.status.web.auth import HTPasswdAprAuth
-
-htauth = HTPasswdAprAuth(config['htpasswdfile'])
-
-authz_cfg = authz.Authz(
</del><ins>+authz_cfg = util.Authz(
</ins><span class="cx"> auth=htauth,
</span><span class="cx"> gracefulShutdown='auth',
</span><span class="cx"> forceBuild='auth',
</span><span class="lines">@@ -629,17 +609,12 @@
</span><span class="cx"> stopAllBuilds='auth',
</span><span class="cx"> cancelPendingBuild='auth')
</span><span class="cx">
</span><del>-from buildbot.status.mail import MailNotifier
-from twisted.internet import defer
-
</del><span class="cx"> # TODO: This is the old mail notifier;
</span><span class="cx"> # - useful functionality could be copied
</span><span class="cx"> # - then the code should be removed
</span><span class="cx"> #
</span><del>-import subprocess
-from twisted.internet import defer
</del><span class="cx"> # notifier that sends mail to last committers and maintainers of failed ports
</span><del>-class OldPortsMailNotifier(MailNotifier):
</del><ins>+class OldPortsMailNotifier(status.MailNotifier):
</ins><span class="cx"> # would make more sense to override getInterestedUsers() in BuildStatus,
</span><span class="cx"> # but it seems almost impossible to tell a builder to use a different
</span><span class="cx"> # class for status in its Build objects
</span><span class="lines">@@ -680,7 +655,7 @@
</span><span class="cx"> dl.append(d)
</span><span class="cx"> return defer.gatherResults(dl)
</span><span class="cx">
</span><del>-class PortsMailNotifier(MailNotifier, object):
</del><ins>+class PortsMailNotifier(status.MailNotifier, object):
</ins><span class="cx"> def __init__(self, fromaddr, *args, **kwargs):
</span><span class="cx"> self.interested_users = set()
</span><span class="cx"> self.portMessageFormatter = kwargs.pop('portMessageFormatter')
</span><span class="lines">@@ -707,9 +682,6 @@
</span><span class="cx"> # dl.append(d)
</span><span class="cx"> return defer.gatherResults(dl)
</span><span class="cx">
</span><del>-from buildbot.plugins import util
-import datetime
-
</del><span class="cx"> def portWatcherMessageFormatter(mode, name, build, results, master_status, interested_users):
</span><span class="cx"> result = util.Results[results]
</span><span class="cx"> subject = 'Build {:s}'.format(result.title())
</span><span class="lines">@@ -777,7 +749,7 @@
</span><span class="cx">
</span><span class="cx"> if config['production']:
</span><span class="cx"> # send mail about base failures to users on the blamelist
</span><del>- mn = MailNotifier(
</del><ins>+ mn = status.MailNotifier(
</ins><span class="cx"> fromaddr='buildbot@macports.org',
</span><span class="cx"> extraHeaders={'Reply-To': 'noreply@macports.org'},
</span><span class="cx"> # unless lookup is defined, users have to be configured locally
</span><span class="lines">@@ -805,7 +777,7 @@
</span><span class="cx"> c['status'].append(mn)
</span><span class="cx">
</span><span class="cx"> # notifications about exceptions
</span><del>- mn = MailNotifier(
</del><ins>+ mn = status.MailNotifier(
</ins><span class="cx"> fromaddr='buildbot@macports.org',
</span><span class="cx"> extraHeaders={'Reply-To': 'noreply@macports.org'},
</span><span class="cx"> mode=('exception'),
</span><span class="lines">@@ -815,10 +787,8 @@
</span><span class="cx">
</span><span class="cx"> ####### PROJECT IDENTITY #######
</span><span class="cx">
</span><del>-from buildbot.plugins import util
-
</del><span class="cx"> # the 'title' string will appear at the top of this buildbot
</span><del>-# installation's html.WebStatus home page (linked to the
</del><ins>+# installation's WebStatus home page (linked to the
</ins><span class="cx"> # 'titleURL') and is embedded in the title of the waterfall HTML page.
</span><span class="cx">
</span><span class="cx"> c['title'] = 'MacPorts'
</span><span class="lines">@@ -825,7 +795,7 @@
</span><span class="cx"> c['titleURL'] = 'https://www.macports.org/'
</span><span class="cx">
</span><span class="cx"> c['buildbotURL'] = config['buildboturl']
</span><del>-c['status'].append(html.WebStatus(
</del><ins>+c['status'].append(WebStatus(
</ins><span class="cx"> http_port=config['httpport'],
</span><span class="cx"> authz=authz_cfg,
</span><span class="cx"> changecommentlink=(r'#(\d+)', r'https://trac.macports.org/ticket/\1', r'Ticket \g<0>')))
</span></span></pre>
</div>
</div>
</body>
</html>