diff options
author | peter <peter@FreeBSD.org> | 1996-02-07 22:35:44 +0800 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-02-07 22:35:44 +0800 |
commit | 969a800fc6467d43f03cd917e06054e2cb630bef (patch) | |
tree | 447a731348de921250f1f6271140330c03e54349 /CVSROOT/log_accum.pl | |
parent | 3d53aca0387a031d14bea7d076f849aea9694a3f (diff) | |
download | freebsd-ports-gnome-969a800fc6467d43f03cd917e06054e2cb630bef.tar.gz freebsd-ports-gnome-969a800fc6467d43f03cd917e06054e2cb630bef.tar.zst freebsd-ports-gnome-969a800fc6467d43f03cd917e06054e2cb630bef.zip |
Attempt to fix some outstanding bugs/misfeatures/bogons in the CVSROOT
code, as well as simplifying some admin procedures.
The main change is to stop multi-directory commits only having the subject
info of the last directory, and not being sent to all the lists, and not
being logged to the appropriate commitlogs.
updateCVSROOT is gone (yay!), it's functionality is replaced by a cvs-1.6
feature - the 'checkoutlist' file, which is designed explicitly for this.
This will stop the easy-import users from getting told the mailing list
is out of date when a committer has been added but had missed out on being
put on the cvs-committers mailing list.
Update the comments and info in the *info files with the cvs-1.6 headers,
this fixes a few typos, clarifys some things, corrects some misleading
comments, etc.
Some stub files added to indicate how new cvs-1.6+ functionality is used,
but left commented out (taginfo, cvswrappers, etc)
All hard-coded references to /home/ncvs are changed back to $CVSROOT
(as suggested to me by bde) now that cvs-1.6+ makes a special effort
to ensure $CVSROOT is always set. This allows the $CVSROOT files to be
used elsewhere (eg: for testing) with much less pain.
mkavail is history as well, it was often being forgotten. cvs-committers
now takes the user list from /etc/group:ncvs via a trivial perl script.
This is so that we still have the ability to temporarily disable commit
access via 'avail' without cutting off the cvs-committers mailing list.
Since /etc/group editing is still required, this is not a new admin
overhead. If we ever change so that membership of "ncvs" is not required
(eg: /usr/bin/cvs becomes setgid and access control is via avail) then
we are going to have to do it some other way. (I have ideas)
I have tested this on my machines, but it is possible that I have missed
something. As usual, please yell if I've botched it.
Diffstat (limited to 'CVSROOT/log_accum.pl')
-rwxr-xr-x | CVSROOT/log_accum.pl | 102 |
1 files changed, 76 insertions, 26 deletions
diff --git a/CVSROOT/log_accum.pl b/CVSROOT/log_accum.pl index 07c5da342369..9b437456405a 100755 --- a/CVSROOT/log_accum.pl +++ b/CVSROOT/log_accum.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# $Id: log_accum.pl,v 1.15 1995/11/27 08:28:42 peter Exp $ +# $Id$ # # Perl filter to handle the log messages from the checkin of files in # a directory. This script will group the lists of files by log @@ -55,6 +55,7 @@ $CVSROOT = "$ENV{'CVSROOT'}"; $AVAIL_FILE = "$CVSROOT/CVSROOT/avail"; $MAIL_FILE = "/tmp/#cvs.mail"; +$SUBJ_FILE = "/tmp/#cvs.subj"; $VERSION_FILE = "version"; $TRUNKREV_FILE = "TrunkRev"; #$CHANGES_FILE = "Changes"; @@ -88,9 +89,14 @@ sub cleanup_tmpfiles { opendir(DIR, "."); if ($all == 1) { push(@files, grep(/$id$/, readdir(DIR))); - push(@files, "$MAIL_FILE.$id.db") if (-e "$MAIL_FILE.$id.db"); + + push(@files, "$MAIL_FILE.$id.db") if (-e "$MAIL_FILE.$id.db"); push(@files, "$MAIL_FILE.$id.dir") if (-e "$MAIL_FILE.$id.dir"); push(@files, "$MAIL_FILE.$id.pag") if (-e "$MAIL_FILE.$id.pag"); + + push(@files, "$SUBJ_FILE.$id.db") if (-e "$SUBJ_FILE.$id.db"); + push(@files, "$SUBJ_FILE.$id.dir") if (-e "$SUBJ_FILE.$id.dir"); + push(@files, "$SUBJ_FILE.$id.pag") if (-e "$SUBJ_FILE.$id.pag"); } else { push(@files, grep(/^$FILE_PREFIX.*$id$/, readdir(DIR))); } @@ -287,21 +293,27 @@ sub do_changes_file { local($changes,$category); local(@text) = @_; - $category = $mlist; - $category =~ s/^cvs-//; - - $changes = "$CVSROOT/CVSROOT/commitlogs/$category"; + dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666); + + foreach $category (keys %MAILFILE) { + if ($category =~ /^cvs-/) { + $category =~ s,\n,,; + $category =~ s/^cvs-//; + $changes = "$CVSROOT/CVSROOT/commitlogs/$category"; - open(CHANGES, ">>$changes") || die("Cannot open $changes.\n"); - print(CHANGES join("\n", @text), "\n\n"); - close(CHANGES); + open(CHANGES, ">>$changes") || die("Cannot open $changes.\n"); + print(CHANGES join("\n", @text), "\n\n"); + close(CHANGES); + } + } + dbmclose(%MAILFILE); } sub do_avail_file { local($where) = @_; local($users,$repo,$who); - dbmopen(MAILFILE, "$MAIL_FILE.$id", 0666); + dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666); open(AVAIL, "<$AVAIL_FILE") || die("Cannot open $AVAIL_FILE.\n"); while(<AVAIL>) { if(/^avail\|([^|]*)\|(.*)$/) { @@ -319,7 +331,7 @@ sub do_avail_file { } } close(AVAIL); - dbmclose(MAILFILE); + dbmclose(%MAILFILE); } sub add_cc { @@ -333,25 +345,33 @@ sub add_cc { $who =~ s/^/"/; $who =~ s/$/"/; - dbmopen(MAILFILE, "$MAIL_FILE.$id", 0666); + dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666); $MAILFILE{$who} = 1; - dbmclose(MAILFILE); + dbmclose(%MAILFILE); } sub mail_notification { local(@text) = @_; local($names); - local($mailing_lists); - $committers = "CVS-committers"; + local($subject); + print "Mailing the commit message...\n"; - dbmopen(MAILFILE, "$MAIL_FILE.$id", 0666); - $mailing_lists = join(' ', $mlist, $committers); - $names = join(" ", keys %MAILFILE) . " $mailing_lists"; + + dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666); + $names = "CVS-committers " . join(" ", keys %MAILFILE); $names =~ s,\n,,; - dbmclose(MAILFILE); + dbmclose(%MAILFILE); - open(MAIL, "| mail -s \"cvs commit: $ARGV[0]\" $names"); + dbmopen(%SUBJFILE, "$SUBJ_FILE.$id", 0666); + $subject = join(" ", keys %SUBJFILE); + $subject =~ s,\n,,; + $subject =~ s,[ ]*, ,; + dbmclose(%SUBJFILE); + + #print "mail -s \"cvs commit: $subject\" $names\n"; + + open(MAIL, "| mail -s \"cvs commit: $subject\" $names"); print(MAIL join("\n", @text)); close(MAIL); } @@ -370,7 +390,7 @@ $state = $STATE_NONE; $login = $ENV{'USER'} || getlogin || (getpwuid($<))[0] || sprintf("uid#%d",$<); @files = split(' ', $ARGV[0]); @path = split('/', $files[0]); -$repository = @path[0]; +$repository = $path[0]; if ($#path == 0) { $dir = "."; } else { @@ -383,6 +403,13 @@ if ($#path == 0) { #print("id - ", $id, "\n"); $mlist = &mlist_map($files[0]); +dbmopen(%MAILFILE, "$MAIL_FILE.$id", 0666); +$MAILFILE{$mlist} = 1; +dbmclose(%MAILFILE); + +dbmopen(%SUBJFILE, "$SUBJ_FILE.$id", 0666); +$SUBJFILE{$ARGV[0]} = 1; +dbmclose(%SUBJFILE); # # Check for a new directory first. This will always appear as a @@ -400,9 +427,33 @@ if ($ARGV[0] =~ /New directory/) { exit 0; } +# Check for an import command. This will always appear as a +# single item in the argument list, and a log message. +# +if ($ARGV[0] =~ /Imported sources/) { + $version = &bump_version if ($cisco_systems != 0); + $header = &build_header($version); + + @text = (); + push(@text, $header); + push(@text, ""); + + push(@text, " ".$ARGV[0]); + &do_changes_file(@text); + + while (<STDIN>) { + chop; # Drop the newline + push(@text, " ".$_); + } + + &mail_notification(@text); + exit 0; +} + #no longer useful. the CC: line would be _too_ big. #&do_avail_file($dir); + # # Iterate over the body of the message collecting information. # @@ -428,11 +479,10 @@ while (<STDIN>) { /^Obtained from:$/i) { next; } -# Not accepted as generally useful yet. -# if (/^CC:/i) { -# &add_cc($_); -# # next; # uncomment this to prevent logging CC: lines -# } + if (/^CC:/i) { + &add_cc($_); + # next; # uncomment this to prevent logging CC: lines + } push (@log_lines, $_); } } |