![]() |
|
ADSP 21xx
Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now? Please make a donation to help with maintenance. |
CVS E-Mail Notification HowtoHerman July 2002 GeneralCVS can generate mail based on a number of events, such
as:
This sounds easy enough, but nothing ever is... Watch NotificationsThe watch notifications are not very useful. If you place a watch on a file, CVS will notify you when somebody else changes that file. This is controlled by two configuration files:
The notify file contains the mail program invocation and the users file maps the CVS user names to their e-mail addresses. Commit NotificationsCommit notifications are controlled by either the .modules files using the -i option (not recommended) or the loginfo file. The loginfo file contains a line or two to control the logging of commits and can also call an external program to mail notifications. The problem however, is that we need to send the log message to two places: A log file and the mail program. We therefore have to save it in a temporary file tmplog and then read it back to append to the commitlog file and pipe into the mail program. Loginfo calls the mail user agent. This user agent, uses the nullmailer mail transport agent to deliver the mail to the exchange server. The mail program is invoked with a short shell script mailer, which sends the mail to the head honcho and CC everybody else, so that everybody working on the project get the mail.
Loginfo:
ALL (echo ""; id; echo %{sVv}; date; cat) > $CVSROOT/CVSROOT/tmplog
GAP $CVSROOT/CVSROOT/mailer %s
The mailer script:
#! /bin/sh
MAILLIST="-c slaveuser@sweatshop.com \
-c anotherslaveuser@sweatshop.com \
...
headhoncho@sweatshop.com"
cat $CVSROOT/CVSROOT/tmplog >> $CVSROOT/CVSROOT/commitlog
cat $CVSROOT/CVSROOT/tmplog | /bin/mail -s "CVS Commit $1" $MAILLIST
exit 0
Note that the files commitlog and tmplog must exist, owned by user cvs and read/write by everybody (666). The Nullmailer Mail Transport AgentYou can use sendmail as a MTA, but it is rather difficult to configure. Nullmailer is a simple mail forwarding agent that has only one thing to configure, namely who to send the mail to. It is hard to get any simpler than that. Nullmailer also provides a spoof program to make other programs think that they are talking to sendmail. Before installing nullmailer, first delete all traces of sendmail, then create a user and group called nullmail. Also make the cvs user part of this group: #groupadd nullmail #useradd -g nullmail Build nullmailer the usual way: #./configure #make #make install This will create mail queues in a weird place: /usr/local/var/nullmailer Configure nullmailer with a single configuration file /usr/local/etc/nullmailer/remotes and add the line: 192.168.1.223 smtp which is simply the IP address and protocol type used by the exchange server. Edit the file /etc/rc.d/rc.local and add the line: /usr/local/sbin/nullmailer-send & to the end of the file, so that nullmailer will run the next time the server reboots. Run nullmailer to get it going: #/usr/local/sbin/nullmailer-send & Copy the nullmailer sendmail spoof to the usual sendmail position, so other programs such as mail, can find it: #cp whereever /nullmail/src/sendmail /usr/sbin/. Test NullmailerYou can test nullmailer by sending a message to yourself, eg: #mail -s "Test message" joesoap@sweatshop.com whatever [enter] .[enter] Test the mailer scriptNow that nullmailer is working, test the mailer script: #echo testbody > tmplog #mailer testsubject Everybody should receive the message. Test CVS CommitFinally, you can test CVS by committing a file. It should call the mailer script and everybody should get the name of the file that changed in the mail subject line, and the complete log message in the mail body. |
|
Copyright © 2005-2008, Aerospace Software Ltd., GPL. |