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 => 'schroot.*File is not owned by user root',
34 message => 'Schroot setup failure',
37 timeout => 0, # This is a real error, not a build timeout
40 string => 'No space left on device',
41 message => 'Build ran out of disk space',
44 timeout => 0, # This is a real error, not a build timeout
47 string => 'aarch64-unknown-linux-gnu',
48 message => 'Wrong arch detected',
51 timeout => 0, # This is a real error, not a build timeout
54 string => 'binutils-aarch64',
55 message => 'Wrong arch detected',
58 timeout => 0, # This is a real error, not a build timeout
61 string => 'lib.linux-aarch64',
62 message => 'Wrong arch detected',
65 timeout => 0, # This is a real error, not a build timeout
68 # "binary build with no binary artifacts found" -> no packages
69 # built. Why not picked up already above?.
70 # Stop working on this log at this point
71 string => 'binary build with no binary artifacts found',
72 message => 'No binaries built',
75 timeout => 0, # This is a real error, not a build timeout
78 # "Bus error" -> alignment bug
79 string => 'Bus error',
80 message => 'Alignment problem',
83 timeout => 0, # This is a real error, not a build timeout
86 # "Segmentation fault" -> code problem
87 string => 'Segmentation fault',
88 pstring => 'Setting up (\S+)',
89 message => 'Segmentation fault when installing RESULT',
92 timeout => 0, # This is a real error, not a build timeout
95 # "Segmentation fault" -> code problem
96 string => 'Segmentation fault',
97 message => 'Segmentation fault',
100 timeout => 0, # This is a real error, not a build timeout
103 # "Illegal instruction" -> bad build target?
104 string => 'Illegal instruction',
105 pstring => 'Setting up (\S+)',
106 message => 'Illegal instruction when installing RESULT',
109 timeout => 0, # This is a real error, not a build timeout
112 # "Illegal instruction" -> bad build target?
113 string => 'Illegal instruction',
114 message => 'Illegal instruction',
117 timeout => 0, # This is a real error, not a build timeout
120 # Installing build-deps failed
121 string => 'dpkg: error processing package (\S+)',
122 message => 'Build-dep failed to install (RESULT)',
125 timeout => 0, # This is a real error, not a build timeout
128 # Installing build-deps failed
129 string => 'E: pbuilder-satisfydepends failed.',
130 message => 'Pbuilder build-deps failed',
133 timeout => 0, # This is a real error, not a build timeout
136 # Installing build-deps failed
137 string => 'E: Unmet dependencies',
138 message => 'Build-deps failed',
141 timeout => 0, # This is a real error, not a build timeout
144 # Installing build-deps failed
145 string => 'unsat-dependency: (\S+)',
146 message => 'Missing build-dep (RESULT)',
149 timeout => 0, # This is a real error, not a build timeout
152 # Build failed - missing build-dep?
153 string => 'build dependencies/conflicts unsatisfied',
154 message => 'Build-deps not satisfiable',
157 timeout => 0, # This is a real error, not a build timeout
160 # Build failed - missing build-dep?
161 string => 'ld: cannot find',
162 message => 'Build failure: missing library - missing build-dep?',
165 timeout => 0, # This is a real error, not a build timeout
168 # Build failed - missing build-dep?
169 string => 'fatal error:.*No such file or directory',
170 message => 'Build failure: missing header - missing build-dep?',
173 timeout => 0, # This is a real error, not a build timeout
176 # Build failed - missing build-dep?
177 string => 'SEVERE: Cannot resolve dependencies',
178 message => 'Build failure - missing build-dep?',
181 timeout => 0, # This is a real error, not a build timeout
184 # Build failed - can't exec something...
185 string => 'error trying to exec.*execvp: No',
186 message => 'Build failure (missing binary)',
189 timeout => 0, # This is a real error, not a build timeout
193 string => 'BUILD FAILED',
194 message => 'Build failure (java/javadoc))',
197 timeout => 0, # This is a real error, not a build timeout
201 string => 'make.*returned exit code',
202 message => 'Build failure (other)',
205 timeout => 0, # This is a real error, not a build timeout
209 string => '^make.*\*\*\*.* \[debian/rules.*Error \d+$',
210 message => 'Build failure (other)',
213 timeout => 0, # This is a real error, not a build timeout
217 string => 'dpkg-source: error: unrepresentable changes to source',
218 message => 'dpkg-source failure',
221 timeout => 0, # This is a real error, not a build timeout
225 string => 'fakeroot debian/rules binary',
226 message => 'Build failure (other)',
232 string => 'OSError: \[Errno 13\] Permission denied',
233 message => 'Python EPERM test failure',
239 string => 'dh_auto_test:.*returned exit code \d+',
240 message => 'Test failure',
245 # Timeout. pbuilder is too dumb to do this properly :-(
246 string => 'I: Terminating build process due to timeout',
247 message => 'Pbuilder build timeout',
250 timeout => 1, # This is a build timeout. If this happened
251 # before other errors, then we should retry
254 # Timeout from sbuild
255 string => 'Build killed with signal TERM after \d+ minutes of inactivity',
256 message => 'Sbuild build timeout',
259 timeout => 1, # This is a build timeout. If this happened
260 # before other errors, then we should retry
266 #foreach my $checktmp (@logcheck) {
267 # my %check = %$checktmp;
268 # print "looking for \"$check{string}\"\n";
269 # print " with log message \"$check{message}\"\n";
270 # print " check this regexp: $check{check}\n";
271 # print " stop if found: $check{stop}\n";
276 print "<title>Build log analysis</title>\n";
279 print "<h1>Build log analysis</h1>\n";
280 print "<p><a href=\"#summary\">Summary</a></p>\n";
281 print "<h2>Packages</h2>\n";
284 foreach my $input (@ARGV) {
285 open (IN, "< $input") or die "Can't read $input: $!\n";
292 print "<li>Looking at <a href=\"$input\">$input</a>:\n";
294 while (defined (my $line = <IN>) and !$stop) {
296 foreach my $checktmp (@logcheck) {
297 my %check = %$checktmp;
300 and ($line =~ m/$check{string}/)
301 and (!$check{pstring} or $oldline =~ m/$check{pstring}/)) {
302 # print " Line $lineno: found \"$check{string}\"\n";
304 my $message = $check{message};
305 $message =~ s,RESULT,$match,g;
306 $file_results{$message} = 1;
307 if ($check{timeout} and $errors == 0) {
308 print " <li>Line $lineno: $message\n";
309 print " <li>Build killed by timeout before any errors at line $lineno\n";
311 print " <li>Line $lineno: $message\n";
315 # print " stopping processing\n";
324 # End of checking this package
325 print " <li><strong>Found errors: $errors</strong>\n";
327 print " (maybe just timed out during build?)\n";
330 # Look for a note for manually-added logfile analysis
332 $note =~ s,\.log$,.note,;
334 open (IN, "< $note") or die "Can't open $note for reading: $!\n";
335 while (defined (my $line = <IN>)) {
337 if ($line =~ m,#(\d+),) {
340 $line =~ s,#(\d+),<a href="https://bugs.debian.org/$1">#$1</a>,g;
342 print " <li>$line\n";
348 foreach my $key (keys %file_results) {
349 $log_results{$key} += 1;
350 # print "now have $log_results{$key} for \"$key\"\n";
355 print "<a name=\"summary\"</a>\n";
356 print "<h2>Summary of results from $num_fail failed builds:</h2>\n";
358 print "<li>Found $existing_bugs existing bugs</li>\n";
359 foreach my $key (sort { $log_results{$b} <=> $log_results{$a} } keys %log_results) {
360 print " <li>Found $log_results{$key} logs showing $key\n";