3 # Script to analyze failed build logs. Look for specific regexps to
9 my $logs = "/home/build/logs";
10 my $logs_fail = "$logs/FAIL";
12 my $existing_bugs = 0;
14 # Known failure modes to look for
17 # "rchitecture mismatch" -> should never build on this arch
18 # Stop working on this log at this point
19 string => 'rchitecture mismatch',
20 message => 'architecture mismatch',
23 timeout => 0, # This is a real error, not a build timeout
26 string => 'not in arch list or does not match any',
27 message => 'architecture mismatch',
30 timeout => 0, # This is a real error, not a build timeout
33 string => 'No space left on device',
34 message => 'ran out of disk space',
37 timeout => 0, # This is a real error, not a build timeout
40 string => 'aarch64-unknown-linux-gnu',
41 message => 'Wrong arch detected',
44 timeout => 0, # This is a real error, not a build timeout
47 string => 'binutils-aarch64',
48 message => 'Wrong arch detected',
51 timeout => 0, # This is a real error, not a build timeout
54 string => 'lib.linux-aarch64',
55 message => 'Wrong arch detected',
58 timeout => 0, # This is a real error, not a build timeout
61 # "binary build with no binary artifacts found" -> no packages
62 # built. Why not picked up already above?.
63 # Stop working on this log at this point
64 string => 'binary build with no binary artifacts found',
65 message => 'no binaries built',
68 timeout => 0, # This is a real error, not a build timeout
71 # "Bus error" -> alignment bug
72 string => 'Bus error',
73 message => 'alignment problem',
76 timeout => 0, # This is a real error, not a build timeout
79 # "Segmentation fault" -> code problem
80 string => 'Segmentation fault',
81 pstring => 'Setting up (\S+)',
82 message => 'Segmentation fault (RESULT)',
85 timeout => 0, # This is a real error, not a build timeout
88 # "Segmentation fault" -> code problem
89 string => 'Segmentation fault',
90 message => 'Segmentation fault',
93 timeout => 0, # This is a real error, not a build timeout
96 # "Illegal instruction" -> bad build target?
97 string => 'Illegal instruction',
98 pstring => 'Setting up (\S+)',
99 message => 'Illegal instruction (RESULT)',
102 timeout => 0, # This is a real error, not a build timeout
105 # "Illegal instruction" -> bad build target?
106 string => 'Illegal instruction',
107 message => 'Illegal instruction',
110 timeout => 0, # This is a real error, not a build timeout
113 # Installing build-deps failed
114 string => 'dpkg: error processing package (\S+)',
115 message => 'build-dep failed to install (RESULT)',
118 timeout => 0, # This is a real error, not a build timeout
121 # Installing build-deps failed
122 string => 'E: pbuilder-satisfydepends failed.',
123 message => 'pbuilder build-deps failed',
126 timeout => 0, # This is a real error, not a build timeout
129 # Installing build-deps failed
130 string => 'E: Unmet dependencies',
131 message => 'build-deps failed',
134 timeout => 0, # This is a real error, not a build timeout
137 # Installing build-deps failed
138 string => 'unsat-dependency: (.*)',
139 message => 'missing build-dep (RESULT)',
142 timeout => 0, # This is a real error, not a build timeout
145 # Build failed - missing build-dep?
146 string => 'build dependencies/conflicts unsatisfied',
147 message => 'build-deps not satisfiable',
150 timeout => 0, # This is a real error, not a build timeout
153 # Build failed - missing build-dep?
154 string => 'ld: cannot find',
155 message => 'build failure: missing library - missing build-dep?',
158 timeout => 0, # This is a real error, not a build timeout
161 # Build failed - missing build-dep?
162 string => 'fatal error:.*No such file or directory',
163 message => 'build failure: missing header - missing build-dep?',
166 timeout => 0, # This is a real error, not a build timeout
169 # Build failed - missing build-dep?
170 string => 'SEVERE: Cannot resolve dependencies',
171 message => 'build failure - missing build-dep?',
174 timeout => 0, # This is a real error, not a build timeout
177 # Build failed - can't exec something...
178 string => 'error trying to exec.*execvp: No',
179 message => 'build failure (missing binary)',
182 timeout => 0, # This is a real error, not a build timeout
186 string => 'BUILD FAILED',
187 message => 'build failure (java/javadoc))',
190 timeout => 0, # This is a real error, not a build timeout
194 string => 'make.*returned exit code',
195 message => 'build failure (other)',
198 timeout => 0, # This is a real error, not a build timeout
202 string => '^make.*\*\*\*.* \[debian/rules.*Error \d+$',
203 message => 'build failure (other)',
206 timeout => 0, # This is a real error, not a build timeout
210 string => 'dpkg-source: error: unrepresentable changes to source',
211 message => 'dpkg-source failure',
214 timeout => 0, # This is a real error, not a build timeout
218 string => 'fakeroot debian/rules binary',
219 message => 'build failure (other)',
225 string => 'OSError: \[Errno 13\] Permission denied',
226 message => 'python EPERM test failure',
232 string => 'dh_auto_test:.*returned exit code \d+',
233 message => 'test failure',
238 # Timeout. pbuilder is too dumb to do this properly :-(
239 string => 'I: Terminating build process due to timeout',
240 message => 'pbuilder build timeout',
243 timeout => 1, # This is a build timeout. If this happened
244 # before other errors, then we should retry
247 # Timeout from sbuild
248 string => 'Build killed with signal TERM after \d+ minutes of inactivity',
249 message => 'sbuild build timeout',
252 timeout => 1, # This is a build timeout. If this happened
253 # before other errors, then we should retry
259 #foreach my $checktmp (@logcheck) {
260 # my %check = %$checktmp;
261 # print "looking for \"$check{string}\"\n";
262 # print " with log message \"$check{message}\"\n";
263 # print " check this regexp: $check{check}\n";
264 # print " stop if found: $check{stop}\n";
269 print "<title>Build log analysis</title>\n";
272 print "<h1>Build log analysis</h1>\n";
273 print "<h2>Packages</h2>\n";
276 foreach my $input (@ARGV) {
277 open (IN, "< $input") or die "Can't read $input: $!\n";
284 print "<li>Looking at <a href=\"$input\">$input</a>:\n";
286 while (defined (my $line = <IN>) and !$stop) {
288 foreach my $checktmp (@logcheck) {
289 my %check = %$checktmp;
292 and ($line =~ m/$check{string}/)
293 and (!$check{pstring} or $oldline =~ m/$check{pstring}/)) {
294 # print " Line $lineno: found \"$check{string}\"\n";
296 my $message = $check{message};
297 $message =~ s,RESULT,$match,g;
298 $file_results{$message} = 1;
299 if ($check{timeout} and $errors == 0) {
300 print " <li>Line $lineno: $message\n";
301 print " <li>Build killed by timeout before any errors at line $lineno\n";
303 print " <li>Line $lineno: $message\n";
307 # print " stopping processing\n";
316 # End of checking this package
317 print " <li><strong>found errors: $errors</strong>\n";
319 print " (maybe just timed out during build?)\n";
322 # Look for a note for manually-added logfile analysis
324 $note =~ s,\.log$,.note,;
326 open (IN, "< $note") or die "Can't open $note for reading: $!\n";
327 while (defined (my $line = <IN>)) {
329 if ($line =~ m,#(\d+),) {
332 $line =~ s,#(\d+),<a href="https://bugs.debian.org/$1">#$1</a>,g;
334 print " <li>$line\n";
340 foreach my $key (keys %file_results) {
341 $log_results{$key} += 1;
342 # print "now have $log_results{$key} for \"$key\"\n";
347 print "<h2>Summary of results from $num_fail failed builds:</h2>\n";
349 print "<li>Found $existing_bugs existing bugs</li>\n";
350 foreach my $key (keys %log_results) {
351 print " <li>Found $log_results{$key} logs showing $key\n";