Remove dead code used to support deleted feature.

Post-build email error reporting was removed in commit e7e8930 but not
all code needed to support that feature had been removed. This is now
rectified.
wilder
Michael Pyne 15 years ago
parent 3626977ed1
commit 8cdb1f5157
  1. 81
      kdesrc-build

@ -6953,87 +6953,6 @@ EOF
return @resultList;
}
# Subroutine to try an intelligently determine what caused the module to fail
# to build/update/whatever. The first parameter is the name of the module,
# and the return value is the best guess at the error. If no error is detected
# the last 30 lines of the file are returned instead.
sub whats_the_module_error
{
my $module = shift;
my $file = get_option($module, '#error-log-file');
return "No logfile for module $module.\n" unless $file;
open ERRORFILE, "<$file" or return "Can't open logfile $file.\n";
my @lastlines; # Used to buffer last lines read.
my @errors; # Tracks errors and the file they were found in.
my $lastfile = ''; # Tracks last filename read in error log.
my $errorCount = 0;
my $output;
# TODO: This code is tested for gcc and GNU ld, as, etc, I'm not sure how
# effective it is at parsing the error output of other build toolchains.
while (<ERRORFILE>)
{
# Keep last 30 lines.
push @lastlines, $_;
shift @lastlines if scalar @lastlines > 30;
my ($file, $line, $msg) = /^([^:]*):(\d+):\s*(.*)$/;
next unless ($file and $line and $msg);
next if $msg =~ /warn/i;
next if $msg =~ /^in file included from/i;
next if $msg =~ /^\s*$/ or $file =~ /^\s*$/;
$msg =~ s/^error: ?//i;
if ($file eq $lastfile)
{
$errorCount++;
push @errors, $msg if $errorCount < 5;
}
else
{
# Check is because we print info on the last file read, so there
# should be a last file. ;)
if ($lastfile)
{
my $error = $errorCount == 1 ? "error" : "errors";
$output .= "$errorCount $error in $lastfile\n";
$output .= "Error: $_\n" foreach (@errors);
$output .= "\t<clipped>\n" if $errorCount > 5;
$output .= "\n";
}
$errorCount = 1;
@errors = ($msg);
}
$lastfile = $file;
}
close ERRORFILE;
if (not $lastfile)
{
# Print out last lines read, hopefully a more descriptive error
# message is in there.
$output .= "Can't find errors, last " . scalar @lastlines . " line(s) of the output are:\n";
$output .= $_ foreach (@lastlines);
return $output;
}
# Don't forget to display info on last file read since it won't be done in
# the loop.
my $error = $errorCount == 1 ? "error" : "errors";
$output .= "$errorCount $error in $lastfile\n";
$output .= "Error: $_\n" foreach (@errors);
$output .= "\t<clipped>\n" if $errorCount > 5;
return $output;
}
# Exits out of kdesrc-build, executing the user's preferred shell instead. The
# difference is that the environment variables should be as set in kdesrc-build
# instead of as read from .bashrc and friends.

Loading…
Cancel
Save