author | Dario Sestito <darios@symbian.org> |
Wed, 07 Apr 2010 17:31:01 +0100 | |
changeset 209 | ba90e30c0f3c |
parent 185 | b76adfbc6648 |
child 210 | 6669177dab54 |
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 |
# 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 |
||
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
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:
185
diff
changeset
|
41 |
|
176 | 42 |
my $characters = ''; |
43 |
||
44 |
my $CATEGORY_RAPTORWARNING = 'raptor_warning'; |
|
45 |
my $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2 = 'missing_enable_abiv2_mode'; |
|
182
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
46 |
my $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND = 'while_searching_for_deffile_file_not_found'; |
176 | 47 |
|
48 |
sub process |
|
49 |
{ |
|
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
50 |
my ($text, $logfile, $component, $mmp, $phase, $recipe, $file) = @_; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
51 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
52 |
my $dumped = 1; |
176 | 53 |
|
54 |
my $category = $CATEGORY_RAPTORWARNING; |
|
55 |
my $severity = ''; |
|
56 |
my $subcategory = ''; |
|
57 |
||
58 |
if ($text =~ m,missing flag ENABLE_ABIV2_MODE,) |
|
59 |
{ |
|
60 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
|
61 |
my $subcategory = $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2; |
|
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
62 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
176 | 63 |
} |
182
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
64 |
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:
176
diff
changeset
|
65 |
{ |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
66 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
67 |
my $subcategory = $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND; |
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
68 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
182
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
176
diff
changeset
|
69 |
} |
176 | 70 |
else # log everything by default |
71 |
{ |
|
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
72 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
176 | 73 |
} |
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
74 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
75 |
return $dumped; |
176 | 76 |
} |
77 |
||
78 |
sub on_start_buildlog |
|
79 |
{ |
|
80 |
RaptorCommon::init(); |
|
81 |
} |
|
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
82 |
|
176 | 83 |
sub on_start_buildlog_warning |
84 |
{ |
|
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
85 |
my ($el) = @_; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
86 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
87 |
$raptor_warning_info = {}; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
88 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
89 |
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:
185
diff
changeset
|
90 |
for (keys %{$attributes}) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
91 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
92 |
$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:
185
diff
changeset
|
93 |
#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:
185
diff
changeset
|
94 |
} |
176 | 95 |
} |
96 |
||
97 |
sub on_chars_buildlog_warning |
|
98 |
{ |
|
99 |
my ($ch) = @_; |
|
100 |
||
101 |
#print "on_chars_buildlog_warning\n"; |
|
102 |
||
103 |
$characters .= $ch->{Data}; |
|
104 |
||
105 |
#print "characters is now -->$characters<--\n"; |
|
106 |
} |
|
107 |
||
108 |
sub on_end_buildlog_warning |
|
109 |
{ |
|
110 |
#print "on_end_buildlog_warning\n"; |
|
111 |
||
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
112 |
my $package = ''; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
113 |
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:
185
diff
changeset
|
114 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
115 |
$::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:
185
diff
changeset
|
116 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
117 |
# normalize bldinf path |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
118 |
$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:
185
diff
changeset
|
119 |
$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:
185
diff
changeset
|
120 |
$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:
185
diff
changeset
|
121 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
122 |
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:
185
diff
changeset
|
123 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
124 |
$package = $1; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
125 |
$package =~ s,/,_,; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
126 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
127 |
else |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
128 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
129 |
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:
185
diff
changeset
|
130 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
131 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
132 |
|
176 | 133 |
$characters =~ s,^[\r\n]*,,; |
134 |
$characters =~ s,[\r\n]*$,,; |
|
135 |
||
136 |
if ($characters =~ m,[^\s^\r^\n],) |
|
137 |
{ |
|
209
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
138 |
my $bldinf_field = ''; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
139 |
if ($package) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
140 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
141 |
$filename = "$::raptorbitsdir/$package.txt"; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
142 |
$bldinf_field = $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:
185
diff
changeset
|
143 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
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:
185
diff
changeset
|
145 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
146 |
$filename = "$::raptorbitsdir/raptor_warning.txt"; |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
147 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
148 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
149 |
if (!-f$filename) |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
150 |
{ |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
151 |
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:
185
diff
changeset
|
152 |
open(FILE, ">$filename"); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
153 |
close(FILE); |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
154 |
} |
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
155 |
|
ba90e30c0f3c
Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
156 |
my $dumped = process($characters, $::current_log_file, $bldinf_field, '', '', '', "$package.txt"); |
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
157 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
158 |
if ($dumped) |
176 | 159 |
{ |
185
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
160 |
open(FILE, ">>$filename"); |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
161 |
print FILE "---failure_item_$::failure_item_number\---\n"; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
162 |
print FILE "$characters\n\n"; |
176 | 163 |
close(FILE); |
164 |
} |
|
165 |
} |
|
166 |
||
167 |
$characters = ''; |
|
168 |
} |
|
169 |
||
170 |
||
171 |
1; |