From 49cd23b8d7ea17b0cf43b7c02e444fb10b56590d Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 5 Jul 2006 05:07:00 +0000 Subject: CarpetWeb: Update patchset-to-email gateway script Apparently darcs now passes the repository as command line argument. Don't get confused, and save the repository for later. darcs-hash:20060705050726-dae7b-22d9e6a007c9b05d34d78f07eb77db6db790b692.gz --- Carpet/CarpetWeb/scripts/darcs0 | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Carpet/CarpetWeb/scripts') diff --git a/Carpet/CarpetWeb/scripts/darcs0 b/Carpet/CarpetWeb/scripts/darcs0 index d42566801..8ec50d35e 100755 --- a/Carpet/CarpetWeb/scripts/darcs0 +++ b/Carpet/CarpetWeb/scripts/darcs0 @@ -20,9 +20,20 @@ my %comments = (); # sanity check die "Couldn't find executable '$darcs'!\n\n" if (! -x $darcs); +open (LOG, ">> /home/darcs/LOG"); +print LOG "\n"; +print LOG "darcs called:\n"; +print LOG "date: ", `date`, "\n"; +print LOG "arguments: ", join (' ', @ARGV), "\n"; + # short cut for darcs commands other than 'apply --all' +$repodir = ''; exec ($darcs, @ARGV) - if (! ($#ARGV == 1 && $ARGV[0] eq 'apply' && $ARGV[1] eq '--all')); + if (! ($#ARGV == 1 && ($ARGV[0] eq 'apply' && $ARGV[1] eq '--all')) && + ! ($#ARGV == 3 && ($ARGV[0] eq 'apply' && $ARGV[1] eq '--all' && + $ARGV[2] eq '--repodir' && ($repodir = $ARGV[3])))); + +print LOG "calling darcs:\n"; # open a pipe for running darcs on the other end open (DARCS, "| $darcs @ARGV") || die "Couldn't open pipe to darcs !\n"; @@ -31,6 +42,7 @@ open (DARCS, "| $darcs @ARGV") || die "Couldn't open pipe to darcs !\n"; while () { print DARCS; + print LOG; last if (/^New patches:$/); } @@ -41,6 +53,7 @@ my $endmarker = '] {'; while () { print DARCS; + print LOG; # each patch starts with a line '[' next if (! /^\[(.+)$/); @@ -50,6 +63,7 @@ while () # and the timestamp of the patch $_ = ; print DARCS; + print LOG; next if (! /^(.+)\*\*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})($endmarker)??$/o); # add this patch to the database @@ -64,6 +78,7 @@ while () while () { print DARCS; + print LOG; last if (/^$endmarker$/); $comments{$patch} .= $_; } @@ -75,12 +90,17 @@ while () while () { print DARCS; + print LOG; last if (/^}$/); } } close (DARCS) || die "Failed to run darcs command '$darcs @ARGV'\n"; +print LOG "(that was the patch set)\n"; +print LOG "submitters: ", join (' ', %submitters), "\n"; +print LOG "done.\n"; + # now send out notification email(s) foreach $patch (keys %submitters) { @@ -92,8 +112,10 @@ foreach $patch (keys %submitters) open (NOTIFY, '|-') || exec 'mail', '-s', $patch, $email_list; #print NOTIFY "A new patch has been pushed into the Carpet repository:\n\n"; - $repodir = `pwd`; - chomp $repodir; + if ($repodir eq '') { + $repodir = `pwd`; + chomp $repodir; + } $repodir =~ s+^.*/home/+~+; print NOTIFY "The Carpet repository at $repodir received a new patch:\n\n"; print NOTIFY " $patch\n\n"; -- cgit v1.2.3