[Buildbot-devel] multiple subversion repositories
Mark <line72> Dillavou
mlists at line72.net
Tue Feb 21 19:12:39 UTC 2006
On Wed, 2006-01-11 at 08:30 -0600, Mark Dillavou wrote:
> I am trying to setup a single buildmaster that has multiple subversion
> repositories (project1 and project2).
<snip>
I got this working, so I thought I'd share with everyone how I did this
(by this, I mean using a single buildmaster for multiple subversion
repositories so I can have them depend on each other). This isn't the
greatest solution, but it does work.
This first thing I had to do was modify the svn_buildbot.py script to
include the full path to the repository. In the gotPersp function, I
changed the comments from:
commit comments here
to
/full/path/to/svn/repository commit comments here
Then I can split the comments line and get the repository. Note that in
the log on buildbot's website, it shows the full path as part of the
comments! This is not the best way to do this, and I probably should
have overriden the addChange method called in svn_buildbot.py to include
a repository attribute.
To do this I changed the following in the gotPersp function:
def gotPersp(persp):
print "who", repr(who)
print "what", repr(changed)
print "why", repr(message)
print "new revision", repr(revision)
# !mwd - include the repository in the comment
message2 = "%s %s" % (repo, message)
return persp.callRemote('addChange', {'who': who,
'files': changed,
'comments': message2,
'revision': revision})
The next thing I had to do is override the scheduler to ignore changes
if they are from a different repository. In my master.cfg, I created a
new RepositoryScheduler which inherits from Scheduler. It takes an
extra parameter (repository path), and overrides the addChange method.
Here's the class in full (sorry for the formatting):
# my own scheduler class for branches
class RepositoryScheduler(Scheduler):
def __init__(self, name, branch, treeStableTimer, builderNames,
repository, fileIsImportant=None):
Scheduler.__init__(self, name, branch, treeStableTimer,
builderNames, fileIsImportant)
self.repository = repository
def addChange(self, change):
# check to make sure the repository matches!
cs = change.comments.split(' ')
if len(cs) > 0:
repo = cs[0]
log.msg('checking %s vs %s' %
(repo, self.repository))
if repo != self.repository:
log.msg("%s ignoring repository %s" %
(self, repo))
return
# call our parent since this on the correct repository
Scheduler.addChange(self, change)
Then when creating the schedulers, you need to create them as
RepositorySchedulers instead of Schedulers:
c['schedulers'].append(RepositoryScheduler(name="project1", branch=None,
treeStableTimer=0,
builderNames=["builder1"],
repository='/home/svn/project1'))
c['schedulers'].append(RepositoryScheduler(name="project2", branch=None,
treeStableTimer=0,
builderNames=["builder1"],
repository='/home/svn/project2'))
The repository='/home/svn/project2' must match what svn_buildbot.py
inserts into the comments section. You can then setup locks and do
everything as normal!
/Mark
More information about the devel
mailing list