author | Dario Sestito <darios@symbian.org> |
Mon, 12 Apr 2010 13:26:38 +0100 | |
changeset 216 | 907120563fce |
parent 209 | ba90e30c0f3c |
child 227 | f0ed429f31b7 |
permissions | -rw-r--r-- |
176 | 1 |
# Copyright (c) 2009 Symbian Foundation Ltd |
2 |
# This component and the accompanying materials are made available |
|
3 |
# under the terms of the License "Eclipse Public License v1.0" |
|
4 |
# which accompanies this distribution, and is available |
|
5 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
6 |
# |
|
7 |
# Initial Contributors: |
|
8 |
# Symbian Foundation Ltd - initial contribution. |
|
9 |
# |
|
10 |
# Contributors: |
|
11 |
# |
|
12 |
# Description: |
|
13 |
# Unite and HTML-ize Raptor log files |
|
14 |
||
15 |
use strict; |
|
16 |
use FindBin; |
|
17 |
use lib $FindBin::Bin; |
|
18 |
use RaptorError; |
|
19 |
use RaptorWarning; |
|
20 |
use RaptorInfo; |
|
21 |
use RaptorUnreciped; |
|
22 |
use RaptorRecipe; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
23 |
use releaseables; |
176 | 24 |
|
25 |
use XML::SAX; |
|
26 |
use RaptorSAXHandler; |
|
27 |
use Getopt::Long; |
|
28 |
||
186
ec83a06d23a8
HTML escape failures so that they can be viewed correctly
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
29 |
use CGI; |
ec83a06d23a8
HTML escape failures so that they can be viewed correctly
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
30 |
|
176 | 31 |
our $raptorbitsdir = 'raptorbits'; |
32 |
our $basedir = ''; |
|
33 |
my $outputdir = "html"; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
34 |
our $releaseablesdir = "releaseables"; |
176 | 35 |
our $raptor_config = 'dummy_config'; |
36 |
our $current_log_file = ''; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
37 |
our $missing = 0; |
176 | 38 |
my $help = 0; |
39 |
GetOptions(( |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
40 |
'missing!' => \$missing, |
176 | 41 |
'basedir=s' => \$basedir, |
42 |
'help!' => \$help |
|
43 |
)); |
|
44 |
my @logfiles = @ARGV; |
|
45 |
||
46 |
$help = 1 if (!@logfiles); |
|
47 |
||
48 |
if ($help) |
|
49 |
{ |
|
50 |
print "Unite and HTML-ize Raptor log files.\n"; |
|
51 |
print "Usage: perl uh.pl [OPTIONS] FILE1 FILE2 ...\n"; |
|
52 |
print "where OPTIONS are:\n"; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
53 |
print "\t-m, --missing\tAlso add the list of missing binaries (Raptor log should include whatlog info).\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
54 |
print "\t\t\tCheck is done against the epoc tree at the root of the current drive\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
55 |
print "\t-b DIR, --basedir DIR\tGenerate output under DIR (defaults to current dir)\n"; |
176 | 56 |
exit(0); |
57 |
} |
|
58 |
||
59 |
if ($basedir) |
|
60 |
{ |
|
61 |
$raptorbitsdir = "$basedir/raptorbits"; |
|
62 |
$outputdir = "$basedir/html"; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
63 |
$releaseablesdir = "$basedir/releaseables"; |
176 | 64 |
} |
65 |
mkdir($basedir) if (!-d$basedir); |
|
66 |
||
67 |
$raptorbitsdir =~ s,/,\\,g; # this is because rmdir doens't cope correctly with the forward slashes |
|
68 |
||
69 |
system("rmdir /S /Q $raptorbitsdir") if (-d $raptorbitsdir); |
|
70 |
mkdir($raptorbitsdir); |
|
71 |
#print "Created dir $raptorbitsdir.\n"; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
72 |
system("rmdir /S /Q $releaseablesdir") if (-d $releaseablesdir); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
73 |
mkdir("$releaseablesdir"); |
176 | 74 |
|
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
75 |
our $failure_item_number = 0; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
76 |
|
176 | 77 |
# create empty summary file anyway |
78 |
open(SUMMARY, ">$raptorbitsdir/summary.csv"); |
|
79 |
close(SUMMARY); |
|
80 |
||
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
81 |
|
176 | 82 |
my $saxhandler = RaptorSAXHandler->new(); |
83 |
$saxhandler->add_observer('RaptorError', $RaptorError::reset_status); |
|
84 |
$saxhandler->add_observer('RaptorWarning', $RaptorWarning::reset_status); |
|
85 |
$saxhandler->add_observer('RaptorInfo', $RaptorInfo::reset_status); |
|
86 |
$saxhandler->add_observer('RaptorUnreciped', $RaptorUnreciped::reset_status); |
|
87 |
$saxhandler->add_observer('RaptorRecipe', $RaptorRecipe::reset_status); |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
88 |
$saxhandler->add_observer('releaseables', $releaseables::reset_status); |
176 | 89 |
|
90 |
our $allbldinfs = {}; |
|
91 |
||
92 |
my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler); |
|
93 |
for (@logfiles) |
|
94 |
{ |
|
95 |
print "Reading file: $_\n"; |
|
96 |
$current_log_file = $_; |
|
97 |
$parser->parse_uri($_); |
|
98 |
} |
|
99 |
||
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
100 |
releaseables::remove_missing_duplicates(); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
101 |
|
176 | 102 |
my @allpackages = distinct_packages($allbldinfs); |
103 |
||
104 |
print "Generating HTML...\n"; |
|
105 |
||
106 |
system("rd /S /Q $outputdir") if (-d $outputdir); |
|
107 |
mkdir ($outputdir); |
|
108 |
||
109 |
my $raptor_errors = {}; |
|
110 |
my $raptor_warnings = {}; |
|
111 |
my $raptor_unreciped = {}; |
|
112 |
my $general_failures_num_by_severity = {}; |
|
113 |
my $general_failures_by_category_severity = {}; |
|
114 |
my $recipe_failures_num_by_severity = {}; |
|
115 |
my $recipe_failures_by_package_severity = {}; |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
116 |
my $missing_by_package = {}; |
176 | 117 |
#my $severities = {}; |
118 |
my @severities = ('critical', 'major', 'minor', 'unknown'); |
|
119 |
||
120 |
# READ SUMMARY.CSV FILE |
|
121 |
my $csv_file = "$raptorbitsdir/summary.csv"; |
|
122 |
my $csv_linenum = 0; |
|
123 |
open(CSV, $csv_file); |
|
124 |
while(<CSV>) |
|
125 |
{ |
|
126 |
$csv_linenum ++; |
|
127 |
my $line = $_; |
|
128 |
||
129 |
if ($line =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/) |
|
130 |
{ |
|
131 |
my $failure = {}; |
|
132 |
$failure->{category} = $1; |
|
133 |
$failure->{subcategory} = $2; |
|
134 |
$failure->{severity} = $3; |
|
135 |
$failure->{config} = $4; |
|
136 |
$failure->{component} = $5; |
|
137 |
$failure->{mmp} = $6; |
|
138 |
$failure->{phase} = $7; |
|
139 |
$failure->{recipe} = $8; |
|
140 |
$failure->{file} = $9; |
|
141 |
$failure->{linenum} = $10; |
|
142 |
||
143 |
my $failure_package = ''; |
|
144 |
||
145 |
if (!$failure->{category}) |
|
146 |
{ |
|
147 |
print "WARNING: summary line without a category at $csv_file line $csv_linenum. Skipping\n"; |
|
148 |
next; |
|
149 |
} |
|
150 |
||
151 |
if ($failure->{category} =~ m,^recipe_failure$,i and !$failure->{component}) |
|
152 |
{ |
|
153 |
print "WARNING: recipe_failure with component field empty at $csv_file line $csv_linenum. Skipping\n"; |
|
154 |
next; |
|
155 |
} |
|
156 |
if ($failure->{component}) |
|
157 |
{ |
|
158 |
if ($failure->{component} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),) |
|
159 |
{ |
|
160 |
$failure_package = $1; |
|
161 |
} |
|
162 |
else |
|
163 |
{ |
|
164 |
print "WARNING: summary line with wrong component path at $csv_file line $csv_linenum. Skipping\n"; |
|
165 |
next; |
|
166 |
} |
|
167 |
} |
|
168 |
||
169 |
$failure->{subcategory} = 'uncategorized' if (!$failure->{subcategory}); |
|
170 |
$failure->{severity} = 'unknown' if (!$failure->{severity}); |
|
171 |
$failure->{mmp} = '-' if (!$failure->{mmp}); |
|
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
172 |
$failure->{phase} = '-' if (!$failure->{phase}); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
173 |
$failure->{recipe} = '-' if (!$failure->{recipe}); |
176 | 174 |
|
175 |
# populate severities dynamically. |
|
176 |
#$severities->{$failure->{severity}} = 1; |
|
177 |
||
178 |
# put failure items into their category container |
|
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
179 |
if ($failure->{category} =~ /^recipe_failure$/i || $failure->{category} =~ /^raptor_(error|warning|unreciped)$/i && $failure_package) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
180 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
181 |
$recipe_failures_num_by_severity->{$failure_package} = {} if (!defined $recipe_failures_num_by_severity->{$failure_package}); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
182 |
my $package_failure = $recipe_failures_num_by_severity->{$failure_package}; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
183 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
184 |
if (!defined $package_failure->{$failure->{severity}}) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
185 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
186 |
$package_failure->{$failure->{severity}} = 1; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
187 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
188 |
else |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
189 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
190 |
$package_failure->{$failure->{severity}} ++; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
191 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
192 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
193 |
$recipe_failures_by_package_severity->{$failure_package} = {} if (!defined $recipe_failures_by_package_severity->{$failure_package}); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
194 |
$recipe_failures_by_package_severity->{$failure_package}->{$failure->{severity}} = [] if (!defined $recipe_failures_by_package_severity->{$failure_package}->{$failure->{severity}}); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
195 |
push(@{$recipe_failures_by_package_severity->{$failure_package}->{$failure->{severity}}}, $failure); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
196 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
206
diff
changeset
|
197 |
elsif ($failure->{category} =~ /^raptor_(error|warning|unreciped)$/i) |
176 | 198 |
{ |
199 |
$general_failures_num_by_severity->{$failure->{category}} = {} if (!defined $general_failures_num_by_severity->{$failure->{category}}); |
|
200 |
my $general_failure = $general_failures_num_by_severity->{$failure->{category}}; |
|
201 |
||
202 |
if (!defined $general_failure->{$failure->{severity}}) |
|
203 |
{ |
|
204 |
$general_failure->{$failure->{severity}} = 1; |
|
205 |
} |
|
206 |
else |
|
207 |
{ |
|
208 |
$general_failure->{$failure->{severity}} ++; |
|
209 |
} |
|
210 |
||
211 |
$general_failures_by_category_severity->{$failure->{category}} = {} if (!defined $general_failures_by_category_severity->{$failure->{category}}); |
|
212 |
$general_failures_by_category_severity->{$failure->{category}}->{$failure->{severity}} = [] if (!defined $general_failures_by_category_severity->{$failure->{category}}->{$failure->{severity}}); |
|
213 |
push(@{$general_failures_by_category_severity->{$failure->{category}}->{$failure->{severity}}}, $failure); |
|
214 |
} |
|
215 |
} |
|
216 |
else |
|
217 |
{ |
|
218 |
print "WARNING: line does not match expected format at $csv_file line $csv_linenum. Skipping\n"; |
|
219 |
} |
|
220 |
} |
|
221 |
close(CSV); |
|
222 |
||
223 |
# PRINT HTML SUMMARY |
|
224 |
my $aggregated_html = "$outputdir/index.html"; |
|
225 |
open(AGGREGATED, ">$aggregated_html"); |
|
226 |
print AGGREGATED "RAPTOR BUILD SUMMARY<br/>\n"; |
|
227 |
||
228 |
print AGGREGATED "<br/>GENERAL FAILURES<br/>\n"; |
|
229 |
print AGGREGATED "<table border='1'>\n"; |
|
230 |
my $tableheader = "<tr><th>category</th>"; |
|
231 |
for (@severities) { $tableheader .= "<th>$_</th>"; } |
|
232 |
$tableheader .= "</tr>"; |
|
233 |
print AGGREGATED "$tableheader\n"; |
|
234 |
for my $category (keys %{$general_failures_num_by_severity}) |
|
235 |
{ |
|
236 |
print_category_specific_summary($category, $general_failures_by_category_severity->{$category}); |
|
237 |
my $categoryline = "<tr><td><a href='$category.html'>$category</a></td>"; |
|
238 |
for (@severities) |
|
239 |
{ |
|
240 |
my $failuresbyseverity = 0; |
|
241 |
$failuresbyseverity = $general_failures_num_by_severity->{$category}->{$_} if (defined $general_failures_num_by_severity->{$category}->{$_}); |
|
242 |
$categoryline .= "<td>$failuresbyseverity</td>"; |
|
243 |
} |
|
244 |
$categoryline .= "</tr>"; |
|
245 |
print AGGREGATED "$categoryline\n"; |
|
246 |
} |
|
247 |
print AGGREGATED "</table>\n"; |
|
248 |
print AGGREGATED "<br/>\n"; |
|
249 |
||
250 |
print AGGREGATED "<br/>PACKAGE-SPECIFIC FAILURES<br/>\n"; |
|
251 |
print AGGREGATED "<table border='1'>\n"; |
|
252 |
$tableheader = "<tr><th>package</th>"; |
|
253 |
for (@severities) { $tableheader .= "<th>$_</th>"; } |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
254 |
$tableheader .= "<th>missing</th>" if ($missing); |
176 | 255 |
$tableheader .= "</tr>"; |
256 |
print AGGREGATED "$tableheader\n"; |
|
257 |
for my $package (@allpackages) |
|
258 |
{ |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
259 |
my $mustlink = print_package_specific_summary($package); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
260 |
if ($mustlink) |
176 | 261 |
{ |
262 |
my $packagesummaryhtml = $package; |
|
263 |
$packagesummaryhtml =~ s,/,_,; |
|
264 |
$packagesummaryhtml .= ".html"; |
|
265 |
my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>"; |
|
266 |
for (@severities) |
|
267 |
{ |
|
268 |
my $failuresbyseverity = 0; |
|
269 |
$failuresbyseverity = $recipe_failures_num_by_severity->{$package}->{$_} if (defined $recipe_failures_num_by_severity->{$package}->{$_}); |
|
270 |
$packageline .= "<td>$failuresbyseverity</td>"; |
|
271 |
} |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
272 |
$packageline .= "<td>".$missing_by_package->{$package}."</td>" if ($missing); |
204
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
201
diff
changeset
|
273 |
$packageline .= "</tr>\n"; |
176 | 274 |
print AGGREGATED "$packageline\n"; |
275 |
} |
|
276 |
else |
|
277 |
{ |
|
278 |
my $packageline = "<tr><td>$package</td>"; |
|
279 |
for (@severities) { $packageline .= "<td>0</td>"; } |
|
204
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
201
diff
changeset
|
280 |
$packageline .= "<td>0</td>" if ($missing); |
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
201
diff
changeset
|
281 |
$packageline .= "</tr>\n"; |
176 | 282 |
print AGGREGATED "$packageline\n"; |
283 |
} |
|
284 |
} |
|
285 |
print AGGREGATED "</table>\n"; |
|
286 |
close(AGGREGATED); |
|
287 |
||
288 |
translate_detail_files_to_html(); |
|
289 |
||
290 |
print "OK, done. Please open $outputdir/index.html.\n"; |
|
291 |
||
292 |
||
293 |
sub print_category_specific_summary |
|
294 |
{ |
|
295 |
my ($category, $failures_by_severity) = @_; |
|
296 |
||
297 |
my $filenamebase = $category; |
|
298 |
$filenamebase =~ s,/,_,; |
|
299 |
||
300 |
open(SPECIFIC, ">$outputdir/$filenamebase.html"); |
|
301 |
print SPECIFIC "FAILURES FOR CATEGORY $category<br/>\n"; |
|
302 |
||
303 |
for my $severity (@severities) |
|
304 |
{ |
|
305 |
if (defined $failures_by_severity->{$severity}) |
|
306 |
{ |
|
307 |
print SPECIFIC "<br/>".uc($severity)."<br/>\n"; |
|
308 |
print SPECIFIC "<table border='1'>\n"; |
|
309 |
# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line |
|
310 |
my $tableheader = "<tr><th>category</th><th>log file</th><th>log snippet</th></tr>"; |
|
311 |
print SPECIFIC "$tableheader\n"; |
|
312 |
||
313 |
for my $failure (@{$failures_by_severity->{$severity}}) |
|
314 |
{ |
|
315 |
my $failureline = "<tr><td>$failure->{subcategory}</td>"; |
|
316 |
$failureline .= "<td>$failure->{config}</td>"; |
|
317 |
$failureline .= "<td><a href='$filenamebase\_failures.html#failure_item_$failure->{linenum}'>item $failure->{linenum}</a></td>"; |
|
318 |
$failureline .= "</tr>"; |
|
319 |
print SPECIFIC "$failureline\n"; |
|
320 |
} |
|
321 |
||
322 |
print SPECIFIC "</table>\n"; |
|
323 |
print SPECIFIC "<br/>\n"; |
|
324 |
} |
|
325 |
} |
|
326 |
||
327 |
close(SPECIFIC); |
|
328 |
} |
|
329 |
||
330 |
sub print_package_specific_summary |
|
331 |
{ |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
332 |
my ($package) = @_; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
333 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
334 |
my $anyfailures = 0; |
176 | 335 |
|
336 |
my $filenamebase = $package; |
|
337 |
$filenamebase =~ s,/,_,; |
|
338 |
||
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
339 |
if (defined $recipe_failures_by_package_severity->{$package}) |
176 | 340 |
{ |
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
341 |
$anyfailures = 1; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
342 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
343 |
my $failures_by_severity = $recipe_failures_by_package_severity->{$package}; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
344 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
345 |
open(SPECIFIC, ">$outputdir/$filenamebase.html"); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
346 |
print SPECIFIC "FAILURES FOR PACKAGE $package<br/>\n"; |
176 | 347 |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
348 |
for my $severity (@severities) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
349 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
350 |
if (defined $failures_by_severity->{$severity}) |
176 | 351 |
{ |
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
352 |
print SPECIFIC "<br/>".uc($severity)."<br/>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
353 |
print SPECIFIC "<table border='1'>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
354 |
# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
355 |
my $tableheader = "<tr><th>category</th><th>configuration</th><th>mmp</th><th>phase</th><th>recipe</th><th>log snippet</th></tr>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
356 |
print SPECIFIC "$tableheader\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
357 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
358 |
for my $failure (@{$failures_by_severity->{$severity}}) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
359 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
360 |
my $failureline = "<tr><td>$failure->{subcategory}</td>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
361 |
$failureline .= "<td>$failure->{config}</td>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
362 |
$failureline .= "<td>$failure->{mmp}</td>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
363 |
$failureline .= "<td>$failure->{phase}</td>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
364 |
$failureline .= "<td>$failure->{recipe}</td>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
365 |
$failureline .= "<td><a href='$filenamebase\_failures.html#failure_item_$failure->{linenum}'>item $failure->{linenum}</a></td>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
366 |
$failureline .= "</tr>"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
367 |
print SPECIFIC "$failureline\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
368 |
} |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
369 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
370 |
print SPECIFIC "</table>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
371 |
print SPECIFIC "<br/>\n"; |
176 | 372 |
} |
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
373 |
} |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
374 |
close(SPECIFIC); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
375 |
} |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
376 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
377 |
if ($missing) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
378 |
{ |
206
fb5bc19e742d
Fix '0' as number of missing is not shown if there are errors but no missing
Dario Sestito <darios@symbian.org>
parents:
204
diff
changeset
|
379 |
$missing_by_package->{$package} = 0; |
fb5bc19e742d
Fix '0' as number of missing is not shown if there are errors but no missing
Dario Sestito <darios@symbian.org>
parents:
204
diff
changeset
|
380 |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
381 |
my $missinglistfile = $package; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
382 |
$missinglistfile =~ s,/,_,; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
383 |
$missinglistfile .= "_missing.txt"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
384 |
if (open(MISSINGLIST, "$::raptorbitsdir/$missinglistfile")) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
385 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
386 |
my @list = (); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
387 |
while(<MISSINGLIST>) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
388 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
389 |
my $missingfile = $_; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
390 |
chomp $missingfile; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
391 |
$missingfile =~ s,^\s+,,g; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
392 |
$missingfile =~ s,\s+$,,g; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
393 |
push(@list, $missingfile); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
394 |
} |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
395 |
close(MISSINGLIST); |
176 | 396 |
|
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
397 |
$missing_by_package->{$package} = scalar(@list); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
398 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
399 |
if ($missing_by_package->{$package} > 0) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
400 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
401 |
open(SPECIFIC, ">>$outputdir/$filenamebase.html"); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
402 |
print SPECIFIC "FAILURES FOR PACKAGE $package<br/>\n" if(!$anyfailures); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
403 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
404 |
$anyfailures = 1; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
405 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
406 |
print SPECIFIC "<br/>MISSING<br/>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
407 |
print SPECIFIC "<table border='1'>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
408 |
# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
409 |
my $tableheader = "<tr><th>file</th></tr>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
410 |
print SPECIFIC "$tableheader\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
411 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
412 |
for my $missingfile (sort {$a cmp $b} @list) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
413 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
414 |
$missingfile = CGI::escapeHTML($missingfile); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
415 |
print SPECIFIC "<tr><td>$missingfile</td></tr>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
416 |
} |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
417 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
418 |
print SPECIFIC "</table>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
419 |
print SPECIFIC "<br/>\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
420 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
421 |
close(SPECIFIC); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
422 |
} |
176 | 423 |
} |
424 |
} |
|
425 |
||
201
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
426 |
return $anyfailures; |
176 | 427 |
} |
428 |
||
429 |
sub translate_detail_files_to_html |
|
430 |
{ |
|
431 |
opendir(DIR, $raptorbitsdir); |
|
432 |
my @failurefiles = readdir(DIR); |
|
433 |
closedir(DIR); |
|
204
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
201
diff
changeset
|
434 |
@failurefiles = grep($_ =~ /\.txt$/ && $_ !~ /_missing\.txt$/, @failurefiles); |
176 | 435 |
|
436 |
for my $file (@failurefiles) |
|
437 |
{ |
|
438 |
$file =~ /(.*)\.txt$/; |
|
439 |
my $filenamebase = $1; |
|
440 |
||
441 |
my $filecontent = ''; |
|
442 |
open(FILE, "$raptorbitsdir/$file"); |
|
443 |
{ |
|
444 |
local $/=undef; |
|
445 |
$filecontent = <FILE>; |
|
446 |
} |
|
447 |
close(FILE); |
|
448 |
||
186
ec83a06d23a8
HTML escape failures so that they can be viewed correctly
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
449 |
$filecontent = CGI::escapeHTML($filecontent); |
176 | 450 |
$filecontent =~ s,---(failure_item_\d+)---,<a name="$1">---$1---</a>,g; |
451 |
$filecontent = "<pre>$filecontent</pre>"; |
|
452 |
||
453 |
open(FILE, ">$outputdir/$filenamebase\_failures.html"); |
|
454 |
print FILE $filecontent; |
|
455 |
close(FILE); |
|
456 |
} |
|
457 |
} |
|
458 |
||
459 |
sub distinct_packages |
|
460 |
{ |
|
461 |
my ($allbldinfs) = @_; |
|
462 |
||
463 |
my $allpackages = {}; |
|
464 |
||
465 |
for my $bldinf (keys %{$allbldinfs}) |
|
466 |
{ |
|
467 |
# normalize bldinf path |
|
468 |
$bldinf = lc($bldinf); |
|
469 |
$bldinf =~ s,^[A-Za-z]:,,; |
|
470 |
$bldinf =~ s,[\\],/,g; |
|
471 |
||
472 |
my $package = ''; |
|
473 |
if ($bldinf =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),) |
|
474 |
{ |
|
475 |
$package = $1; |
|
476 |
} |
|
477 |
else |
|
478 |
{ |
|
479 |
print "WARNING: can't understand bldinf attribute of recipe: $bldinf. Won't dump to failed recipes file.\n"; |
|
480 |
} |
|
481 |
||
482 |
$allpackages->{$package} = 1; |
|
483 |
} |
|
484 |
||
485 |
return sort {$a cmp $b} keys %{$allpackages}; |
|
486 |
} |