mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-08 14:03:49 +00:00
Whoops; the version of dolog.pl we had was ancient and wrong.
This commit is contained in:
parent
210d6c9960
commit
a498d5ccf1
@ -265,7 +265,9 @@ doeditwhiteboard.cgi TCL. Edits the free-for-all whiteboard.
|
||||
Calls:
|
||||
nobody
|
||||
|
||||
dolog.pl ???
|
||||
dolog.pl Perl. Magic file that causes CVS to send mail to
|
||||
Bonsai whenever someone makes a change. Please read
|
||||
the comments towards the beginning for more clues.
|
||||
|
||||
dotweak.cgi TCL. Tweaks a bunch of checkins in ahook at once.
|
||||
Called by:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bonsaitools/bin/perl --
|
||||
#! /tools/ns/bin/perl5
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
@ -17,10 +17,28 @@
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
|
||||
$cvsroot = substr(<STDIN>, 0, -1);
|
||||
|
||||
# You need to put this in your CVSROOT directory, and check it in. (Change the
|
||||
# first line above to point to a real live perl5.) Then, add a line to your
|
||||
# CVSROOT/loginfo file that says something like:
|
||||
#
|
||||
# ALL $CVSROOT/CVSROOT/dolog.pl -r /cvsroot bonsai-checkin-daemon@my.bonsai.machine
|
||||
#
|
||||
# Replace "/cvsroot" with the name of the CVS root directory, and
|
||||
# "my.bonsai.machine" with the name of the machine Bonsai runs on.
|
||||
# Now, on my.bonsai.machine, add a mail alias so that mail sent to
|
||||
# "bonsai-checkin-daemon" will get piped to handleCheckinMail.tcl.
|
||||
# The first argument to handleCheckinMail.tcl is the directory that
|
||||
# bonsai is installed in.
|
||||
|
||||
|
||||
$username = getlogin || (getpwuid($<))[0] || "nobody";
|
||||
$MAILER = "/usr/lib/sendmail -t";
|
||||
$envcvsroot = $ENV{'CVSROOT'};
|
||||
$cvsroot = $envcvsroot;
|
||||
$flag_debug = 0;
|
||||
$flag_tagcmd = 0;
|
||||
$repository = substr(<STDIN>, 0, -1);
|
||||
$repository = '';
|
||||
$repository_tag = '';
|
||||
|
||||
@mailto=();
|
||||
@ -44,6 +62,7 @@ if ($flag_debug ){
|
||||
print STDERR " pwd:" . `pwd` . "\n";
|
||||
print STDERR " Args @ARGV\n";
|
||||
print STDERR " CVSROOT: $cvsroot\n";
|
||||
print STDERR " who: $username\n";
|
||||
print STDERR " Repository: $repository\n";
|
||||
print STDERR " mailto: @mailto\n";
|
||||
print STDERR "----------------------------------------------\n";
|
||||
@ -73,27 +92,30 @@ sub process_args {
|
||||
if ($arg eq '-d') {
|
||||
$flag_debug = 1;
|
||||
print STDERR "Debug turned on...\n";
|
||||
} elsif ($arg eq '-r') {
|
||||
$cvsroot = shift @ARGV;
|
||||
} elsif ($arg eq '-t') {
|
||||
$flag_tagcmd = 1;
|
||||
last; # Keep the rest in ARGV; they're handled later.
|
||||
} else {
|
||||
$flag_tagcmd = 1;
|
||||
last; # Keep the rest in ARGV; they're handled later.
|
||||
} else {
|
||||
push(@mailto, $arg);
|
||||
}
|
||||
}
|
||||
if( $repository eq '' ){
|
||||
open( REP, "<CVS/Repository");
|
||||
$repository = <REP>;
|
||||
chop($repository);
|
||||
close(REP);
|
||||
open( REP, "<CVS/Repository");
|
||||
$repository = <REP>;
|
||||
chop($repository);
|
||||
close(REP);
|
||||
}
|
||||
$repository =~ s:^$cvsroot/::;
|
||||
$repository =~ s:^$envcvsroot/::;
|
||||
|
||||
if (!$flag_tagcmd) {
|
||||
if( open( REP, "<CVS/Tag") ) {
|
||||
$repository_tag = <REP>;
|
||||
chop($repository_tag);
|
||||
close(REP);
|
||||
}
|
||||
if( open( REP, "<CVS/Tag") ) {
|
||||
$repository_tag = <REP>;
|
||||
chop($repository_tag);
|
||||
close(REP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,13 +127,8 @@ sub get_loginfo {
|
||||
|
||||
# Iterate over the body of the message collecting information.
|
||||
#
|
||||
$state = $STATE_NONE;
|
||||
while (<STDIN>) {
|
||||
chop; # Drop the newline
|
||||
|
||||
if (/^__BONSAI__SEPARATOR__MAGIC__$/) {
|
||||
last;
|
||||
}
|
||||
chop; # Drop the newline
|
||||
|
||||
if( $flag_debug){
|
||||
print STDERR "$_\n";
|
||||
@ -126,8 +143,8 @@ sub get_loginfo {
|
||||
if (/^Removed Files/) { $state = $STATE_REMOVED; next; }
|
||||
if (/^Log Message/) { $state = $STATE_LOG; next; }
|
||||
|
||||
s/^[ \t\n]+//; # delete leading whitespace
|
||||
s/[ \t\n]+$//; # delete trailing whitespace
|
||||
s/^[ \t\n]+//; # delete leading whitespace
|
||||
s/[ \t\n]+$//; # delete trailing whitespace
|
||||
|
||||
if ($state == $STATE_CHANGED) { push(@changed_files, split); }
|
||||
if ($state == $STATE_ADDED) { push(@added_files, split); }
|
||||
@ -146,39 +163,38 @@ sub get_loginfo {
|
||||
}
|
||||
|
||||
sub process_cvs_info {
|
||||
local($d,$fn,$rev,$mod_time,$sticky,$tag,$stat,@d,$rcsfile);
|
||||
local($d,$fn,$rev,$mod_time,$sticky,$tag,$stat,@d,$l,$rcsfile);
|
||||
open(ENT, "<CVS/Entries" );
|
||||
$time = time;
|
||||
while( <STDIN> ){ # Parsing the Entries file, actually.
|
||||
while( <ENT> ){
|
||||
chop;
|
||||
$fn = "";
|
||||
($d,$fn,$rev,$mod_time,$sticky,$tag) = split(/\//);
|
||||
$stat = 'C';
|
||||
for $i (@changed_files, "BEATME.NOW", @added_files ) {
|
||||
if( $i eq "BEATME.NOW" ){ $stat = 'A'; }
|
||||
if($i eq $fn ){
|
||||
$rcsfile = "$cvsroot/$repository/$fn,v";
|
||||
$rcsfile = "$envcvsroot/$repository/$fn,v";
|
||||
if( ! -r $rcsfile ){
|
||||
$rcsfile = "$cvsroot/$repository/Attic/$fn,v";
|
||||
$rcsfile = "$envcvsroot/$repository/Attic/$fn,v";
|
||||
}
|
||||
open(LOG, "/tools/ns/bin/rlog -N -r$rev $rcsfile |")
|
||||
|| print STDERR "dolog.pl: Couldn't run rlog\n";
|
||||
$username = "nobody";
|
||||
$lines_added = 0;
|
||||
$lines_removed = 0;
|
||||
while(<LOG>){
|
||||
if (/^date:.* author: ([^;]*);.*/) {
|
||||
$username = $1;
|
||||
if (/lines: \+([0-9]*) -([0-9]*)/) {
|
||||
$lines_added = $1;
|
||||
$lines_removed = $2;
|
||||
}
|
||||
if( /^revision /){
|
||||
$l = <LOG>;
|
||||
chop($l);
|
||||
if( $flag_debug ){ print STDERR "$l\n";}
|
||||
@d = split(/[ ]+/,$l);
|
||||
$lines_added = $d[8];
|
||||
$lines_removed = $d[9];
|
||||
}
|
||||
}
|
||||
close( LOG );
|
||||
push(@outlist, ("$stat|$time|$username|$cvsroot|$repository|$fn|$rev|$sticky|$tag|+$lines_added|-$lines_removed\n"));
|
||||
push(@outlist, ("$stat|$time|$username|$cvsroot|$repository|$fn|$rev|$sticky|$tag|$lines_added|$lines_removed\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
close(ENT);
|
||||
|
||||
for $i (@removed_files) {
|
||||
push( @outlist, ("R|$time|$username|$cvsroot|$repository|$i|||$repository_tag\n"));
|
||||
@ -195,12 +211,12 @@ sub process_tag_command {
|
||||
$time = time;
|
||||
$str = "Tag|$cvsroot|$time";
|
||||
while (@ARGV) {
|
||||
$part = shift @ARGV;
|
||||
$str .= "|" . $part;
|
||||
$part = shift @ARGV;
|
||||
$str .= "|" . $part;
|
||||
}
|
||||
push (@outlist, ("$str\n"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sub do_commitinfo {
|
||||
@ -210,11 +226,13 @@ sub do_commitinfo {
|
||||
|
||||
sub mail_notification {
|
||||
|
||||
my $filename = "data/temp.$$";
|
||||
open(OUT, ">$filename") || die "Couldn't open output file.";
|
||||
print OUT "dummy: line preteending to be mail headers\n\n";
|
||||
print OUT @outlist, "\n";
|
||||
close OUT;
|
||||
system "./addcheckin.tcl $filename";
|
||||
# rm $filename;
|
||||
open(MAIL, "| /bin/mail @mailto");
|
||||
if ($flag_tagcmd) {
|
||||
print MAIL "Subject: cvs tag in $repository\n";
|
||||
} else {
|
||||
print MAIL "Subject: cvs commit to $repository\n";
|
||||
}
|
||||
print MAIL "\n";
|
||||
print MAIL @outlist, "\n";
|
||||
close(MAIL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user