find-build-errors revision 1130
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. # 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, # and/or sell copies of the Software, and to permit persons to whom the # 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 # 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 File::
Spec;
# pathname manipulation routines use File::
stat;
# Named results from stat() function # Log file from new pkg(5) build (in same directory as $default_logfile) # Log file from old SVR4 package build: # climb the tree, removing one parent at a time to find the logfile # print "$logfile not found\n"; # Look for package build results # print lines where messages about COPYING file errors appear # between "Copying package descriptions" & "Building packages" # Log for IPS packaging checks # Input: string containing name of logfile # Prints errors from make output log # Returns open log file pointer for post-processing print "Scanning $logfile for error messages...\n\n"; # Finished if we see the end line if (($l =~ m{^\#\# making \S+ in \S+\.\.\.$}ms) || # open-src pattern ($l =~ m{^\#\# [[:upper:]][[:lower:]]+ing }ms) || # pkg pattern ($l =~ m{^\S+ing( \S+)* in \S+\.\.\.$}ms)) { # xc pattern # 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 if (($#steplines >= 0) && ($steplines[$#steplines] =~ m{\\\Z}ms)) { $steplines[$#steplines] .= $l; # Skip ahead to next line if this line ends with \ next if ($l =~ m{\\\Z}ms); if (($l =~ m{\*\*\* }ms) || ($l =~ m{^(d)?make: Fatal error}ms)) { print $steplines[0], "\n"; # 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) { if ($sl =~ m{\breturned\b}ms) { } elsif ($sl =~ m{^\+ }ms) { # print from start of shell's set -x output, not end # print "lastmake: $lastmake, lastcommand: $lastcommand\n"; print "\n", '-'x78, "\n"; # Haven't rebuilt packages since last build, so no point reporting errors # No packaging log found in build log, try to guess where it is print "\nScanning $pkgvalidlog for package checking issues...\n\n"; # Clear saved lines for each new package seek($PKGLOG, 0, 0); # reset to start reading from beginning of file # Clear saved lines for each new class of issue if (($l =~ m{^\S+ .*:+$}ms) || ($l =~ m{^\#\# })) { # These issues print across two lines 'Entries that differ between manifests and proto area:') # strip off prefixes for comparisons # validate_pkg doesn't like hardlinks to isaexec from our pkgs # Skip warnings we can't do anything about (workaround for # Skip informational messages from pkglint # Group pkglint errors by type elsif ($l =~ m{^$}) { # Blank lines separate validate_pkg sections # print any final issues that weren't followed by a blank line