rubys 01/02/17 11:45:44
Added: proposal/gump nag.pl
Log:
Nag script to inform people of build failures. Based on a script
by Jon Stevens.
Revision Changes Path
1.1 jakarta-alexandria/proposal/gump/nag.pl
Index: nag.pl
===================================================================
#!/usr/bin/perl
#
# Nag people and mailing lists upon particular build events,
# typically failures.
#
($sec,$min,$hour,$mday,$mon,$year) = localtime;
$date=sprintf("%d-%2.2d-%2.2d", $year+1900, $mon+1, $mday);
$url = "http://jakarta.apache.org/builds/gump/$date";
$home = "/www/jakarta.apache.org/builds/gump/$date";
$from = "Sam Ruby <rubys\@apache.org>";
open (LIST, "/home/rubys/bin/naglist");
foreach (<LIST>) {
next if /^#/;
($project, $mailto, $regexp) = / (\S*) \s* (\S*) \s* (\/.*\/) /x;
# if this project hasn't been read before, read it
if (!$hash{$project}) {
$hash{$project} = {};
$hash{$project}->{sentto} = {};
# read the entire file
open (FILE, "$home/$project.html");
$_ = join('',<FILE>);
close (FILE);
# extract the date and just the stuff in the pre tags
if (m! .* <pre> \s* (.*) \s* </pre> !xs) {
$hash{$project}->{pageData} = $1;
} else {
$hash{$project}->{pageData} = "";
}
}
# only nag once per project/mailto pair
next if $hash{$project}->{sentto}->{$mailto};
$pageData = $hash{$project}->{pageData};
if (eval "\$pageData =~ $regexp") {
$hash{$project}->{sentto}->{$mailto}=1;
print "$project $mailto\n";
open ( EMAIL, "| /usr/sbin/sendmail -i -t");
print EMAIL "From: $from\n";
print EMAIL "To: $mailto\n";
print EMAIL "Subject: [GUMP] $project build results\n\n";
print EMAIL "----------------------------------------------------\n";
print EMAIL "This email is autogenerated from the output from:\n";
print EMAIL "<$url/$project.html>\n";
print EMAIL "----------------------------------------------------\n\n";
if ($pageData) {
print EMAIL "$pageData";
} else {
print EMAIL "Build results missing. Please see URL above for details.";
}
close (EMAIL);
}
}
close (LIST);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]