From 2de0f352d91702f591e0559a737c35d2a903fa49 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 9 Apr 2008 09:17:19 +0000 Subject: fix parse-bzr git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@335 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- parse-bzr | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/parse-bzr b/parse-bzr index 932692f..26a65da 100755 --- a/parse-bzr +++ b/parse-bzr @@ -30,9 +30,9 @@ use File::Basename; my $HOME = '/home/commit/'; my $MAX_LINES = 4; -my $ENVELOPE_FROM = 'nobody@ganneff.de'; -my $HEADER_FROM = 'nobody@ganneff.de'; -my $BOT_ADDRESS = 'commit@commit.ganneff.de'; +my $ENVELOPE_FROM = 'nobody@commit.noreply.org'; +my $HEADER_FROM = 'nobody@commit.noreply.org'; +my $BOT_ADDRESS = 'commit@commit.noreply.org'; my $SENDMAIL = '/usr/sbin/sendmail'; $ENV{'PATH'} = '/bin:/usr/bin'; @@ -70,16 +70,16 @@ my $line; while (defined($line = shift @mail)) { my $chomped = $line; -# print "Looking at $chomped\n"; + #print "Looking at $chomped\n"; chomp $chomped; next if length($chomped) <= 2; if ($chomped =~ m/^revno: (\d+)/) { $rev=$1 unless defined($rev); next; - } elsif ($chomped =~ m/Subject: \[.*\] (.*) (r[0-9]+):.*/) { + # Subject: bzr/dsa-nagios/trunk r119: tweaks + } elsif ($chomped =~ m/Subject: (\S+)/) { $subdir = $1; - $subdir =~ s#./##; - $rev=$1 unless defined($rev); + $subdir =~ s#.*?/##; next; } elsif ($chomped =~ m/^committer: (.*)/) { $who = $1; @@ -108,26 +108,19 @@ while (defined($line = shift @mail)) { die ("$PROGRAM_NAME - $project: No author found.\n") unless defined $who; - -# print "From: $HEADER_FROM\n"; -# print "To: $BOT_ADDRESS\n"; -# print "Subject: Announce $project\n"; -# print "Precedence: junk\n"; -# print "\n"; -# print "[$subdir] (branch: $branch) $who committed revision $rev at $timestamp\n"; -# foreach (@message) { -# print "$_\n"; -# } +die ("$PROGRAM_NAME - $project: No subdir found.\n") unless defined $subdir; -open(MAIL, "|$SENDMAIL -t -oi -f $ENVELOPE_FROM") or - die ("Cannot exec sendmail: $!\n"); +#open(MAIL, "|$SENDMAIL -t -oi -f $ENVELOPE_FROM") or +# die ("Cannot exec sendmail: $!\n"); +open(MAIL, "|cat"); print MAIL "From: $HEADER_FROM\n"; print MAIL "To: $BOT_ADDRESS\n"; print MAIL "Subject: Announce $project\n"; print MAIL "Precedence: junk\n"; print MAIL "\n"; -if ($branch eq basename($subdir) ) { + +if ($branch eq basename($subdir) || ($branch eq dirname($subdir) && basename($subdir) eq 'trunk')) { print MAIL "[$subdir] $who committed revision $rev at $timestamp\n"; } else { print MAIL "[$subdir] (branch-nick: $branch) $who committed revision $rev at $timestamp\n"; -- cgit v1.2.3