Lieven Govaerts wrote:
> Hi,
>
>
>
> I'm using the commit mails sent to svn@subversion.tigris.org to trigger the
> buildbot master. It parses those mails to get branch, author, filestamp,
> revision, changed files and log message of the committed change. With this
> information it determines wether or not to trigger the buildslave, and to
> instruct them to update and build their working copies.
>
> Based on the content and a comment from maxb on irc I now know that those
> mails were only meant for human consumption, so I shouldn't use them with th
> buildbot. But I'm currently lacking an alternative.
You *could* poll the server every half-hour to see if the youngest revision
has gone up, returning a zero exit status if there's been a change since the
last check, zero otherwise:
---------------------------------------------------------
#!/usr/bin/python
import sys
import os
from svn import core, client, ra
LAST_REV_FILE = '/tmp/svn-repos-last-revision'
REPOS_URL = 'http://svn.collab.net/repos/svn'
try:
last_rev = int(open(LAST_REV_FILE, 'r').readline()[:-1])
except:
sys.stderr.write("WARNING: Unable to read last revision from '%s'\n" \
% (LAST_REV_FILE))
last_rev = 0
core.svn_config_ensure(None)
ctx = client.ctx_t()
ctx.auth_baton = core.svn_auth_open([])
ctx.config = core.svn_config_get_config(None)
ra_callbacks = ra.callbacks_t()
ra_callbacks.auth_baton = ctx.auth_baton
session = ra.open(REPOS_URL, ra_callbacks,
None, ctx.config)
youngest = ra.get_latest_revnum(session)
if youngest > last_rev:
print "Youngest '%d' is older than last revision '%d'" \
% (youngest, last_rev)
open(LAST_REV_FILE, 'w').write("%d\n" % (youngest))
sys.exit(0)
else:
print "No commits since last revision '%d'" \
% (last_rev)
sys.exit(1)
---------------------------------------------------------
>From there you can use 'svn log --xml' to get change details of the new
revisions.
Since you have to do an update to build the latest anyway, you could also
just routinely run 'svn up' and check it's output to see if anything has
changed.
So ... am I overlooking something really obvious here (besides the fact that
either of these suggestions move you from a push-based system to a
pull-based one)?
> This makes it important for me to know when the format of these mails sent
> from svn.collab.net is changed. In svn 1.3.2 (r19679) such a major format
> change is implemented in mailer.py, where the log message is now put upfront
> in the mail, before the list of modified files.
>
> svn.collab.net is now upgraded to svn 1.3.2, but the mails apparently are
> still sent using the old mailer.py? Is this a correct assumption?
>
> When will mailer.py be upgraded to 1.3.2 on svn.collab.net? Is it possible
> to contact me when that's happening?
That's correct. I forgot to upgrade mailer.py as part of that process. I
(or another svn.collab.net admin) can make this tweak at any time, really.
But I think you'd be better off finding something that doesn't rely on
emails as a trigger.
> FYI, we have other options to trigger the buildbot, but all of them require
> a hook script on the svn server.
I'm not opposed to adding such a hook script. Send suggestions to
svnadmin-at-svn.collab.net.
--
C. Michael Pilato <cmpilato@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
Received on Thu Jun 1 05:23:26 2006