author | Dario Sestito <darios@symbian.org> |
Mon, 12 Apr 2010 13:26:38 +0100 | |
changeset 235 | 907120563fce |
parent 233 | cf1d34408de3 |
child 236 | 8a3d46cfe8b5 |
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: |
|
11 |
# |
|
12 |
# Description: |
|
13 |
# Raptor parser module. |
|
14 |
# Extract, analyzes and dumps raptor warnings i.e. content of <warning> tags from a raptor log file |
|
15 |
||
16 |
package RaptorWarning; |
|
17 |
||
18 |
use strict; |
|
19 |
use RaptorCommon; |
|
20 |
||
21 |
our $reset_status = {}; |
|
22 |
my $buildlog_status = {}; |
|
23 |
my $buildlog_warning_status = {}; |
|
24 |
||
25 |
$reset_status->{name} = 'reset_status'; |
|
26 |
$reset_status->{next_status} = {buildlog=>$buildlog_status}; |
|
27 |
||
28 |
$buildlog_status->{name} = 'buildlog_status'; |
|
29 |
$buildlog_status->{next_status} = {warning=>$buildlog_warning_status}; |
|
30 |
$buildlog_status->{on_start} = 'RaptorWarning::on_start_buildlog'; |
|
31 |
||
32 |
$buildlog_warning_status->{name} = 'buildlog_warning_status'; |
|
33 |
$buildlog_warning_status->{next_status} = {}; |
|
34 |
$buildlog_warning_status->{on_start} = 'RaptorWarning::on_start_buildlog_warning'; |
|
35 |
$buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning'; |
|
36 |
$buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning'; |
|
37 |
||
38 |
my $filename = ''; |
|
39 |
||
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
|
40 |
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
|
41 |
|
177 | 42 |
my $characters = ''; |
43 |
||
44 |
my $CATEGORY_RAPTORWARNING = 'raptor_warning'; |
|
45 |
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
|
46 |
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
|
47 |
my $CATEGORY_RAPTORWARNING_EXPORTUNFROZENPRESENT = 'exportunfrozen_present'; |
177 | 48 |
|
49 |
sub process |
|
50 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
51 |
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
|
52 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
53 |
my $dumped = 1; |
177 | 54 |
|
55 |
my $category = $CATEGORY_RAPTORWARNING; |
|
56 |
my $severity = ''; |
|
57 |
my $subcategory = ''; |
|
58 |
||
59 |
if ($text =~ m,missing flag ENABLE_ABIV2_MODE,) |
|
60 |
{ |
|
61 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
|
62 |
my $subcategory = $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2; |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
63 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 64 |
} |
183
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
65 |
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
|
66 |
{ |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
67 |
$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
|
68 |
my $subcategory = $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND; |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
69 |
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
|
70 |
} |
229
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
71 |
elsif ($text =~ m,EXPORTUNFROZEN present in .*,) |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
72 |
{ |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
73 |
$severity = $RaptorCommon::SEVERITY_MAJOR; |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
74 |
my $subcategory = $CATEGORY_RAPTORWARNING_EXPORTUNFROZENPRESENT; |
6669177dab54
Add new exportunfrozen_present category for Raptor warnings
Dario Sestito <darios@symbian.org>
parents:
228
diff
changeset
|
75 |
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
|
76 |
} |
177 | 77 |
else # log everything by default |
78 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
79 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 80 |
} |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
81 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
82 |
return $dumped; |
177 | 83 |
} |
84 |
||
85 |
sub on_start_buildlog |
|
86 |
{ |
|
87 |
RaptorCommon::init(); |
|
88 |
} |
|
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
|
89 |
|
177 | 90 |
sub on_start_buildlog_warning |
91 |
{ |
|
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
|
92 |
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
|
93 |
|
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 |
$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
|
95 |
|
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 |
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
|
97 |
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
|
98 |
{ |
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 |
$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
|
100 |
#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
|
101 |
} |
177 | 102 |
} |
103 |
||
104 |
sub on_chars_buildlog_warning |
|
105 |
{ |
|
106 |
my ($ch) = @_; |
|
107 |
||
108 |
#print "on_chars_buildlog_warning\n"; |
|
109 |
||
110 |
$characters .= $ch->{Data}; |
|
111 |
||
112 |
#print "characters is now -->$characters<--\n"; |
|
113 |
} |
|
114 |
||
115 |
sub on_end_buildlog_warning |
|
116 |
{ |
|
117 |
#print "on_end_buildlog_warning\n"; |
|
118 |
||
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
119 |
$characters =~ s,^[\r\n]*,,; |
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 |
|
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
|
122 |
my $package = ''; |
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
123 |
# 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
|
124 |
if (!$raptor_warning_info->{bldinf} && |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
125 |
$characters =~ m,.*?(([/\\]sf)?[/\\](os|mw|app|tools|ostools|adaptation)[/\\][^/^\\]*[/\\]),s) |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
126 |
{ |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
127 |
$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
|
128 |
} |
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
129 |
|
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
|
130 |
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
|
131 |
{ |
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 |
$::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
|
133 |
|
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 |
# normalize bldinf path |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
135 |
$raptor_warning_info->{bldinf} = lc($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
|
136 |
$raptor_warning_info->{bldinf} =~ s,^[A-Za-z]:,,; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
137 |
$raptor_warning_info->{bldinf} =~ s,[\\],/,g; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
138 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
139 |
if ($raptor_warning_info->{bldinf} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),) |
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 |
$package = $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
|
142 |
$package =~ s,/,_,; |
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 |
else |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
145 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
146 |
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
|
147 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
148 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
149 |
|
177 | 150 |
if ($characters =~ m,[^\s^\r^\n],) |
151 |
{ |
|
232
0244765a8d6f
Add heuristic determination of package for Raptor errors and warnings
Dario Sestito <darios@symbian.org>
parents:
229
diff
changeset
|
152 |
$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
|
153 |
$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
|
154 |
my $filenamewnopath = "raptor_warning.txt"; |
cf1d34408de3
Add heuristic determination of package for Raptor unreciped text
Dario Sestito <darios@symbian.org>
parents:
232
diff
changeset
|
155 |
$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
|
156 |
|
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 |
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
|
158 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
159 |
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
|
160 |
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
|
161 |
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
|
162 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
163 |
|
233
cf1d34408de3
Add heuristic determination of package for Raptor unreciped text
Dario Sestito <darios@symbian.org>
parents:
232
diff
changeset
|
164 |
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
|
165 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
166 |
if ($dumped) |
177 | 167 |
{ |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
168 |
open(FILE, ">>$filename"); |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
183
diff
changeset
|
169 |
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
|
170 |
print FILE "$characters\n\n"; |
177 | 171 |
close(FILE); |
172 |
} |
|
173 |
} |
|
174 |
||
175 |
$characters = ''; |
|
176 |
} |
|
177 |
||
178 |
||
179 |
1; |