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