2006-12-07 07:59:39 +03:00
|
|
|
#!/usr/bin/perl --
|
1998-06-17 01:43:24 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# The contents of this file are subject to the Netscape 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/NPL/
|
1998-06-17 01:43:24 +04:00
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# 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.
|
1998-06-17 01:43:24 +04:00
|
|
|
#
|
|
|
|
# The Original Code is the Tinderbox build tool.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
use strict;
|
2006-07-24 22:48:14 +04:00
|
|
|
use Compress::Zlib;
|
1999-07-23 23:36:38 +04:00
|
|
|
require 'tbglobals.pl';
|
2007-01-23 20:49:10 +03:00
|
|
|
require 'showbuilds.pl';
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2006-05-27 04:18:42 +04:00
|
|
|
# Process the form arguments
|
2007-01-23 20:49:10 +03:00
|
|
|
my %form = &split_cgi_args();
|
2006-05-27 04:18:42 +04:00
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
#############################################################
|
|
|
|
# Global variables
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
my $LINES_AFTER_ERROR = 5;
|
|
|
|
my $LINES_BEFORE_ERROR = 30;
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2006-06-23 20:17:57 +04:00
|
|
|
my $last_modified_time = 0;
|
|
|
|
my $expires_time = time() + 3600;
|
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
# These variables are set by the error parser functions:
|
|
|
|
# has_error(), has_warning(), and has_errorline().
|
2007-01-23 20:49:10 +03:00
|
|
|
my $error_file = '';
|
|
|
|
my $error_file_ref = '';
|
|
|
|
my $error_line = 0;
|
|
|
|
my $error_guess = 0;
|
|
|
|
|
|
|
|
my ($args, $tree, $full_logfile, $linenum, $logfile);
|
|
|
|
my ($errorparser, $buildname, $buildtime, $numlines, $fulltext);
|
|
|
|
my ($enc_buildname, $brief_filename);
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
#############################################################
|
|
|
|
# CGI inputs
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-07-07 01:23:32 +04:00
|
|
|
if (defined($args = $form{log}) or defined($args = $form{exerpt})) {
|
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
my ($full_logfile, $linenum) = split /:/, $args;
|
2000-02-12 03:39:50 +03:00
|
|
|
($tree, $logfile) = split /\//, $full_logfile;
|
2007-01-25 01:27:55 +03:00
|
|
|
$tree = &require_only_one_tree($tree);
|
1999-06-28 22:22:24 +04:00
|
|
|
|
1999-10-29 23:20:53 +04:00
|
|
|
my $br = tb_find_build_record($tree, $logfile);
|
1999-06-28 22:22:24 +04:00
|
|
|
$errorparser = $br->{errorparser};
|
|
|
|
$buildname = $br->{buildname};
|
|
|
|
$buildtime = $br->{buildtime};
|
|
|
|
|
|
|
|
$numlines = 50;
|
|
|
|
$numlines = $form{numlines} if exists $form{numlines};
|
|
|
|
} else {
|
2007-01-25 01:27:55 +03:00
|
|
|
$tree = &require_only_one_tree($form{tree});
|
1999-06-28 22:22:24 +04:00
|
|
|
$errorparser = $form{errorparser};
|
|
|
|
$logfile = $form{logfile};
|
|
|
|
$buildname = $form{buildname};
|
|
|
|
$buildtime = $form{buildtime};
|
|
|
|
}
|
1999-07-07 02:37:17 +04:00
|
|
|
$fulltext = $form{fulltext};
|
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
$enc_buildname = url_encode($buildname);
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-08-25 07:27:25 +04:00
|
|
|
tb_load_treedata($tree);
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
my $time_str = print_time($buildtime);
|
1999-03-19 23:37:07 +03:00
|
|
|
|
|
|
|
$|=1;
|
|
|
|
|
2007-12-19 23:00:54 +03:00
|
|
|
my @stat_logfile = stat("$::tree_dir/$tree/$logfile");
|
|
|
|
my @stat_notes = stat("$::tree_dir/$tree/notes.txt");
|
2006-06-23 20:17:57 +04:00
|
|
|
if ($stat_logfile[9] > $stat_notes[9]) {
|
|
|
|
$last_modified_time = $stat_logfile[9];
|
|
|
|
} else {
|
|
|
|
$last_modified_time = $stat_notes[9];
|
|
|
|
}
|
|
|
|
|
1999-06-25 03:30:08 +04:00
|
|
|
if ($linenum) {
|
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
print_fragment();
|
1999-06-25 03:30:08 +04:00
|
|
|
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
print_header();
|
|
|
|
print_notes();
|
1999-03-19 23:37:07 +03:00
|
|
|
|
1999-06-25 03:30:08 +04:00
|
|
|
# Dynamically load the error parser
|
|
|
|
#
|
|
|
|
die "the \"errorparser\" parameter must be provided\n" unless $errorparser;
|
|
|
|
require "ep_${errorparser}.pl";
|
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
if ($fulltext)
|
|
|
|
{
|
2000-02-12 03:39:50 +03:00
|
|
|
my $errors = print_summary();
|
|
|
|
print_log($errors);
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$brief_filename = $logfile;
|
|
|
|
$brief_filename =~ s/.gz$/.brief.html/;
|
2007-12-19 23:00:54 +03:00
|
|
|
if (-T "$::tree_dir/$tree/$brief_filename" and -M _ > -M "$::tree_dir/$tree/$logfile")
|
1999-03-19 23:37:07 +03:00
|
|
|
{
|
2007-12-19 23:00:54 +03:00
|
|
|
open(BRIEFFILE, "<", "$::tree_dir/$tree/$brief_filename");
|
1999-03-19 23:37:07 +03:00
|
|
|
print while (<BRIEFFILE>)
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-19 23:00:54 +03:00
|
|
|
open(BRIEFFILE, ">", "$::tree_dir/$tree/$brief_filename");
|
1999-03-19 23:37:07 +03:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
my $errors = print_summary();
|
|
|
|
print_log($errors);
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# end of main
|
|
|
|
############################################################
|
|
|
|
|
1999-06-25 03:30:08 +04:00
|
|
|
sub print_fragment {
|
2006-06-23 20:17:57 +04:00
|
|
|
print "Content-type: text/html\n";
|
|
|
|
print "Last-Modified: " . gmtime($last_modified_time) . "\n";
|
|
|
|
print "Expires: " . gmtime($expires_time) . "\n";
|
|
|
|
print "\n";
|
1999-06-25 03:30:08 +04:00
|
|
|
|
|
|
|
my $heading = "Build Log (Fragment)";
|
|
|
|
my $subheading = "$buildname on $time_str";
|
|
|
|
my $title = "$heading - $subheading";
|
|
|
|
|
|
|
|
EmitHtmlTitleAndHeader($title, $heading, $subheading);
|
|
|
|
|
|
|
|
print "<a href='showlog.cgi?tree=$tree&errorparser=$errorparser&logfile=$logfile&buildtime=$buildtime&buildname=$enc_buildname&fulltext=1'>Show Full Build Log</a>";
|
|
|
|
|
2007-12-19 23:00:54 +03:00
|
|
|
my $gz = gzopen("$::tree_dir/$tree/$logfile","rb") or
|
|
|
|
warn "gzopen($::tree_dir/$tree/$logfile): $!\n";
|
1999-06-25 03:30:08 +04:00
|
|
|
|
|
|
|
my $first_line = $linenum - ($numlines/2);
|
|
|
|
my $last_line = $linenum + ($numlines/2);
|
|
|
|
|
|
|
|
print "<pre><b>.<br>.<br>.<br></b>";
|
2006-07-24 22:48:14 +04:00
|
|
|
my ($bytesread, $line);
|
|
|
|
while (defined($gz) && (($bytesread = $gz->gzreadline($line)) > 0)) {
|
1999-06-25 03:30:08 +04:00
|
|
|
next if $. < $first_line;
|
|
|
|
last if $. > $last_line;
|
|
|
|
print "<b><font color='red'>" if $. == $linenum;
|
|
|
|
print;
|
|
|
|
print "</font></b>" if $. == $linenum;
|
|
|
|
}
|
2006-07-24 22:48:14 +04:00
|
|
|
$gz->gzclose() if defined($gz);
|
1999-06-25 03:30:08 +04:00
|
|
|
print "<b>.<br>.<br>.<br></b></pre>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
sub print_header {
|
2006-06-23 20:17:57 +04:00
|
|
|
print "Content-type: text/html\n";
|
|
|
|
print "Last-Modified: " . gmtime($last_modified_time) . "\n";
|
|
|
|
print "Expires: " . gmtime($expires_time) . "\n";
|
|
|
|
print "\n";
|
1999-03-19 23:37:07 +03:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
my ($s, $s1, $s2);
|
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($fulltext) {
|
1998-06-17 01:43:24 +04:00
|
|
|
$s = 'Show <b>Brief</b> Log';
|
|
|
|
$s1 = '';
|
|
|
|
$s2 = 'Full';
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
|
|
|
else {
|
1998-06-17 01:43:24 +04:00
|
|
|
$s = 'Show <b>Full</b> Log';
|
|
|
|
$s1 = 1;
|
|
|
|
$s2 = 'Brief';
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
my $heading = "Build Log ($s2)";
|
|
|
|
my $subheading = "$buildname on $time_str";
|
|
|
|
my $title = "$heading - $subheading";
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
EmitHtmlTitleAndHeader($title, $heading, $subheading);
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
print "
|
1998-06-17 01:43:24 +04:00
|
|
|
<font size=+1>
|
1999-03-19 23:37:07 +03:00
|
|
|
<dt><a href='showlog.cgi?tree=$tree&errorparser=$errorparser&logfile=$logfile&buildtime=$buildtime&buildname=$enc_buildname&fulltext=$s1'>$s</a>
|
|
|
|
<dt><a href=\"showbuilds.cgi?tree=$tree\">Return to the Build Page</a>
|
1998-06-17 01:43:24 +04:00
|
|
|
<dt><a href=\"addnote.cgi?tree=$tree\&buildname=$enc_buildname\&buildtime=$buildtime\&logfile=$logfile\&errorparser=$errorparser\">
|
|
|
|
Add a Comment to the Log</a>
|
|
|
|
</font>
|
|
|
|
";
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
sub print_notes {
|
|
|
|
#
|
|
|
|
# Print notes
|
|
|
|
#
|
2007-01-23 20:49:10 +03:00
|
|
|
my $found_note = 0;
|
2007-12-19 23:00:54 +03:00
|
|
|
open(NOTES,"<", "$::tree_dir/$tree/notes.txt")
|
1999-03-19 23:37:07 +03:00
|
|
|
or print "<h2>warning: Couldn't open $tree/notes.txt </h2>\n";
|
2000-02-12 03:39:50 +03:00
|
|
|
print "$buildtime, $buildname<br>\n";
|
|
|
|
while (<NOTES>) {
|
1998-06-17 01:43:24 +04:00
|
|
|
chop;
|
2007-01-23 20:49:10 +03:00
|
|
|
my ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split(/\|/);
|
1998-06-17 01:43:24 +04:00
|
|
|
#print "$_<br>\n";
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($nbuildtime == $buildtime and $nbuildname eq $buildname) {
|
|
|
|
if (not $found_note) {
|
1999-03-19 23:37:07 +03:00
|
|
|
print "<H2>Build Comments</H2>\n";
|
|
|
|
$found_note = 1;
|
|
|
|
}
|
2007-01-23 20:49:10 +03:00
|
|
|
my $now_str = print_time($nnow);
|
|
|
|
my $note = url_decode($nenc_note);
|
1999-03-19 23:37:07 +03:00
|
|
|
print "<pre>\n[<b><a href=mailto:$nwho>$nwho</a> - $now_str</b>]\n$note\n</pre>";
|
1998-06-17 01:43:24 +04:00
|
|
|
}
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
|
|
|
close(NOTES);
|
1998-06-17 01:43:24 +04:00
|
|
|
}
|
1999-03-19 04:52:36 +03:00
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
sub print_summary {
|
|
|
|
#
|
|
|
|
# Print the summary first
|
|
|
|
#
|
|
|
|
logprint('<H2>Build Error Summary</H2><PRE>');
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
my @log_errors = ();
|
2000-02-12 03:39:50 +03:00
|
|
|
|
|
|
|
my $line_num = 0;
|
|
|
|
my $error_num = 0;
|
2007-12-19 23:00:54 +03:00
|
|
|
my $gz = gzopen("$::tree_dir/$tree/$logfile","rb") or
|
|
|
|
warn "gzopen($::tree_dir/$tree/$logfile): $!\n";
|
2006-07-24 22:48:14 +04:00
|
|
|
my ($bytesread, $line);
|
|
|
|
while (defined($gz) && (($bytesread = $gz->gzreadline($line)) > 0)) {
|
2007-01-23 20:49:10 +03:00
|
|
|
my $line_has_error = output_summary_line($line, $error_num);
|
2006-07-24 22:48:14 +04:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($line_has_error) {
|
|
|
|
push @log_errors, $line_num;
|
|
|
|
$error_num++;
|
|
|
|
}
|
|
|
|
$line_num++;
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
2006-07-24 22:48:14 +04:00
|
|
|
$gz->gzclose() if defined($gz);
|
1999-03-19 23:37:07 +03:00
|
|
|
logprint('</PRE>');
|
2000-02-12 03:39:50 +03:00
|
|
|
|
|
|
|
return \@log_errors;
|
1999-03-18 05:53:54 +03:00
|
|
|
}
|
1999-03-19 04:52:36 +03:00
|
|
|
|
1999-06-25 03:30:08 +04:00
|
|
|
sub print_log_section {
|
|
|
|
my ($tree, $logfile, $line_of_interest, $num_lines) = shift;
|
|
|
|
local $_;
|
|
|
|
|
|
|
|
my $first_line = $line_of_interest - $num_lines / 2;
|
|
|
|
my $last_line = $first_line + $num_lines;
|
|
|
|
|
|
|
|
print "<a href='showlog.cgi?tree=$tree&logfile=$logfile&line="
|
|
|
|
.($line_of_interest-$num_lines)."&numlines=$num_lines'>"
|
|
|
|
."Previous $num_lines</a>";
|
|
|
|
print "<font size='+1'><b>.<br>.<br>.<br></b></font>";
|
|
|
|
print "<pre>";
|
|
|
|
my $ii = 0;
|
2006-07-24 22:48:14 +04:00
|
|
|
my $gz = gzopen("$tree/$logfile", "rb") or
|
|
|
|
warn "gzopen($tree/$logfile): $!\n";
|
|
|
|
my ($bytesread, $line);
|
|
|
|
while (defined($gz) && (($bytesread = $gz->gzreadline($line)) > 0)) {
|
1999-06-25 03:30:08 +04:00
|
|
|
$ii++;
|
|
|
|
next if $ii < $first_line;
|
|
|
|
last if $ii > $last_line;
|
2007-01-23 20:49:10 +03:00
|
|
|
if ($ii == $line_of_interest) {
|
1999-06-25 03:30:08 +04:00
|
|
|
print "<b>$_</b>";
|
|
|
|
} else {
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
}
|
2006-07-24 22:48:14 +04:00
|
|
|
$gz->gzclose() if defined($gz);
|
1999-06-25 03:30:08 +04:00
|
|
|
print "</pre>";
|
|
|
|
print "<font size='+1'><b>.<br>.<br>.<br></b></font>";
|
|
|
|
print "<a href='showlog.cgi?tree=$tree&logfile=$logfile&line="
|
|
|
|
.($line_of_interest+$num_lines)."&numlines=$num_lines'>"
|
|
|
|
."Next $num_lines</a>";
|
|
|
|
}
|
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
sub print_log {
|
2000-02-12 03:39:50 +03:00
|
|
|
my ($errors) = $_[0];
|
|
|
|
|
1999-03-19 23:37:07 +03:00
|
|
|
logprint('<H2>Build Error Log</H2><pre>');
|
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
my $line_num = 0;
|
2007-12-19 23:00:54 +03:00
|
|
|
my $gz = gzopen("$::tree_dir/$tree/$logfile", "rb") or
|
|
|
|
warn "gzopen($::tree_dir/$tree/$logfile): $!\n";
|
2006-07-24 22:48:14 +04:00
|
|
|
my ($bytesread, $line);
|
|
|
|
while (defined($gz) && (($bytesread = $gz->gzreadline($line)) > 0)) {
|
2000-02-12 03:39:50 +03:00
|
|
|
output_log_line($line, $line_num, $errors);
|
|
|
|
$line_num++;
|
1999-03-19 23:37:07 +03:00
|
|
|
}
|
2006-07-24 22:48:14 +04:00
|
|
|
$gz->gzclose() if defined($gz);
|
1999-03-19 23:37:07 +03:00
|
|
|
logprint('</PRE><p>'
|
2000-02-12 03:39:50 +03:00
|
|
|
."<font size=+1>No More Errors</a></font>"
|
1999-03-19 23:37:07 +03:00
|
|
|
.'<br><br><br>');
|
|
|
|
}
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
BEGIN {
|
|
|
|
my $last_was_error = 0;
|
2007-01-23 20:49:10 +03:00
|
|
|
my $next_error = 0;
|
|
|
|
my $log_skip = 0;
|
|
|
|
my $cur_error = 0;
|
|
|
|
my $log_line = 0;
|
1999-03-19 04:52:36 +03:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
sub output_summary_line {
|
|
|
|
my ($line, $error_id) = @_;
|
|
|
|
|
|
|
|
if (has_error($line)) {
|
|
|
|
$line =~ s/&/&/g;
|
|
|
|
$line =~ s/</</g;
|
|
|
|
|
|
|
|
if (not $last_was_error) {
|
|
|
|
logprint("<a href=\"#err$error_id\">$line</a>");
|
|
|
|
} else {
|
|
|
|
logprint("$line");
|
|
|
|
}
|
|
|
|
$last_was_error = 1;
|
|
|
|
} else {
|
|
|
|
$last_was_error = 0;
|
1999-03-19 04:52:36 +03:00
|
|
|
}
|
2000-02-12 03:39:50 +03:00
|
|
|
return $last_was_error;
|
|
|
|
}
|
1999-03-19 04:52:36 +03:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
sub output_log_line {
|
|
|
|
my ($line, $line_num, $errors) = @_;
|
|
|
|
|
|
|
|
my $has_error = $line_num == $errors->[$next_error];
|
|
|
|
my $has_warning = has_warning($line);
|
|
|
|
|
|
|
|
$line =~ s/&/&/g;
|
|
|
|
$line =~ s/</</g unless $line =~ /^<a name=[^>]*>(?:<\/a>)?$/i or
|
|
|
|
$line =~ /^<\/a>$/i;
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
my $logline = '';
|
|
|
|
|
|
|
|
my %out = ();
|
1999-03-18 05:16:57 +03:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if (($has_error or $has_warning) and has_errorline($line, \%out)) {
|
2007-01-23 20:49:10 +03:00
|
|
|
my $q = quotemeta($out{error_file});
|
|
|
|
my $goto_line = $out{error_line} > 10 ? $out{error_line} - 10 : 1;
|
|
|
|
my $cvsblame = $out{error_guess} ? "cvsguess.cgi" : "cvsblame.cgi";
|
2007-08-25 07:27:25 +04:00
|
|
|
$line =~ s@$q@<a href=$::global_treedata->{$tree}->{bonsai_url}/$cvsblame?file=$out{error_file_ref}&rev=$::global_treedata->{$tree}->{cvs_branch}&mark=$out{error_line}\#$goto_line>$out{error_file}</a>@;
|
2000-02-12 03:39:50 +03:00
|
|
|
}
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($has_error) {
|
|
|
|
$next_error++;
|
|
|
|
|
|
|
|
unless ($last_was_error) {
|
|
|
|
$logline .= "<a name='err".($next_error - 1)."'></a>";
|
|
|
|
|
|
|
|
# Only print "NEXT ERROR" link if there is another error to jump to
|
2007-01-23 20:49:10 +03:00
|
|
|
my $have_more_errors = 0;
|
2000-02-12 03:39:50 +03:00
|
|
|
my $ii = $next_error;
|
|
|
|
while ($ii < $#{$errors} - 1) {
|
|
|
|
if ($errors->[$ii] != $errors->[$ii + 1] - 1) {
|
|
|
|
$have_more_errors = 1;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
$ii++;
|
|
|
|
}
|
|
|
|
if ($have_more_errors) {
|
|
|
|
$logline .= "<a href='#err$next_error'>NEXT ERROR</a> ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$logline .= "<font color='000080'>$line</font>";
|
|
|
|
|
|
|
|
$last_was_error = 1;
|
1998-06-17 01:43:24 +04:00
|
|
|
}
|
2000-02-12 03:39:50 +03:00
|
|
|
elsif ($has_warning) {
|
|
|
|
$logline = "<font color='000080'>$line</font>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$logline = $line;
|
|
|
|
$last_was_error = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
push_log_line($logline, $errors);
|
1999-08-26 04:45:12 +04:00
|
|
|
}
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
sub push_log_line {
|
2000-02-12 03:39:50 +03:00
|
|
|
my ($line, $log_errors) = @_;
|
2007-01-23 20:49:10 +03:00
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($fulltext) {
|
1999-03-19 23:37:07 +03:00
|
|
|
logprint($line);
|
1998-06-17 01:43:24 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($log_line > $log_errors->[$cur_error] + $LINES_AFTER_ERROR) {
|
1998-06-17 01:43:24 +04:00
|
|
|
$cur_error++;
|
|
|
|
}
|
|
|
|
|
2000-02-12 03:39:50 +03:00
|
|
|
if ($log_line >= $log_errors->[$cur_error] - $LINES_BEFORE_ERROR) {
|
|
|
|
if ($log_skip != 0) {
|
1999-03-19 23:37:07 +03:00
|
|
|
logprint("\n<i><font size=+1> Skipping $log_skip Lines...</i></font>\n\n");
|
1998-06-17 01:43:24 +04:00
|
|
|
$log_skip = 0;
|
|
|
|
}
|
1999-03-19 23:37:07 +03:00
|
|
|
logprint($line);
|
1998-06-17 01:43:24 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$log_skip++;
|
|
|
|
}
|
1999-03-19 23:37:07 +03:00
|
|
|
$log_line++;
|
2007-01-23 20:49:10 +03:00
|
|
|
}
|
1999-03-19 23:37:07 +03:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
sub logprint {
|
|
|
|
my $line = $_[0];
|
|
|
|
print $line;
|
|
|
|
print BRIEFFILE $line if not $fulltext;
|
|
|
|
}
|
1998-06-17 01:43:24 +04:00
|
|
|
}
|
2007-01-23 20:49:10 +03:00
|
|
|
|