Next: SVNCommitEmailMaildirSource, Previous: Parsing Email Change Messages, Up: Mail-parsing ChangeSources
This parser works with the buildbot_cvs_maildir.py script in the contrib directory.
The script sends an email containing all the files submitted in one directory. It is invoked by using the CVSROOT/loginfo facility.
The Buildbot's CVSMaildirSource
knows how to parse
these messages and turn them into Change objects. It takes two parameters,
the directory name of the maildir root, and an optional function to create
a URL for each file. The function takes three parameters:
file - file name oldRev - old revision of the file newRev - new revision of the file
It must return, oldly enough, a url for the file in question. For example:
def fileToUrl( file, oldRev, newRev ): return 'http://example.com/cgi-bin/cvsweb.cgi/' + file + '?rev=' + newRev from buildbot.changes.mail import CVSMaildirSource c['change_source'] = CVSMaildirSource("/home/buildbot/Mail", urlmaker=fileToUrl)
CVS must be configured to invoke the buildbot_cvs_mail.py script when files are checked in. This is done via the CVS loginfo configuration file.
To update this, first do:
cvs checkout CVSROOT
cd to the CVSROOT directory and edit the file loginfo, adding a line like:
SomeModule /cvsroot/CVSROOT/buildbot_cvs_mail.py --cvsroot :ext:example.com:/cvsroot -e buildbot -P SomeModule %{sVv}
NOTE: For cvs version 1.12.x, the '--path %p
' option is required.
Version 1.11.x and 1.12.x report the directory path differently.
The above example you put the buildbot_cvs_mail.py script under /cvsroot/CVSROOT.
It can be anywhere. Run the script with –help to see all the options.
At the very least, the
options -e
(email) and -P
(project) should be specified. The line must end with %{sVv}
This is expanded to the files that were modified.
Additional entries can be added to support more modules.
The following is an abreviated form of buildbot_cvs_mail.py –help
Usage: buildbot-cvs-mail [options] %{sVv} Where options are: --category=category -C Category for change. This becomes the Change.category attribute. This may not make sense to specify it here, as category is meant to distinguish the diffrent types of bots inside a same project, such as "test", "docs", "full" --cvsroot=<path> -c CVSROOT for use by buildbot slaves to checkout code. This becomes the Change.repository attribute. Exmaple: :ext:myhost:/cvsroot --email=email -e email Email address of the buildbot. --fromhost=hostname -f hostname The hostname that email messages appear to be coming from. The From: header of the outgoing message will look like user@hostname. By default, hostname is the machine's fully qualified domain name. --help / -h Print this text. -m hostname --mailhost=hostname The hostname of an available SMTP server. The default is 'localhost'. --mailport=port The port number of SMTP server. The default is '25'. --quiet / -q Don't print as much status to stdout. --path=path -p path The path for the files in this update. This comes from the %p parameter in loginfo for CVS version 1.12.x. Do not use this for CVS version 1.11.x --project=project -P project The project for the source. Use the CVS module being modified. This becomes the Change.project attribute. -R ADDR --reply-to=ADDR Add a "Reply-To: ADDR" header to the email message. -t --testing Construct message and send to stdout for testing The rest of the command line arguments are: %{sVv} CVS %{sVv} loginfo expansion. When invoked by CVS, this will be a single string containing the files that are changing.