author | MattD <mattd@symbian.org> |
Mon, 22 Mar 2010 12:28:48 +0000 | |
changeset 212 | 21d5b62bbd8e |
parent 188 | dbf40764ca6a |
child 232 | 0244765a8d6f |
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 text in <buildlog> context which doesn't belong to any <recipe> tags |
|
15 |
||
16 |
package RaptorUnreciped; |
|
17 |
||
18 |
use strict; |
|
19 |
use RaptorCommon; |
|
20 |
||
21 |
our $reset_status = {}; |
|
22 |
my $buildlog_status = {}; |
|
23 |
my $buildlog_subtag_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} = {'?default?'=>$buildlog_subtag_status}; |
|
30 |
$buildlog_status->{on_start} = 'RaptorUnreciped::on_start_buildlog'; |
|
31 |
$buildlog_status->{on_end} = 'RaptorUnreciped::on_end_buildlog'; |
|
32 |
$buildlog_status->{on_chars} = 'RaptorUnreciped::on_chars_buildlog'; |
|
33 |
||
34 |
$buildlog_subtag_status->{name} = 'buildlog_subtag_status'; |
|
35 |
$buildlog_subtag_status->{next_status} = {}; |
|
36 |
$buildlog_subtag_status->{on_start} = 'RaptorUnreciped::on_start_buildlog_subtag'; |
|
37 |
$buildlog_subtag_status->{on_end} = 'RaptorUnreciped::on_end_buildlog_subtag'; |
|
38 |
||
39 |
my $filename = ''; |
|
40 |
||
41 |
my $characters = ''; |
|
42 |
my $store_chars = 1; |
|
43 |
||
44 |
my $CATEGORY_RAPTORUNRECIPED = 'raptor_unreciped'; |
|
45 |
my $CATEGORY_RAPTORUNRECIPED_NORULETOMAKETARGET = 'no_rule_to_make_target'; |
|
46 |
my $CATEGORY_RAPTORUNRECIPED_TARGETNOTREMADEFORERRORS = 'target_not_remade_for_errors'; |
|
47 |
my $CATEGORY_RAPTORUNRECIPED_IGNORINGOLDCOMMANDSFORTARGET = 'ignoring_old_commands_for_target'; |
|
48 |
my $CATEGORY_RAPTORUNRECIPED_OVERRIDINGCOMMANDSFORTARGET = 'overriding_commands_for_target'; |
|
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
49 |
my $CATEGORY_RAPTORUNRECIPED_MAKE_TARGETNOTREMADEBECAUSEOFERRORS = 'make_target_not_remade_because_of_errors'; |
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
50 |
my $CATEGORY_RAPTORUNRECIPED_MAKE_ERROR1 = 'make_error_1'; |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
51 |
my $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGETNEEDEDBY = 'make_no_rule_to_make_target_needed_by'; |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
52 |
my $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGET = 'make_no_rule_to_make_target'; |
177 | 53 |
|
54 |
sub process |
|
55 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
56 |
my ($text, $logfile, $component, $mmp, $phase, $recipe, $file) = @_; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
57 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
58 |
my $dumped = 1; |
177 | 59 |
|
60 |
my $category = $CATEGORY_RAPTORUNRECIPED; |
|
61 |
my $severity = ''; |
|
62 |
my $subcategory = ''; |
|
63 |
||
64 |
if ($text =~ m,make\.exe: \*\*\* No rule to make target,) |
|
65 |
{ |
|
66 |
$severity = $RaptorCommon::SEVERITY_MAJOR; |
|
67 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_NORULETOMAKETARGET; |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
68 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 69 |
} |
70 |
elsif ($text =~ m,make\.exe: Target .* not remade because of errors,) |
|
71 |
{ |
|
72 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
|
73 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_TARGETNOTREMADEFORERRORS; |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
74 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 75 |
} |
76 |
elsif ($text =~ m,: warning: ignoring old commands for target,) |
|
77 |
{ |
|
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
78 |
# don't dump |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
79 |
$dumped = 0; |
177 | 80 |
} |
81 |
elsif ($text =~ m,: warning: overriding commands for target,) |
|
82 |
{ |
|
83 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
|
84 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_OVERRIDINGCOMMANDSFORTARGET; |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
85 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 86 |
} |
188
dbf40764ca6a
Match both make: and make.exe: in some unreciped regexp
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
87 |
elsif ($text =~ m,^make(\.exe)?: Target .* not remade because of errors\.,) |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
88 |
{ |
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
89 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
90 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_TARGETNOTREMADEBECAUSEOFERRORS; |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
91 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
92 |
} |
188
dbf40764ca6a
Match both make: and make.exe: in some unreciped regexp
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
93 |
elsif ($text =~ m,^make(\.exe)?: \*\*\* .* Error 1,) |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
94 |
{ |
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
95 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
96 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_ERROR1; |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
97 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
98 |
} |
188
dbf40764ca6a
Match both make: and make.exe: in some unreciped regexp
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
99 |
elsif ($text =~ m,^make(\.exe)?: \*\*\* No rule to make target .*\ needed by .*,) |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
100 |
{ |
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
101 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
102 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGETNEEDEDBY; |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
103 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
104 |
} |
188
dbf40764ca6a
Match both make: and make.exe: in some unreciped regexp
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
105 |
elsif ($text =~ m,^make(\.exe)?: \*\*\* No rule to make target .*,) |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
106 |
{ |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
107 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
108 |
my $subcategory = $CATEGORY_RAPTORUNRECIPED_MAKE_NORULETOMAKETARGET; |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
109 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
182
d7b846505d9e
Add more categories for unreciped failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
110 |
} |
188
dbf40764ca6a
Match both make: and make.exe: in some unreciped regexp
Dario Sestito <darios@symbian.org>
parents:
186
diff
changeset
|
111 |
elsif ($text =~ m,^make(\.exe)?: Nothing to be done for .*,) |
177 | 112 |
{ |
113 |
# don't dump |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
114 |
$dumped = 0; |
177 | 115 |
} |
116 |
elsif ($text =~ m,^(true|false)$,) |
|
117 |
{ |
|
118 |
# don't dump |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
119 |
$dumped = 0; |
177 | 120 |
} |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
121 |
elsif ($text =~ m,win32/cygwin/bin/cp\.exe,) |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
122 |
{ |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
123 |
# don't dump |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
124 |
$dumped = 0; |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
125 |
} |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
126 |
elsif ($text =~ m,epoc32/tools/svgtbinencode\.exe,) |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
127 |
{ |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
128 |
# don't dump |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
129 |
$dumped = 0; |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
130 |
} |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
131 |
elsif ($text =~ m,win32/cygwin/bin/chmod\.exe a\+rw,) |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
132 |
{ |
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
133 |
# don't dump |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
134 |
$dumped = 0; |
185
978ef35b4e5f
Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents:
182
diff
changeset
|
135 |
} |
177 | 136 |
else # log everything by default |
137 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
138 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file); |
177 | 139 |
} |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
140 |
|
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
141 |
return $dumped; |
177 | 142 |
} |
143 |
||
144 |
sub on_start_buildlog |
|
145 |
{ |
|
146 |
RaptorCommon::init(); |
|
147 |
||
148 |
$filename = "$::raptorbitsdir/raptor_unreciped.txt"; |
|
149 |
if (!-f$filename) |
|
150 |
{ |
|
151 |
print "Writing unreciped file $filename\n"; |
|
152 |
open(FILE, ">$filename"); |
|
153 |
close(FILE); |
|
154 |
} |
|
155 |
} |
|
156 |
||
157 |
sub on_chars_buildlog |
|
158 |
{ |
|
159 |
my ($ch) = @_; |
|
160 |
||
161 |
#print "on_chars_buildlog\n"; |
|
162 |
||
163 |
if ($store_chars) |
|
164 |
{ |
|
165 |
$characters .= $ch->{Data}; |
|
166 |
||
167 |
#print "characters is now -->$characters<--\n"; |
|
168 |
} |
|
169 |
} |
|
170 |
||
171 |
sub on_end_buildlog_subtag |
|
172 |
{ |
|
173 |
$store_chars = 1; |
|
174 |
} |
|
175 |
||
176 |
sub process_characters |
|
177 |
{ |
|
178 |
#print "process_characters\n"; |
|
179 |
||
180 |
$characters =~ s,^[\r\n]*,,; |
|
181 |
$characters =~ s,[\r\n]*$,,; |
|
182 |
||
183 |
#print "characters is -->$characters<--\n"; |
|
184 |
||
185 |
my @lines = split(/[\r\n]/, $characters); |
|
186 |
for my $line (@lines) |
|
187 |
{ |
|
188 |
if ($line =~ m,[^\s^\r^\n],) |
|
189 |
{ |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
190 |
my $dumped = process($line, $::current_log_file, '', '', '', '', "raptor_unreciped.txt"); |
177 | 191 |
|
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
192 |
if ($dumped) |
177 | 193 |
{ |
186
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
194 |
open(FILE, ">>$filename"); |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
195 |
print FILE "---failure_item_$::failure_item_number\---\n"; |
b76adfbc6648
Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents:
185
diff
changeset
|
196 |
print FILE "$line\n\n"; |
177 | 197 |
close(FILE); |
198 |
} |
|
199 |
} |
|
200 |
} |
|
201 |
||
202 |
$characters = ''; |
|
203 |
$store_chars = 0; |
|
204 |
} |
|
205 |
||
206 |
sub on_start_buildlog_subtag |
|
207 |
{ |
|
208 |
#print "on_start_buildlog_subtag\n"; |
|
209 |
||
210 |
process_characters(); |
|
211 |
} |
|
212 |
||
213 |
sub on_end_buildlog |
|
214 |
{ |
|
215 |
process_characters(); |
|
216 |
} |
|
217 |
||
218 |
||
219 |
1; |