CVSspam
Introduction CVSspam makes CVS send an email when changes are commited to the repository. This can be useful for letting members of a project team know what is happening to the code enabling a team leader to review changes to a project possiblty even allowing users see their favourite bug got fixed
Installation
Configure CVS To install CVSspam you will need to alter the repository's configuration files. To do this, check out your repository's CVSROOT. ...set $CVSROOT to point at your repository... $ cvs checkout CVSROOT $ cd CVSROOT $ ls CVS commitinfo cvswrappers loginfo notify taginfo checkoutlist config editinfo modules rcsinfo verifymsg First, alter commitinfo to call the CVSspam script that records the directories that have been commited: # The "commitinfo" file is used to control pre-commit checks. # The filter on the right is invoked with the repository and a list # of files to check. A non-zero exit of the filter program will # cause the commit to be aborted. # # The first entry on a line is a regular expression which is tested # against the directory that the change is being committed to, relative # to the $CVSROOT. For the first match that is found, then the remainder # of the line is the name of the filter to run. # # If the repository name does not match any of the regular expressions in this # file, the "DEFAULT" line is used, if it is specified. # # If the name "ALL" appears as a regular expression it is always used # in addition to the first matching regex or "DEFAULT". ^myproject /path/to/record_lastdir.rb Now you need to alter loginfo to record the log entry made by the user (and send off the email): # The "loginfo" file controls where "cvs commit" log information # is sent. The first entry on a line is a regular expression which must match # the directory that the change is being made to, relative to the # $CVSROOT. If a match is found, then the remainder of the line is a filter # program that should expect log information on its standard input. # # If the repository name does not match any of the regular expressions in this # file, the "DEFAULT" line is used, if it is specified. # # If the name ALL appears as a regular expression it is always used # in addition to the first matching regex or DEFAULT. # # You may specify a format string as part of the # filter. The string is composed of a `%' followed # by a single format character, or followed by a set of format # characters surrounded by `{' and `}' as separators. The format # characters are: # # s = file name # V = old version number (pre-checkin) # v = new version number (post-checkin) # # For example: #DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog # or #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog ^myproject /path/to/collect_diffs.rb --to me@somewhere.invalid %{sVv} The expression you use to select the project (the first thing on the line) must be the same in commitinfo and loginfo. Commit your changes to these files. You should see a message from CVS like rebuilding adminstrative database'. You are now be ready to test the setup. Checkout a copy of myproject and commit a change. An email should be sent to the address you specified.
Installing CVSspam files The CVSspam scripts may be located anywhere in the CVS server's filesystem. It's common to place these files inside the repository's CVSROOT, and this can be the only option if CVS is the only way you have to access a remote server. To do this, you need a checked-out copy of the CVSROOT, as described above. Place record_last_dir.rb, collect_diffs.rb and cvsspam.rb into this directory. Add these three filenames into CVSROOT/checkoutlist # The "checkoutlist" file is used to support additional version controlled # administrative files in $CVSROOT/CVSROOT, such as template files. # # The first entry on a line is a filename which will be checked out from # the corresponding RCS file in the $CVSROOT/CVSROOT directory. # The remainder of the line is an error message to use if the file cannot # be checked out. # # File format: # # [<whitespace>]<filename><whitespace><error message><end-of-line> # # comment lines begin with '#' record_lastdir.rb collect_diffs.rb cvsspam.rb cvs add the three scripts to the repository, then cvs commit them, and the modified checkoutlist. In commitinfo and loginfo you can now refer to the scripts with $CVSROOT/CVSROOT/record_lastdir.rb and $CVSROOT/CVSROOT/collect_diffs.rb
Configuration File You can specify CVSspam options in a configuration file. By default, the file $CVSROOT/CVSROOT/cvsspam.conf is used, though you can specify another with the option to collect_diffs.rb. If you want to put your config into the repository, you will need to follow the instructions above for installing files into CVSROOT To see the available options, see the example cvsspam.conf provided.
Debugging installation problems No email coming from CVS commits, and no error messages on the commendline Did you specify the right email address? Obvious, but worth checking. Does the regular expression you specified in commitinfo and loginfo really match the project? Try changing the entry to something like ^myproject echo "Hello world" All being well, when you commit a change to myproject, you will see the message 'Hello world' in your terminal. Check that the CVS server corectly handles email. By default CVSspam invokes sendmail. Try running sendmail by hand on the CVS server machnine $ echo test | /usr/sbin/sendmail me@somewhere.invalid
Integration with Bugzilla CVSspam can be integrated, to a limited extent, with Bugzilla. When a CVS log comment contains text like Fix for bug nnn, whereby..., the text bug nnn will become a hyperlink to that Bugzilla page in the generated email. To enable this feature, you need to specify the location of bugzilla in CVSspam's configuration file $bugzillaURL = "http://bugzilla.mozilla.org/show_bug.cgi?id=%s" The marker %s will be replaced with the bugId from the log message.
Integration with ViewCVS If you have ViewCVS web-access to your repository, CVSspam can put links to this in the generated emails. The links will be to versions of the file before and after this commit (especialy useful for images, as changes to binary files are not emailed), and to the side-by-site view of the changes that ViewCVS produces. To enable ViewCVS support, you need to specify the URL of the top-level ViewCVS directory in your cvsspam.conf. $viewcvsURL = "http://localhost/cgi-bin/viewcvs.cgi/"