#! /usr/bin/perl # Script to analyze failed build logs. Look for specific regexps to # classify things use strict; use warnings; my $logs = "/home/build/logs"; my $logs_fail = "$logs/FAIL"; my $num_fail = 0; # Known failure modes to look for my @logcheck = ( { # Couldn't install build-deps string => '^Unable to resolve dependencies', pstring => '.*', message => 'build-deps failed', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "rchitecture mismatch" -> should never build on this arch # Stop working on this log at this point string => 'rchitecture mismatch', pstring => '.*', message => 'architecture mismatch', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { string => 'not in arch list or does not match any', pstring => '.*', message => 'architecture mismatch', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { string => 'No space left on device', pstring => '.*', message => 'ran out of disk space', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "binary build with no binary artifacts found" -> no packages # built. Why not picked up already above?. # Stop working on this log at this point string => 'binary build with no binary artifacts found', pstring => '.*', message => 'no binaries built', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "Bus error" -> alignment bug string => 'Bus error', pstring => '.*', message => 'alignment problem', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "Segmentation fault" -> code problem string => 'Segmentation fault', pstring => 'Setting up libglib2.0-cil', message => 'Segmentation fault (mono)', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "Segmentation fault" -> code problem string => 'Segmentation fault', pstring => '.*', message => 'Segmentation fault', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "Illegal instruction" -> bad build target? string => 'Illegal instruction', pstring => 'Setting up ghc', message => 'Illegal instruction (ghc)', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # "Illegal instruction" -> bad build target? string => 'Illegal instruction', pstring => '.*', message => 'Illegal instruction', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Installing build-deps failed string => 'dpkg: error processing package', pstring => '.*', message => 'build-deps failed', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Installing build-deps failed string => 'E: Unmet dependencies', pstring => '.*', message => 'build-deps failed', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Installing build-deps failed string => 'unsat-dependency:', pstring => '.*', message => 'build-deps failed', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed - missing build-dep? string => 'build dependencies/conflicts unsatisfied', pstring => '.*', message => 'build-deps not satisfiable', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed - missing build-dep? string => 'ld: cannot find', pstring => '.*', message => 'build failure: missing library - missing build-dep?', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed - missing build-dep? string => 'fatal error:.*No such file or directory', pstring => '.*', message => 'build failure: missing header - missing build-dep?', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed - missing build-dep? string => 'SEVERE: Cannot resolve dependencies', pstring => '.*', message => 'build failure - missing build-dep?', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed - can't exec something... string => 'error trying to exec.*execvp: No', pstring => '.*', message => 'build failure (missing binary)', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed string => 'make.*returned exit code', pstring => '.*', message => 'build failure (other)', check => 1, stop => 0, timeout => 0, # This is a real error, not a build timeout }, { # Build failed string => '^make.*\*\*\*.* \[debian/rules.*Error \d+$', pstring => '.*', message => 'build failure (other)', check => 1, stop => 0, timeout => 0, # This is a real error, not a build timeout }, { # Build failed string => 'dpkg-source: error: unrepresentable changes to source', pstring => '.*', message => 'dpkg-source failure', check => 1, stop => 1, timeout => 0, # This is a real error, not a build timeout }, { # Build failed string => 'fakeroot debian/rules binary', pstring => '.*', message => 'build failure (other)', check => 0, stop => 1, }, { # Timeout. pbuilder is too dumb to do this properly :-( string => 'I: Terminating build process due to timeout', pstring => '.*', message => 'build timeout', check => 1, stop => 1, timeout => 1, # This is a build timeout. If this happened # before other errors, then we should retry }, ); my %log_results; #foreach my $checktmp (@logcheck) { # my %check = %$checktmp; # print "looking for \"$check{string}\"\n"; # print " with log message \"$check{message}\"\n"; # print " check this regexp: $check{check}\n"; # print " stop if found: $check{stop}\n"; #} print "\n"; print "\n"; print "Build log analysis\n"; print "\n"; print "\n"; print "

Build log analysis

\n"; print "

Packages

\n"; print "
    \n"; foreach my $input (@ARGV) { open (IN, "< $input") or die "Can't read $input: $!\n"; $num_fail++; my $stop = 0; my $lineno = 0; my $errors = 0; my $oldline = ""; my %file_results; print "
  1. Looking at $input:\n"; print "\n"; foreach my $key (keys %file_results) { $log_results{$key} += 1; # print "now have $log_results{$key} for \"$key\"\n"; } } print "
\n"; print "

Summary of results from $num_fail failed builds:

\n"; print "
    \n"; foreach my $key (keys %log_results) { print "
  1. Found $log_results{$key} logs showing $key\n"; } print "
\n"; print "\n"; print "\n";