Programmers' Canvas Toolkit Home

DevGuy CVS LogInfo, TagInfo, and Notify Scripts

Stay in Sync

 

29 Mar 2004 18:20

Download XML Cooktop, the free XML editor for Windows

 

Perl Regular Expressions

 
Similar tools
 
CVSNotify-Doc
 
License
 
 
 

This Documentation is Old!

The information contained herein is for PCTKEXE 1.8 only.  A newer version with more features is available here.

 

 

 

 

 

 


Notes

  1. Regarding the dgtaginfo script, only CVSNT build 62 and later is supported.  Using any taginfo scripts with any version of CVSNT prior to build 62 on Windows can result in CVS.EXE crashing during tagging operations.  The taginfo script will not work with "vanilla" CVS servers.
  2. It is not recommended that you send dgtaginfo notifications via email.  If a large number of files are tagged, the file can easily exceed half a megabyte.
  3. Regarding the loginfo scripts on CVSNT build 62 and possibly later, the <Path> regular expression in the CVSNotify-Doc runs against the relative CVS module name, not the physical CVS repository server path.  A sample regular expression is ^/source/java/.  When CVSNT fixes the issue, the script will automatically use the physical server path instead, which will probably break your configuration!

Authors and Credits

  • Gyula Faller wrote the initial CVS loginfo script that generates HTML
  • Thanks to Bo Berglund and Tony Hoyle for providing invaluable information.  Try Bo's CVS Mailer for Windows -- you will find it easier to use compared to what you see here.  Bo's scripts work for 99% of the users out there.  The scripts herein cover the remaining 1% by providing newsgroup postings and uber-configurability such as multiple ViewCVS repositories.
  • Eugene Rimsky (ecu) submitted a patch for the HTML-based CVS loginfo for ViewCVS
  • Many thanks to those who submitted bug reports feature requests!

Introduction

These instructions only apply to PCTK version 1.5 and later.  The  TagInfo scripts were added in version 1.6.18.

  • The CVS "loginfo" script notifies CVS users when a file is "commit"ted to the repository
  • The CVS "taginfo" script notifies CVS users when files are tagged, or when tags are removed
  • The CVS "notify" script notifies CVS users when a file is "edit"ed or "commit"ted.  Only the "watchers" of files are notified.  Notifications are sent via email (SMTP).

DevGuy has provided, via the GPL, free loginfo, taginfo, and notify scripts that can be installed on any Windows or [UNI]+X CVS server.

  • See the License
  • Loginfo messages can be sent via email (SMTP), newsgroup posts, or IRC (or any combination thereof).  The format of the message can be plain text or HTML.
  • Taginfo messages are sent via email (SMTP), newsgroup posts, or IRC (or any combination thereof).  Rather than sending notifications for each module affected (like the loginfo scripts), the taginfo script "batches" changes made to multiple modules in a single message.
  • Notify messages are sent via email (SMTP)
  • All scripts are highly configurable
    • Directories and branches in the CVS repository can be mapped to specific email addresses, newsgroups, and CVSWeb URLs.  Defaults are provided via globals.xml.
    • SMTP (email) and NNTP (newsgroup) servers are specified via globals.xml and CVSInfo-Doc
    • The colors used in HTML messages can be customized by modifying globals.xml

License and Source Code

Everything you see here is public domain open source.

The Perl source code is located here and hereSee here for CVS details.


Assistance / Support

Visit the bulletin boards for help.


LogInfo Notes

One email is sent per commit.  The loginfo scripts do not "batch" commit notices.  The text-based scripts are similar but do not provide CVSWeb/ViewCVS links.  There are other scripts available on the Internet that perform batching.


TagInfo Script FAQ

It is not recommended that you send taginfo notifications via email.  If a large number of files are tagged, the file can easily exceed half a megabyte.

Only CVSNT build 62 and later is supported.  Using any taginfo scripts with any version of CVSNT prior to build 62 on Windows can result in CVS crashing during tagging operations.  The taginfo script will not work with "vanilla" [UNI]+X CVS servers.

The taginfo scripts batch all tag operations (independent of who performs them) until a 5 minute interval is detected in which no tagging takes place.  The interval is configurable.

The taginfo script can slow down tagging operations substantially and so I don't recommend you use it.  I haven't looked into the reasons why, but it's probably the XML parser.  As of March 10 2004 performance is being addressed, stay tuned.


Sample HTML Loginfo Message

Subject Line

The branch tag name and module name appear in the subject line:

CVS commit [B20020710]

Body

2002-08-16 Friday 04:15 buildmaster
build:

 
* build_stamp_qa.txt (1.536=>1.537)

 
Buildmaster is incrementing the last build tag to Q2002_0816_000102

Browse CVS

build_stamp_qa.txt is a link to the file on CVSWeb or ViewCVS.  1.536=>1.537 is a link to a CVSWeb or ViewCVS page that shows the differences between the revisions.  If a commit is made to a branch, the branch name is shown in the message.  Colors and day-of-week names are configured via globals.xml.


See Also


System Requirements

These scripts work on Windows NT4, 2000, XP, and [UNI]+X.  The 'Server' flavor of Windows is required to install IIS's NNTP (news) server.


Optional Software To Install First - Windows

  • IIS 4 or 5 News (NNTP) Server - Windows 2000 Server Only (possibly XP Server) -- Workstation does not work!
    • This step is optional
    • This is needed to post commit and tag notifications.  Notifications can be sent via email instead.
    • You can also use Hamster as a news server (does not require Server flavor of Windows)
    • The news server can also be installed on a [UNI]+X machine.  Refer to the inn instructions
    • The news server can be installed on a different machine from the CVS server
    • To install the IIS NNTP server,
      1. Go to Control Panel, then Add/Remove Programs
      2. Click on IIS
      3. Click Details...
      4. Click NNTP Server
      5. Run Internet Services Manager to configure the newsgroups

CVS Users File

The users file in the CVSROOT module contains lines that look like:

joeuser:jshmo@yahoo.com

CVS uses this file to map CVS user names to email addresses.

DevGuy's notify scripts use this file automatically to send emails to the correct email address when an eligible event occurs to a watched file.  If you don't have a users file in the CVSROOT module, or if the user isn't listed in this file, the notify script appends a default email domain to the CVS user name which is specified in the globals.xml file.

DevGuy's loginfo scripts use the users file to properly populate the "From" field when sending emails or newsgroup posts in the same manner.


Installation - Windows

Please note:

The installation programs contained herein require Microsoft Installer 2.0.  The setup programs will install Microsoft Installer 2.0 if it is not present.  It is extremely dangerous to install Microsoft Installer over a remote Terminal Services connection.  In addition, if Terminal Services is installed, Terminal Services must be in Remote administration mode rather than Application server mode.  Before installing anything it is advised that you create an Emergency Repair Disk.  Failure to heed all of this advice can result in a hosed machine that must be reformatted.  In no circumstances shall DevGuy be held liable for any damage to your machine made directly or indirectly by the installation programs.

  • Before installing a new version of the toolkit, copy globals.xml to a safe place, run the installation program, and merge your changes back in, e.g., set your smtp server, email domain, and CVSWeb URL.  Nice diff/merge programs such as Araxis Merge can make merging globals.xml substantially easier.
  • Tip:  If you put globals.xml in a separate folder and point the devguy_globals environment variable to it, you won't have upgrade headaches with globals.xml later
  • Run the installation program - make sure to install 1.8.2.X or earlier version
  • Add the installation directory (e.g., c:\program files\devguy\pctk) to your system path and reboot
  • Configure the software and alter the CVSROOT/loginfo, CVSROOT/taginfo, and CVSROOT/notify files as described below
  • All CVS users (hint:  it's easier if you put them in a group) must have read/execute privileges on %systemroot%\system32\cmd.exe (e.g. c:\windows\system32\cmd.exe) -- this is limited to administrators on Windows 2003

Alternatively, you can install the scripts rather than executables.  Follow the source code installation instructions on the install page.


Installation - [UNI]+X or Perl Source Code


Configuration

  1. Modify globals.xml
    • Download XML Cooktop, the free XML editor for Windows
    • The location of globals.xml can be specified by the optional devguy_globals environment variable, which is automatically set if you use the installation program for Windows
    • All of the following settings are optional
    • Alter <CVSNotifyPath> to contain a file directory which will hold temporary files (defaults to the TEMP environment variable) -- It is important to set <CVSNotifyPath> because the CVS service probably runs as the SYSTEM user and the dgcvsnotifydaemon process probably runs as a different user, and these user's TEMP environment variables are probably different
    • Alter <SMTPServer> to contain your SMTP server
    • Alter <EmailDomain> to contain the domain from which emails are sent
    • Alter <LogInfoXML> to contain the path of the CVSNotify-Doc file
    • Alter <CVSEmailGroup> to contain a default email address (or list of comma-separated email addresses) to send commit emails to.  Can be overridden  in CVSNotify-Doc.
    • Alter <TagInfoEmailGroup> to contain a default email address (or list of comma-separated email addresses) to send taginfo emails to.  Can be overridden  in CVSNotify-Doc.
    • Alter <CVSWebURL> to contain the URL to your CVSWeb or ViewCVS server.  Can be overridden  in CVSNotify-Doc.
    • If you're using CVSWeb (not ViewCVS), create the element <CVSWeb>1</CVSWeb>
      • This is supported in 1.8.2.14 and later only
    • Alter <CVSWebURLQuery> to contain the URL query to your CVSWeb or ViewCVS server.  Can be overridden  in CVSNotify-Doc.  Example: root=foo
    • Alter <NNTPServer> to contain the name of a newsgroup server.  Can be overridden in CVSNotify-Doc.
    • Alter <LogInfoNewsgroup> if you're using the newsgroup-posting scripts.  Defaults to engineering.checkins.   Can be overridden  in CVSNotify-Doc.
    • Alter <TagInfoNewsgroup> to contain the name of a newsgroup in which to post taginfo notifications.  Can be overridden  in CVSNotify-Doc.
  2. For loginfo messages, if you use one of the HTML flavors (email or newsgroup), create a CVSNotify-Doc document (optional)
  3. For taginfo messages, create a CVSNotify-Doc document (optional)
  4. Alter the CVS loginfo, taginfo, and/or notify files
  5. Create the newsgroup(s) (optional)

    The newsgroup name defaults to engineering.checkins but the name can be specified in globals.xml or in CVSNotify-Doc.

    On Windows 2000, run the Internet Services administration tool.  Click on NTTP.  Add the group engineering.checkins.

    On Linux:

    1. Enter: ctlinnd newgroup engineering.checkins
    2. Add the following line to /etc/news/expire.ctl:
      engineering.checkins:A:1:90:never
      The messages will expire after 90 days.
  6. If you wish to set up the taginfo notification, start the "daemon" process which reads an accumulating log file which the taginfo file writes to.  The daemon sends notifications when the file contains data and has not been written to for five minutes.  This prevents excessive emails/newsgroups posts.
    • Perl version, for Windows and [UNI]+X
      perl -S dgcvsnotifydaemon.pl
    • Executable version, for Windows
      dgcvsnotifydaemon.exe
      If you use Windows 2000 or later you can run this process when Windows starts via the Windows Scheduler.
    • dgcvsnotifydaemon takes an optional parameter, which is the number of seconds that must pass after the last CVS activity before notification messages are sent.  It defaults to five minutes.

CVS Loginfo File

Alter the file CVSROOT/loginfo in CVS by first checking it out, modifying it (see below), and checking it back in.

The double-double quotes (""%{sVv}"") used with the HTML scripts is not a typo and is needed to support filenames that contain ampersands.  However, double-double quotes only works in builds 1.8.2.4 and later.  If using an eariler build, only use single double-quotes ("%{sVv}").

Perl Versions (Windows and [UNI]+X)

  1. HTML Email and Newsgroup Post
    DEFAULT perl -S dgloginfohtmlnntpemail.pl ""%{sVv}"" "$USER"
  2. HTML Email
    DEFAULT perl -S dgloginfohtmlemail.pl ""%{sVv}"" "$USER"
  3. HTML Newsgroup
    DEFAULT perl -S dgloginfohtml.pl ""%{sVv}"" "$USER"
  4. Plain Text Email
    DEFAULT perl -S dgloginfoemail.pl "%{sVv}" "$USER"
  5. Plain Text Newsgroup
    DEFAULT perl -S dgloginfo.pl "%{sVv}" "$USER"

EXE Versions (Windows only)

  1. HTML Email and Newsgroup Post
    DEFAULT dgloginfohtmlnntpemail ""%{sVv}"" "$USER"
  2. HTML Email
    DEFAULT dgloginfohtmlemail ""%{sVv}"" "$USER"
  3. HTML News
    DEFAULT dgloginfohtml ""%{sVv}"" "$USER"
  4. Plain Text Email
    DEFAULT dgloginfoemail "%{sVv}" "$USER"
  5. Plain Text Newsgropup
    DEFAULT dgloginfo "%{sVv}" "$USER"

CVS Taginfo File

Alter the file CVSROOT/tag by first checking it out, modifying it (see below), and checking it back in.

Perl Version (Windows or Linux)

DEFAULT perl -S dgtaginfo.pl "$USER"

EXE Versions (Windows only)

DEFAULT dgtaginfo "$USER"


CVS Notify File

Alter the file CVSROOT/notify by first checking it out, modifying it (see below), and checking it back in.

Perl Version (Windows and [UNI]+X)

ALL perl -S cvs_notify.pl "%s"

EXE Version (Windows only)

ALL dgnotify "%s"


Directory-Specific Configuration via the CVSNotify-Doc XML Document

It is not currently possible, nor is it recommended, to send taginfo notifications via email.  If a large number of files are tagged, emails can easily exceed half a megabyte.

This optional XML document maps physical directories on the CVS server (except on CVSNT build 62 and later, which only provides the CVS module) to specific email addresses, newsgroups, and CVSWeb URLs.

  • For loginfo, CVSNotify-Doc only applies to notifications in HTML format.  The plain text message format for loginfo has been deprecated.
  • If a server contains multiple CVS repositories it is necessary to specify a different CVSWeb URL for each repository.  For instance, if you have two repositories "repo1" and "repo2", the URL to CVSWeb varies:
  1. http://tiger/cgi-bin/cvsweb/cvsweb.cgi/repo1/foo/bar
  2. http://tiger/cgi-bin/cvsweb/cvsweb.cgi/repo2/baf/zap