1999-06-25 02:07:54 +04:00
|
|
|
#! /usr/bonsaitools/bin/perl
|
1999-06-25 02:33:33 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public License
|
|
|
|
# Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
# compliance with the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS"
|
|
|
|
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing rights and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
# The Original Code is Tinderbox
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
# Corporation. Portions created by Netscape are Copyright (C) 1999
|
|
|
|
# Netscape Communications Corporation. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s): Stephen Lamm <slamm@mozilla.org>
|
1999-06-25 02:07:54 +04:00
|
|
|
|
1999-08-02 22:04:23 +04:00
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# Run this script on lounge.mozilla.org. To run it there,
|
|
|
|
# cd to /opt/webtools/tinderbox and run it without
|
|
|
|
# any arguments:
|
|
|
|
#
|
|
|
|
# ./warnings.pl
|
|
|
|
#
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
use FileHandle;
|
|
|
|
|
|
|
|
$tree = 'SeaMonkey';
|
1999-07-23 23:36:38 +04:00
|
|
|
# tinderbox/tbglobals.pl uses many shameful globals
|
1999-06-25 02:07:54 +04:00
|
|
|
$form{tree} = $tree;
|
1999-07-23 23:36:38 +04:00
|
|
|
require 'tbglobals.pl';
|
1999-06-25 02:07:54 +04:00
|
|
|
|
|
|
|
$cvsroot = '/cvsroot/mozilla';
|
|
|
|
$lxr_data_root = '/export2/lxr-data';
|
1999-06-26 00:21:17 +04:00
|
|
|
@ignore = (
|
|
|
|
'long long',
|
|
|
|
'__cmsg_data',
|
|
|
|
'location of the previous definition',
|
1999-07-08 04:06:26 +04:00
|
|
|
'\' was hidden',
|
1999-07-16 03:59:33 +04:00
|
|
|
'declaration of \`index\' shadows global',
|
|
|
|
'declaration of \`ws\' shadows global', # from istream
|
|
|
|
'declaration of \`y0\' shadows global', # from mathcalls.h
|
|
|
|
'declaration of \`y1\' shadows global', # from mathcalls.h
|
1999-07-16 04:08:43 +04:00
|
|
|
'by \`nsHTML(?:Anchor|[^:]*Element)::(?:Set|Get)Attribute', # kipp says this is bogus
|
1999-06-26 00:21:17 +04:00
|
|
|
);
|
1999-06-25 02:07:54 +04:00
|
|
|
$ignore_pat = "(?:".join('|',@ignore).")";
|
|
|
|
|
|
|
|
print STDERR "Building hash of file names...";
|
1999-06-26 00:52:50 +04:00
|
|
|
($file_bases, $file_fullpaths) = build_file_hash($cvsroot, $tree);
|
1999-06-25 02:07:54 +04:00
|
|
|
print STDERR "done.\n";
|
|
|
|
|
|
|
|
for $br (last_successful_builds($tree)) {
|
1999-06-25 23:39:31 +04:00
|
|
|
next unless $br->{buildname} =~ /shrike.*\b(Clobber|Clbr)\b/;
|
1999-06-25 02:07:54 +04:00
|
|
|
|
|
|
|
my $log_file = "$br->{logfile}";
|
|
|
|
|
|
|
|
warn "Parsing build log, $log_file\n";
|
|
|
|
|
1999-07-23 02:17:28 +04:00
|
|
|
$fh = new FileHandle "gunzip -c $tree/$log_file |"
|
|
|
|
or die "Unable to open $tree/$log_file\n";
|
1999-06-26 00:52:50 +04:00
|
|
|
&gcc_parser($fh, $cvsroot, $tree, $log_file, $file_bases, $file_fullpaths);
|
1999-06-25 02:33:33 +04:00
|
|
|
$fh->close;
|
1999-06-25 02:07:54 +04:00
|
|
|
|
|
|
|
&build_blame;
|
1999-06-25 02:33:33 +04:00
|
|
|
|
|
|
|
my $warn_file = "$tree/warn$log_file";
|
|
|
|
$warn_file =~ s/.gz$/.html/;
|
|
|
|
|
|
|
|
$fh->open(">$warn_file") or die "Unable to open $warn_file: $!\n";
|
1999-07-22 01:09:41 +04:00
|
|
|
my ($total_warnings, $time_str) = print_warnings_as_html($fh, $br);
|
1999-06-25 02:33:33 +04:00
|
|
|
$fh->close;
|
1999-07-22 01:09:41 +04:00
|
|
|
|
1999-07-23 03:14:15 +04:00
|
|
|
next unless $total_warnings > 0;
|
|
|
|
|
1999-07-22 01:09:41 +04:00
|
|
|
# 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=\'<p>Check out the '
|
|
|
|
."<a href=\"http://tinderbox.mozilla.org/$tree/warnings.html\">"
|
|
|
|
."$total_warnings Build Warnings</a> (updated $time_str). "
|
|
|
|
.'-<a href="mailto:slamm@netscape.com?subject=About the Build Warnings">'
|
|
|
|
.'slamm</a><p>\';'."\n";
|
|
|
|
$fh->close;
|
|
|
|
|
|
|
|
move($warn_summary, "$tree/warn.pl");
|
1999-06-25 02:33:33 +04:00
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
last;
|
|
|
|
}
|
|
|
|
|
1999-07-22 01:09:41 +04:00
|
|
|
sub commify {
|
|
|
|
my $text = reverse $_[0];
|
|
|
|
$text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
|
|
|
|
return scalar reverse $text;
|
|
|
|
}
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
# end of main
|
|
|
|
# ===================================================================
|
|
|
|
|
|
|
|
sub build_file_hash {
|
|
|
|
my ($cvsroot, $tree) = @_;
|
|
|
|
|
|
|
|
$lxr_data_root = "/export2/lxr-data/\L$tree";
|
|
|
|
|
|
|
|
$lxr_file_list = "\L$lxr_data_root/.glimpse_filenames";
|
|
|
|
open(LXR_FILENAMES, "<$lxr_file_list")
|
|
|
|
or die "Unable to open $lxr_file_list: $!\n";
|
|
|
|
|
|
|
|
use File::Basename;
|
|
|
|
|
|
|
|
while (<LXR_FILENAMES>) {
|
|
|
|
my ($base, $dir, $ext) = fileparse($_,'\.[^/]*');
|
1999-06-26 00:52:50 +04:00
|
|
|
|
1999-06-25 23:39:31 +04:00
|
|
|
next unless $ext =~ /^\.(cpp|h|C|s|c|mk|in)$/;
|
1999-06-26 00:52:50 +04:00
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
$base = "$base$ext";
|
1999-06-26 00:52:50 +04:00
|
|
|
$dir =~ s|$lxr_data_root/mozilla/||;
|
|
|
|
$dir =~ s|/$||;
|
|
|
|
|
|
|
|
$fullpath{"$dir/$base"}=1;
|
1999-06-25 02:07:54 +04:00
|
|
|
|
|
|
|
unless (exists $bases{$base}) {
|
|
|
|
$bases{$base} = $dir;
|
|
|
|
} else {
|
1999-06-26 00:21:17 +04:00
|
|
|
$bases{$base} = '[multiple]';
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
}
|
1999-06-26 00:52:50 +04:00
|
|
|
return \%bases, \%fullpath;
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
sub last_successful_builds {
|
|
|
|
my $tree = shift;
|
|
|
|
my @build_records = ();
|
|
|
|
my $br;
|
|
|
|
|
1999-07-23 03:14:15 +04:00
|
|
|
$maxdate = time;
|
|
|
|
$mindate = $maxdate - 5*60*60; # Go back 5 hours
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
print STDERR "Loading build data...";
|
|
|
|
&load_data;
|
|
|
|
print STDERR "done\n";
|
|
|
|
|
|
|
|
for (my $ii=1; $ii <= $name_count; $ii++) {
|
|
|
|
for (my $tt=1; $tt <= $time_count; $tt++) {
|
|
|
|
if (defined($br = $build_table->[$tt][$ii])
|
|
|
|
and $br->{buildstatus} eq 'success') {
|
|
|
|
push @build_records, $br;
|
|
|
|
last;
|
|
|
|
} } }
|
|
|
|
return @build_records;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub gcc_parser {
|
1999-06-26 00:52:50 +04:00
|
|
|
my ($fh, $cvsroot, $tree, $log_file, $file_bases, $file_fullnames) = @_;
|
1999-06-25 02:07:54 +04:00
|
|
|
my $dir = '';
|
|
|
|
|
1999-07-20 00:46:17 +04:00
|
|
|
PARSE_TOP: while (<$fh>) {
|
1999-06-25 02:07:54 +04:00
|
|
|
# Directory
|
|
|
|
#
|
|
|
|
if (/^gmake\[\d\]: Entering directory \`(.*)\'$/) {
|
|
|
|
($build_dir = $1) =~ s|.*/mozilla/||;
|
1999-07-16 03:59:33 +04:00
|
|
|
|
|
|
|
# Skip the network directory until necko lands
|
|
|
|
if ($build_dir eq 'network') {
|
|
|
|
while (<$fh>) {
|
|
|
|
last if /^gmake\[\d\]: Leaving directory \`.*\/mozilla\/network\'$/;
|
|
|
|
}
|
|
|
|
}
|
1999-06-25 02:07:54 +04:00
|
|
|
next;
|
|
|
|
}
|
1999-07-16 03:59:33 +04:00
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
# Now only match lines with "warning:"
|
|
|
|
next unless /warning:/;
|
|
|
|
next if /$ignore_pat/o;
|
|
|
|
|
|
|
|
chomp; # Yum, yum
|
|
|
|
|
|
|
|
my ($filename, $line, $warning_text);
|
1999-06-26 01:05:52 +04:00
|
|
|
($filename, $line, undef, $warning_text) = split /:\s*/, $_, 4;
|
1999-06-25 02:07:54 +04:00
|
|
|
$filename =~ s/.*\///;
|
|
|
|
|
1999-06-26 00:21:17 +04:00
|
|
|
# Special case for Makefiles
|
|
|
|
$filename =~ s/Makefile$/Makefile.in/;
|
|
|
|
|
1999-06-26 00:52:50 +04:00
|
|
|
my $dir = '';
|
|
|
|
if ($file_fullnames->{"$build_dir/$filename"}) {
|
1999-06-25 02:07:54 +04:00
|
|
|
$dir = $build_dir;
|
|
|
|
} else {
|
1999-06-26 00:52:50 +04:00
|
|
|
unless(defined($dir = $file_bases->{$filename})) {
|
1999-06-26 00:21:17 +04:00
|
|
|
$dir = '[no_match]';
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
my $file = "$dir/$filename";
|
|
|
|
|
1999-07-20 00:46:17 +04:00
|
|
|
# Special case for "`foo' was hidden\nby `foo2'"
|
|
|
|
$warning_text = "...was hidden " . $warning_text
|
|
|
|
if $warning_text =~ /^by \`/;
|
1999-06-25 02:07:54 +04:00
|
|
|
|
1999-07-20 00:46:17 +04:00
|
|
|
$warnings{$file}{$line}->{first_seen_line} = $.
|
|
|
|
unless defined $warnings{$file}{$line};
|
1999-07-08 04:06:26 +04:00
|
|
|
|
1999-06-25 23:39:31 +04:00
|
|
|
$warnings{$file}{$line}->{count}++;
|
|
|
|
$total_warnings_count++;
|
1999-07-20 00:46:17 +04:00
|
|
|
|
|
|
|
for my $rec (@{ $warnings{$file}{$line}->{list} }) {
|
|
|
|
next PARSE_TOP if $rec->{warning_text} eq $warning_text;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Remember where in the build log the warning occured
|
|
|
|
push @{ $warnings{$file}{$line}->{list} }, {
|
|
|
|
log_file => $log_file,
|
|
|
|
warning_text => $warning_text,
|
|
|
|
};
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub dump_warning_data {
|
1999-06-25 23:39:31 +04:00
|
|
|
while (my ($file, $lines_hash) = each %warnings) {
|
|
|
|
while (my ($line, $record) = each %{$lines_hash}) {
|
|
|
|
print join ':',
|
|
|
|
$file,$line,
|
1999-06-25 02:07:54 +04:00
|
|
|
$record->{first_seen_line},
|
|
|
|
$record->{count},
|
|
|
|
$record->{warning_text};
|
1999-06-25 23:39:31 +04:00
|
|
|
print "\n";
|
|
|
|
}
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub build_blame {
|
|
|
|
use lib '../bonsai';
|
|
|
|
require 'utils.pl';
|
|
|
|
require 'cvsblame.pl';
|
|
|
|
|
1999-06-25 23:39:31 +04:00
|
|
|
while (($file, $lines_hash) = each %warnings) {
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
my $rcs_filename = "$cvsroot/$file,v";
|
|
|
|
|
|
|
|
unless (-e $rcs_filename) {
|
|
|
|
warn "Unable to find $rcs_filename\n";
|
1999-06-25 23:39:31 +04:00
|
|
|
$unblamed{$file} = 1;
|
1999-06-25 02:07:54 +04:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $revision = &parse_cvs_file($rcs_filename);
|
|
|
|
@text = &extract_revision($revision);
|
1999-06-25 23:39:31 +04:00
|
|
|
while (my ($line, $warn_rec) = each %{$lines_hash}) {
|
1999-06-25 02:07:54 +04:00
|
|
|
my $line_rev = $revision_map[$line-1];
|
|
|
|
my $who = $revision_author{$line_rev};
|
1999-06-28 22:23:51 +04:00
|
|
|
my $source_text = join '', @text[$line-3..$line+1];
|
1999-07-07 23:11:02 +04:00
|
|
|
$source_text =~ s/\t/ /g;
|
1999-06-25 02:07:54 +04:00
|
|
|
|
1999-06-26 02:13:43 +04:00
|
|
|
$who = "$who%netscape.com" unless $who =~ /[%]/;
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
$warn_rec->{line_rev} = $line_rev;
|
|
|
|
$warn_rec->{source} = $source_text;
|
|
|
|
|
|
|
|
$warnings_by_who{$who}{$file}{$line} = $warn_rec;
|
|
|
|
|
1999-06-26 01:42:22 +04:00
|
|
|
$total_who_count++ unless exists $who_count{$who};
|
1999-06-25 02:07:54 +04:00
|
|
|
$who_count{$who} += $warn_rec->{count};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub print_warnings_as_html {
|
1999-06-25 03:34:56 +04:00
|
|
|
my ($fh, $br) = @_;
|
|
|
|
my ($buildname, $buildtime) = ($br->{buildname}, $br->{buildtime});
|
1999-06-25 02:07:54 +04:00
|
|
|
|
|
|
|
my $time_str = print_time( $buildtime );
|
|
|
|
|
1999-06-25 02:33:33 +04:00
|
|
|
# Change the default destination for print to $fh
|
|
|
|
my $old_fh = select($fh);
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
print <<"__END_HEADER";
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Blamed Build Warnings</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<font size="+2" face="Helvetica,Arial"><b>
|
|
|
|
Blamed Build Warnings
|
|
|
|
</b></font><br>
|
|
|
|
<font size="+1" face="Helvetica,Arial">
|
1999-06-25 23:39:31 +04:00
|
|
|
$buildname on $time_str<br>
|
|
|
|
$total_warnings_count total warnings
|
1999-06-25 02:07:54 +04:00
|
|
|
</font><p>
|
|
|
|
|
|
|
|
__END_HEADER
|
|
|
|
for $who (sort { $who_count{$b} <=> $who_count{$a}
|
|
|
|
|| $a cmp $b } keys %who_count) {
|
1999-06-26 01:42:22 +04:00
|
|
|
push @who_list, $who;
|
|
|
|
}
|
1999-06-28 22:23:51 +04:00
|
|
|
|
1999-06-26 01:42:22 +04:00
|
|
|
# Summary Table (name, count)
|
|
|
|
#
|
1999-06-28 22:23:51 +04:00
|
|
|
use POSIX;
|
1999-07-08 04:06:26 +04:00
|
|
|
print "<table border=0 cellpadding=1 cellspacing=0 bgcolor=#ededed>\n";
|
1999-06-26 02:09:43 +04:00
|
|
|
my $num_columns = 6;
|
1999-06-28 22:23:51 +04:00
|
|
|
my $num_rows = ceil($#who_list / $num_columns);
|
|
|
|
for (my $ii=0; $ii < $num_rows; $ii++) {
|
1999-06-26 02:05:09 +04:00
|
|
|
print "<tr>";
|
|
|
|
for (my $jj=0; $jj < $num_columns; $jj++) {
|
1999-06-28 22:23:51 +04:00
|
|
|
my $index = $ii + $jj * $num_rows;
|
1999-06-26 02:09:43 +04:00
|
|
|
next if $index > $#who_list;
|
1999-06-28 22:23:51 +04:00
|
|
|
my $name = $who_list[$index];
|
|
|
|
my $count = $who_count{$name};
|
1999-06-26 02:05:09 +04:00
|
|
|
$name =~ s/%.*//;
|
1999-06-28 22:23:51 +04:00
|
|
|
print " " x $jj;
|
1999-06-26 02:05:09 +04:00
|
|
|
print "<td><a href='#$name'>$name</a>";
|
|
|
|
print "</td><td>";
|
|
|
|
print "$count";
|
1999-06-28 22:23:51 +04:00
|
|
|
print "</td><td> </td>\n";
|
1999-06-26 02:05:09 +04:00
|
|
|
}
|
1999-06-28 22:23:51 +04:00
|
|
|
print "</tr>\n";
|
1999-06-26 01:42:22 +04:00
|
|
|
}
|
1999-06-28 22:23:51 +04:00
|
|
|
print "</table><p>\n";
|
1999-06-26 01:42:22 +04:00
|
|
|
|
1999-07-08 04:06:26 +04:00
|
|
|
# Count Unblamed warnings
|
|
|
|
#
|
|
|
|
my $total_unblamed_warnigns=0;
|
|
|
|
for my $file (keys %unblamed) {
|
|
|
|
for my $linenum (keys %{$warnings{$file}}) {
|
|
|
|
$total_unblamed_warnings += $warnings{$file}{$linenum}{count};
|
|
|
|
$warnings_by_who{Unblamed}{$file}{$linenum} = $warnings{$file}{$linenum};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$who_count{Unblamed} = $total_unblamed_warnings;
|
|
|
|
|
1999-06-26 01:42:22 +04:00
|
|
|
# Print all the warnings
|
|
|
|
#
|
1999-07-08 04:06:26 +04:00
|
|
|
for $who (@who_list, "Unblamed") {
|
|
|
|
my $total_count = $who_count{$who};
|
1999-06-25 02:07:54 +04:00
|
|
|
my ($name, $email);
|
|
|
|
($name = $who) =~ s/%.*//;
|
|
|
|
($email = $who) =~ s/%/@/;
|
|
|
|
|
1999-06-28 22:23:51 +04:00
|
|
|
print "<h2>";
|
1999-07-08 04:06:26 +04:00
|
|
|
print "<a name='$name' href='mailto:$email'>" unless $name eq 'Unblamed';
|
|
|
|
print "$name";
|
|
|
|
print "</a>" unless $name eq 'Unblamed';
|
|
|
|
print " (1 warning)" if $total_count == 1;
|
|
|
|
print " ($total_count warnings)" if $total_count > 1;
|
1999-06-28 22:23:51 +04:00
|
|
|
print "</h2>";
|
1999-06-25 02:07:54 +04:00
|
|
|
|
1999-07-08 04:06:26 +04:00
|
|
|
print "\n<table>\n";
|
|
|
|
my $count = 1;
|
1999-06-25 02:07:54 +04:00
|
|
|
for $file (sort keys %{$warnings_by_who{$who}}) {
|
|
|
|
for $linenum (sort keys %{$warnings_by_who{$who}{$file}}) {
|
|
|
|
my $warn_rec = $warnings_by_who{$who}{$file}{$linenum};
|
1999-07-08 04:06:26 +04:00
|
|
|
print_count($count, $warn_rec->{count});
|
1999-06-25 23:39:31 +04:00
|
|
|
print_warning($tree, $br, $file, $linenum, $warn_rec);
|
1999-07-08 04:06:26 +04:00
|
|
|
print_source_code($linenum, $warn_rec) unless $unblamed{$file};
|
|
|
|
$count += $warn_rec->{count};
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
}
|
1999-07-08 04:06:26 +04:00
|
|
|
print "</table>\n";
|
1999-06-25 23:39:31 +04:00
|
|
|
}
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
print <<"__END_FOOTER";
|
|
|
|
<p>
|
|
|
|
<hr align=left>
|
|
|
|
Send questions or comments to
|
|
|
|
<<a href="mailto:slamm\@netscape.com?subject=About the Blamed Build Warnings">slamm\@netcape.com</a>>.
|
|
|
|
</body></html>
|
|
|
|
__END_FOOTER
|
1999-06-25 02:33:33 +04:00
|
|
|
|
|
|
|
# Change default destination back.
|
|
|
|
select($old_fh);
|
1999-07-22 01:09:41 +04:00
|
|
|
|
|
|
|
return ($total_warnings_count, $time_str);
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
|
1999-07-08 04:06:26 +04:00
|
|
|
sub print_count {
|
|
|
|
my ($start, $count) = @_;
|
|
|
|
|
|
|
|
print "<tr><td align=right>$start";
|
|
|
|
print "-".($start+$count-1) if $count > 1;
|
|
|
|
print ".</td>";
|
|
|
|
}
|
|
|
|
|
1999-06-25 23:39:31 +04:00
|
|
|
sub print_warning {
|
|
|
|
my ($tree, $br, $file, $linenum, $warn_rec) = @_;
|
|
|
|
|
1999-07-08 04:06:26 +04:00
|
|
|
print "<td>";
|
1999-06-25 23:39:31 +04:00
|
|
|
|
|
|
|
# File link
|
1999-06-26 01:54:24 +04:00
|
|
|
if ($file =~ /\[multiple\]/) {
|
1999-06-28 22:38:51 +04:00
|
|
|
$file =~ s/\[multiple\]\///;
|
1999-06-28 22:23:51 +04:00
|
|
|
print "<a href='http://lxr.mozilla.org/seamonkey/find?string=$file'>";
|
1999-06-26 01:54:24 +04:00
|
|
|
print "$file:$linenum";
|
|
|
|
print "</a> (multiple file matches)";
|
|
|
|
} elsif ($file =~ /\[no_match\]/) {
|
1999-06-28 22:38:51 +04:00
|
|
|
$file =~ s/\[no_match\]\///;
|
|
|
|
print "<b>$file:$linenum</b> (no file match)";
|
1999-06-26 01:54:24 +04:00
|
|
|
} else {
|
1999-06-28 22:23:51 +04:00
|
|
|
print "<a href='"
|
1999-06-26 01:54:24 +04:00
|
|
|
.file_url($file,$linenum)."'>";
|
|
|
|
print "$file:$linenum";
|
|
|
|
print "</a> ";
|
|
|
|
}
|
1999-07-20 00:46:17 +04:00
|
|
|
|
1999-06-25 23:39:31 +04:00
|
|
|
# Build log link
|
|
|
|
my $log_line = $warn_rec->{first_seen_line};
|
|
|
|
print " (<a href='"
|
1999-07-20 00:46:17 +04:00
|
|
|
.build_url($tree, $br, $log_line)
|
|
|
|
."'>";
|
1999-06-25 23:39:31 +04:00
|
|
|
if ($warn_rec->{count} == 1) {
|
1999-06-28 22:23:51 +04:00
|
|
|
print "See build log excerpt";
|
1999-06-25 23:39:31 +04:00
|
|
|
} else {
|
1999-07-20 00:46:17 +04:00
|
|
|
print "See 1st of $warn_rec->{count} warnings in build log";
|
|
|
|
}
|
|
|
|
print "</a>)";
|
|
|
|
|
|
|
|
print "</td></tr><tr><td></td><td>";
|
|
|
|
|
|
|
|
for my $rec (@{ $warn_rec->{list}}) {
|
|
|
|
my $warning = $rec->{warning_text};
|
|
|
|
|
|
|
|
# Warning text
|
|
|
|
print "\u$warning<br>";
|
1999-06-25 23:39:31 +04:00
|
|
|
}
|
1999-07-20 00:46:17 +04:00
|
|
|
print "</td></tr>";
|
1999-06-25 23:39:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
sub print_source_code {
|
|
|
|
my ($linenum, $warn_rec) = @_;
|
|
|
|
my $warning = $warn_rec->{warning_text};
|
|
|
|
|
|
|
|
# Source code fragment
|
|
|
|
#
|
|
|
|
my ($keyword) = $warning =~ /\`([^\']*)\'/;
|
1999-07-08 04:06:26 +04:00
|
|
|
print "<tr><td></td><td bgcolor=#ededed>";
|
1999-06-25 23:39:31 +04:00
|
|
|
print "<pre><font size='-1'>";
|
|
|
|
|
1999-07-07 23:11:02 +04:00
|
|
|
my $source_text = trim_common_leading_whitespace($warn_rec->{source});
|
|
|
|
$source_text =~ s/&/&/gm;
|
|
|
|
$source_text =~ s/</</gm;
|
|
|
|
$source_text =~ s/>/>/gm;
|
|
|
|
$source_text =~ s|\b\Q$keyword\E\b|<b>$keyword</b>|gm unless $keyword eq '';
|
1999-06-28 22:23:51 +04:00
|
|
|
my $line_index = $linenum - 2;
|
1999-07-07 23:11:02 +04:00
|
|
|
$source_text =~ s/^(.*)$/$line_index++." $1"/gme;
|
|
|
|
$source_text =~ s|^($linenum.*)$|<font color='red'>\1</font>|gm;
|
|
|
|
chomp $source_text;
|
|
|
|
print $source_text;
|
|
|
|
|
1999-06-28 22:23:51 +04:00
|
|
|
print "</font>";
|
|
|
|
#print "</pre>";
|
1999-07-08 04:06:26 +04:00
|
|
|
print "</td></tr>\n";
|
1999-06-25 23:39:31 +04:00
|
|
|
}
|
|
|
|
|
1999-06-25 02:07:54 +04:00
|
|
|
sub build_url {
|
1999-06-25 03:30:34 +04:00
|
|
|
my ($tree, $br, $linenum) = @_;
|
|
|
|
|
|
|
|
my $name = $br->{buildname};
|
|
|
|
$name =~ s/ /%20/g;
|
1999-06-25 02:07:54 +04:00
|
|
|
|
1999-07-07 01:30:20 +04:00
|
|
|
return "../showlog.cgi?log=$tree/$br->{logfile}:$linenum";
|
1999-06-25 02:07:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
sub file_url {
|
|
|
|
my ($file, $linenum) = @_;
|
|
|
|
|
1999-06-29 03:08:37 +04:00
|
|
|
return "http://cvs-mirror.mozilla.org/webtools/bonsai/cvsblame.cgi"
|
1999-06-25 02:07:54 +04:00
|
|
|
."?file=mozilla/$file&mark=$linenum#".($linenum-10);
|
|
|
|
|
|
|
|
}
|
1999-07-07 23:11:02 +04:00
|
|
|
|
|
|
|
sub trim_common_leading_whitespace {
|
|
|
|
# Adapted from dequote() in Perl Cookbook by Christiansen and Torkington
|
|
|
|
local $_ = shift;
|
|
|
|
my $white; # common whitespace
|
|
|
|
if (/(?:(\s*).*\n)(?:(?:\1.*\n)|(?:\s*\n))+$/) {
|
|
|
|
$white = $1;
|
|
|
|
} else {
|
|
|
|
$white = /^(\s+)/;
|
|
|
|
}
|
|
|
|
s/^(?:$white)?//gm;
|
|
|
|
s/^\s+$//gm;
|
|
|
|
return $_;
|
|
|
|
}
|
|
|
|
|