diff options
author | des <des@FreeBSD.org> | 2003-05-16 07:54:47 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-05-16 07:54:47 +0000 |
commit | 98685b881472fb002a0509b6090a994365270c9e (patch) | |
tree | f6cc2dbd3d3df3fdae8746f366119266243291a0 /tools | |
parent | 16db6492801ee7a156b4a751600be99d8597dad2 (diff) | |
download | FreeBSD-src-98685b881472fb002a0509b6090a994365270c9e.zip FreeBSD-src-98685b881472fb002a0509b6090a994365270c9e.tar.gz |
Overhaul the reporting code, making sender, recipient and subject fully
configurable.
Add support for tinderbox.pl's --patch.
-STABLE releases won't build with NOPERL (kernel builds use Perl).
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/tinderbox/tbmaster.pl | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/tools/tools/tinderbox/tbmaster.pl b/tools/tools/tinderbox/tbmaster.pl index b5fe812..e5ffc80 100644 --- a/tools/tools/tinderbox/tbmaster.pl +++ b/tools/tools/tinderbox/tbmaster.pl @@ -40,7 +40,10 @@ my %CONFIGS = ( 'SANDBOX' => '/home/des/tinderbox', 'LOGDIR' => '/home/des/public_html', 'OPTIONS' => [ '--verbose' ], - 'EMAIL' => 'des+%%arch%%-%%branch%%@freebsd.org', + 'SENDER' => 'Tinderbox <des+tinderbox@freebsd.org>', + 'RECIPIENT' => 'des+%%arch%%-%%branch%%@freebsd.org', + 'SUBJECT' => '[%%COMMENT%%] failure on %%arch%%/%%machine%%', + 'ENV' => { }, }, @@ -54,7 +57,7 @@ my %CONFIGS = ( 'ia64' => [ 'ia64' ], 'sparc64' => [ 'sparc64' ], }, - 'EMAIL' => 'current@freebsd.org,%%arch%%@freebsd.org', + 'RECIPIENT' => 'current@freebsd.org,%%arch%%@freebsd.org', }, 'triangle' => { @@ -68,7 +71,7 @@ my %CONFIGS = ( 'ENV' => { 'MAKE_KERBEROS5' => 'YES', }, -# 'EMAIL' => 'stable@freebsd.org,%%arch%%@freebsd.org', +# 'RECIPIENT' => 'stable@freebsd.org,%%arch%%@freebsd.org', }, '9ball' => { @@ -94,7 +97,6 @@ my %CONFIGS = ( }, 'ENV' => { 'NOLIBC_R' => 'YES', - 'NOPERL' => 'YES', 'NOPROFILE' => 'YES', 'NO_BIND' => 'YES', 'NO_FORTRAN' => 'YES', @@ -119,30 +121,53 @@ my %CONFIGS = ( }, }, ); -my %CONFIG = (); -my $TINDERBOX; +my $config; # Name of current config +my %CONFIG = (); # Current config +my $TINDERBOX; # Tinderbox script -sub report($$$) { +sub report($$$$) { + my $sender = shift; my $recipient = shift; my $subject = shift; my $message = shift; local *PIPE; - if (!open(PIPE, "|-", "/usr/bin/mail -s'$subject' $recipient") || - !print(PIPE $message) || !close(PIPE)) { - print(STDERR "Subject: $subject\n\n"); + if (open(PIPE, "|-", "/usr/sbin/sendmail -t -f$sender")) { + print(PIPE "Sender: $sender\n"); + print(PIPE "From: $sender\n"); + print(PIPE "To: $recipient\n"); + print(PIPE "Subject: $subject\n"); + print(PIPE "\n"); + print(PIPE "$message\n"); + print(STDERR "mailed report to $recipient\n"); + close(PIPE); + } else { print(STDERR "[failed to send report by email]\n\n"); print(STDERR $message); - } else { - print(STDERR "mailed report to $recipient\n"); } } +sub expand($) { + my $str = shift; + + while (my ($key, $val) = each(%CONFIG)) { + next if ref($val); + $str =~ s/\%\%$key\%\%/$val/g; + ($key, $val) = (lc($key), lc($val)); + $str =~ s/\%\%$key\%\%/$val/g; + } + return $str; +} + sub tinderbox($$$) { my $branch = shift; my $arch = shift; my $machine = shift; + $CONFIG{'BRANCH'} = $branch; + $CONFIG{'ARCH'} = $arch; + $CONFIG{'MACHINE'} = $machine; + # Open log files: one for the full log and one for the summary my $logfile = "$CONFIG{'LOGDIR'}/tinderbox-$branch-$arch-$machine"; local (*FULL, *BRIEF); @@ -178,6 +203,8 @@ sub tinderbox($$$) { push(@args, "--branch=$branch"); push(@args, "--arch=$arch"); push(@args, "--machine=$machine"); + push(@args, "--patch=$CONFIG{'PATCH'}") + if (defined($CONFIG{'PATCH'})); push(@args, @{$CONFIG{'TARGETS'}}); while (my ($key, $val) = each(%{$CONFIG{'ENV'}})) { push(@args, "$key=$val"); @@ -248,13 +275,10 @@ sub tinderbox($$$) { # Mail out error reports if ($error) { warn("$branch tinderbox failed for $arch/$machine\n"); - my $recipient = $CONFIG{'EMAIL'}; - $recipient =~ s/\%\%branch\%\%/$branch/gi; - $recipient =~ s/\%\%arch\%\%/$arch/gi; - $recipient =~ s/\%\%machine\%\%/$machine/gi; - report(lc($recipient), - "[$CONFIG{'COMMENT'}] failure on $arch/$machine", - $summary); + my $sender = expand($CONFIG{'SENDER'}); + my $recipient = expand($CONFIG{'RECIPIENT'}); + my $subject = expand($CONFIG{'SUBJECT'}); + report($sender, $recipient, $subject, $summary); } rename("$logfile.full.$$", "$logfile.full"); @@ -273,7 +297,6 @@ sub usage() { } MAIN:{ - my $config; if (@ARGV) { $config = lc(shift(@ARGV)); } else { |