diff --git a/webtools/tinderbox/warnings.pl b/webtools/tinderbox/warnings.pl index b9e83f9791a4..91810d93a7e8 100755 --- a/webtools/tinderbox/warnings.pl +++ b/webtools/tinderbox/warnings.pl @@ -62,13 +62,36 @@ for $br (last_successful_builds($tree)) { $warn_file =~ s/.gz$/.html/; $fh->open(">$warn_file") or die "Unable to open $warn_file: $!\n"; - &print_warnings_as_html($fh, $br); + my ($total_warnings, $time_str) = print_warnings_as_html($fh, $br); $fh->close; - warn "Wrote output to $warn_file\n"; + + # Make it live + use File::Copy 'move'; + move($warn_file, "$tree/warnings.html"); + + my $warn_summary = "$tree/warn$log_file"; + $warn_summary =~ s/.gz$/.pl/; + + $fh->open(">$warn_summary") or die "Unable to open $warn_summary: $!\n"; + $total_warnings = commify($total_warnings); + print $fh '$warning_summary=\'

Check out the ' + ."" + ."$total_warnings Build Warnings (updated $time_str). " + .'-' + .'slamm

\';'."\n"; + $fh->close; + + move($warn_summary, "$tree/warn.pl"); last; } +sub commify { + my $text = reverse $_[0]; + $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; + return scalar reverse $text; +} + # end of main # =================================================================== @@ -264,8 +287,6 @@ sub print_warnings_as_html {

__END_HEADER - warn "$total_warnings_count warnings from $time_str\n"; - for $who (sort { $who_count{$b} <=> $who_count{$a} || $a cmp $b } keys %who_count) { push @who_list, $who; @@ -346,6 +367,8 @@ __END_FOOTER # Change default destination back. select($old_fh); + + return ($total_warnings_count, $time_str); } sub print_count {