find-build-errors revision 1130
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
#
require 5.005; # minimal Perl version required
use strict; #
use diagnostics; #
my $default_logfile = 'buildit-XW';
# Log file from new pkg(5) build (in same directory as $default_logfile)
my $default_ips_pkglogfile = 'make-pkgs';
# Log file from old SVR4 package build:
my $logfile;
my $pkglog;
my $pkglog_type; # 'ips' or 'svr4'
my $pkgvalidlog;
my $pkgfailed;
my $summary_only = 0;
$summary_only = 1;
shift @ARGV;
}
} else {
}
} else {
# climb the tree, removing one parent at a time to find the logfile
# print "$logfile not found\n";
}
}
}
my $make_errors = 0;
my $printme = 0;
# end of file stuff
print $l;
next;
}
# Look for package build results
$pkglog = $1;
} else {
$printme = 1;
print "\n";
}
print $l;
$pkgfailed = $1;
print $l;
}
# print lines where messages about COPYING file errors appear
# between "Copying package descriptions" & "Building packages"
$printme = 1;
$printme = 0;
}
# Log for IPS packaging checks
next;
$pkgvalidlog = $1;
}
# Print selected lines
print $l;
}
}
print "\n";
}
# Input: string containing name of logfile
# Prints errors from make output log
# Returns open log file pointer for post-processing
sub check_make_log {
my @steplines;
my $found_error = 0;
my $error_count = 0;
# Finished if we see the end line
($l =~ m{^\#\# [[:upper:]][[:lower:]]+ing }ms) || # pkg pattern
($l =~ m{^\S+ing( \S+)* in \S+\.\.\.$}ms)) { # xc pattern
@steplines = ();
$found_error = 0;
}
# If we already hit an error, skip the rest of this module
next if ($found_error != 0);
# Add this line to the saved output, combine with previous if previous
# ended with an \
if (($#steplines >= 0) && ($steplines[$#steplines] =~ m{\\\Z}ms)) {
$steplines[$#steplines] .= $l;
} else {
push @steplines, $l;
}
# Skip ahead to next line if this line ends with \
next if ($l =~ m{\\\Z}ms);
# Found a new error?
if (($l =~ m{\*\*\* }ms) || ($l =~ m{^(d)?make: Fatal error}ms)) {
$found_error = 1;
$error_count++;
next if ($summary_only);
# Print section header
print $steplines[0], "\n";
my $lastmake;
my $lastcommand = 1;
my $lastplus = 0;
# scan back to figure out how far back to print
for my $ln (1..($#steplines - 1)) {
my $sl = $steplines[$ln];
# print "lastmake: $lastmake, lastcom: $lastcommand, lastplus: $lastplus, line #$ln: $sl\n";
if ($sl =~ m{\b(make|dmake|gmake)\b}ms) {
$lastmake = $ln;
}
if ($sl =~ m{\breturned\b}ms) {
$lastcommand = $ln;
}
# print from start of shell's set -x output, not end
$lastcommand = $ln;
}
$lastcommand = $ln;
}
}
# print "lastmake: $lastmake, lastcommand: $lastcommand\n";
print $steplines[$lastmake];
}
print $steplines[$ln];
}
}
}
${$error_count_ref} = $error_count;
}
return $LOGFILE;
}
sub check_pkglog {
# Haven't rebuilt packages since last build, so no point reporting errors
}
} else {
}
return $pl;
}
# No packaging log found in build log, try to guess where it is
my $path_to_check = $logfile;
} else {
}
}
}
}
}
sub check_pkg_log {
my @pkglines;
# Clear saved lines for each new package
}
# Warnings we can ignore
}
}
my $ips_count_errors = 0;
my $ips_count_published = 0;
}
}
my @pkglines;
my $issue_count = 0;
my $publisher;
$publisher = $1;
}
# Clear saved lines for each new class of issue
$issue_type = $l;
$issue_count = 0;
next;
}
# These issues print across two lines
if ($issue_type eq
'Entries that differ between manifests and proto area:')
{
# strip off prefixes for comparisons
my $compare1 = $l;
# Warnings we can ignore
# validate_pkg doesn't like hardlinks to isaexec from our pkgs
}
}
}
}
# Skip warnings we can't do anything about (workaround for
next unless $l =~ m{pkg://$publisher/};
}
# Skip informational messages from pkglint
# Group pkglint errors by type
$issue_count++;
} else {
$issue_count = 1;
}
}
elsif ($l =~ m{^$}) { # Blank lines separate validate_pkg sections
$issue_count = 0;
} else {
$issue_count++;
}
}
# print any final issues that weren't followed by a blank line
}
}
{
}
} else {
}
}
}