author | William Roberts <williamr@symbian.org> |
Fri, 03 Sep 2010 13:41:03 +0100 | |
changeset 320 | e9c03eb287f9 |
parent 311 | 09f57a9bad07 |
permissions | -rw-r--r-- |
177 | 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: |
|
258
08436a227940
Add author information. Reviewed descriptions
Dario Sestito <darios@symbian.org>
parents:
252
diff
changeset
|
11 |
# Dario Sestito <darios@symbian.org> |
177 | 12 |
# |
13 |
# Description: |
|
14 |
# Raptor parser module. |
|
15 |
# Extract, analyzes and dumps raptor warnings i.e. content of <warning> tags from a raptor log file |
|
16 |
||
17 |
package RaptorWarning; |
|
18 |
||
19 |
use strict; |
|
20 |
use RaptorCommon; |
|
21 |
||
22 |
our $reset_status = {}; |
|
23 |
my $buildlog_status = {}; |
|
24 |
my $buildlog_warning_status = {}; |
|
25 |
||
26 |
$reset_status->{name} = 'reset_status'; |
|
27 |
$reset_status->{next_status} = {buildlog=>$buildlog_status}; |
|
28 |
||
29 |
$buildlog_status->{name} = 'buildlog_status'; |
|
30 |
$buildlog_status->{next_status} = {warning=>$buildlog_warning_status}; |
|
31 |
$buildlog_status->{on_start} = 'RaptorWarning::on_start_buildlog'; |
|
32 |
||
33 |
$buildlog_warning_status->{name} = 'buildlog_warning_status'; |
|
34 |
$buildlog_warning_status->{next_status} = {}; |
|
35 |
$buildlog_warning_status->{on_start} = 'RaptorWarning::on_start_buildlog_warning'; |
|
36 |
$buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning'; |
|
37 |
$buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning'; |
|
38 |
||
39 |
my $filename = ''; |
|
40 |
||
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
41 |
my $raptor_warning_info = {}; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
42 |
|
177 | 43 |
my $characters = ''; |
44 |
||
45 |
my $CATEGORY_RAPTORWARNING = 'raptor_warning'; |
|
46 |
my $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2 = 'missing_enable_abiv2_mode'; |
|
183
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
47 |
my $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND = 'while_searching_for_deffile_file_not_found'; |
229
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
48 |
my $CATEGORY_RAPTORWARNING_EXPORTUNFROZENPRESENT = 'exportunfrozen_present'; |
177 | 49 |
|
50 |
sub process |
|
51 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
52 |
my ($text, $logfile, $component, $mmp, $phase, $recipe, $file) = @_; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
53 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
54 |
my $dumped = 1; |
177 | 55 |
|
56 |
my $category = $CATEGORY_RAPTORWARNING; |
|
57 |
my $severity = ''; |
|
58 |
my $subcategory = ''; |
|
59 |
||
60 |
if ($text =~ m,missing flag ENABLE_ABIV2_MODE,) |
|
61 |
{ |
|
62 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
|
63 |
my $subcategory = $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2; |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
64 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 65 |
} |
183
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
66 |
elsif ($text =~ m,While Searching for a SPECIFIED DEFFILE: file not found: .*,) |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
67 |
{ |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
68 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
69 |
my $subcategory = $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND; |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
70 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
183
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
71 |
} |
229
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
72 |
elsif ($text =~ m,EXPORTUNFROZEN present in .*,) |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
73 |
{ |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
74 |
$severity = $RaptorCommon::SEVERITY_MAJOR; |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
75 |
my $subcategory = $CATEGORY_RAPTORWARNING_EXPORTUNFROZENPRESENT; |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
76 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
77 |
} |
177 | 78 |
else # log everything by default |
79 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
80 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 81 |
} |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
82 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
83 |
return $dumped; |
177 | 84 |
} |
85 |
||
86 |
sub on_start_buildlog |
|
87 |
{ |
|
88 |
RaptorCommon::init(); |
|
89 |
} |
|
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
90 |
|
177 | 91 |
sub on_start_buildlog_warning |
92 |
{ |
|
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
93 |
my ($el) = @_; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
94 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
95 |
$raptor_warning_info = {}; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
96 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
97 |
my $attributes = $el->{Attributes}; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
98 |
for (keys %{$attributes}) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
99 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
100 |
$raptor_warning_info->{$attributes->{$_}->{'LocalName'}} = $attributes->{$_}->{'Value'}; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
101 |
#print "$_ -> $attributes->{$_}->{'Value'}\n"; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
102 |
} |
177 | 103 |
} |
104 |
||
105 |
sub on_chars_buildlog_warning |
|
106 |
{ |
|
107 |
my ($ch) = @_; |
|
108 |
||
109 |
#print "on_chars_buildlog_warning\n"; |
|
110 |
||
111 |
$characters .= $ch->{Data}; |
|
112 |
||
113 |
#print "characters is now -->$characters<--\n"; |
|
114 |
} |
|
115 |
||
116 |
sub on_end_buildlog_warning |
|
117 |
{ |
|
118 |
#print "on_end_buildlog_warning\n"; |
|
119 |
||
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
120 |
$characters =~ s,^[\r\n]*,,; |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
121 |
$characters =~ s,[\r\n]*$,,; |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
122 |
|
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
123 |
my $package = ''; |
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
124 |
# if bldinf attribute is not available then heuristically attempt to determine the package |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
125 |
if (!$raptor_warning_info->{bldinf} && |
311
09f57a9bad07
Add 'adapt' to the list of layers to match for heuristical pacakge attribution and for truclean
Dario Sestito <darios@symbian.org>
parents:
293
diff
changeset
|
126 |
$characters =~ m,.*?([/\\]sf[/\\](os|mw|app|tools|ostools|adaptation|adapt)[/\\][a-zA-Z]+[/\\]?),s) |
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
127 |
{ |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
128 |
$raptor_warning_info->{bldinf} = "$1... (guessed)"; |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
129 |
} |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
130 |
|
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
131 |
if ($raptor_warning_info->{bldinf}) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
132 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
133 |
$::allbldinfs->{$raptor_warning_info->{bldinf}} = 1; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
134 |
|
293
a02973783e64
Extend UH parser to cope with tools build
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
135 |
RaptorCommon::normalize_bldinf_path(\$raptor_warning_info->{bldinf}); |
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
136 |
|
293
a02973783e64
Extend UH parser to cope with tools build
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
137 |
$package = RaptorCommon::get_package_subpath($raptor_warning_info->{bldinf}); |
a02973783e64
Extend UH parser to cope with tools build
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
138 |
$package =~ s,/,_,g; |
a02973783e64
Extend UH parser to cope with tools build
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
139 |
if (!$package) |
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
140 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
141 |
print "WARNING: can't understand bldinf attribute of raptor warning: $raptor_warning_info->{bldinf}. Won't associate to package.\n"; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
142 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
143 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
144 |
|
177 | 145 |
if ($characters =~ m,[^\s^\r^\n],) |
146 |
{ |
|
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
147 |
$filename = "$::raptorbitsdir/raptor_warning.txt"; |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
148 |
$filename = "$::raptorbitsdir/$package.txt" if ($package); |
233
cf1d34408de3
Add heuristic determination of package for Raptor unreciped text
Dario Sestito <darios@symbian.org>
parents:
232
diff
changeset
|
149 |
my $filenamewnopath = "raptor_warning.txt"; |
cf1d34408de3
Add heuristic determination of package for Raptor unreciped text
Dario Sestito <darios@symbian.org>
parents:
232
diff
changeset
|
150 |
$filenamewnopath = "$package.txt" if ($package); |
228
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
151 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
152 |
if (!-f$filename) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
153 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
154 |
print "Writing file $filename\n"; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
155 |
open(FILE, ">$filename"); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
156 |
close(FILE); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
157 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
158 |
|
233
cf1d34408de3
Add heuristic determination of package for Raptor unreciped text
Dario Sestito <darios@symbian.org>
parents:
232
diff
changeset
|
159 |
my $dumped = process($characters, $::current_log_file, $raptor_warning_info->{bldinf}, '', '', '', $filenamewnopath); |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
160 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
161 |
if ($dumped) |
177 | 162 |
{ |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
163 |
open(FILE, ">>$filename"); |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
164 |
print FILE "---failure_item_$::failure_item_number\---\n"; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
165 |
print FILE "$characters\n\n"; |
177 | 166 |
close(FILE); |
167 |
} |
|
168 |
} |
|
169 |
||
170 |
$characters = ''; |
|
171 |
} |
|
172 |
||
173 |
||
174 |
1; |