31 $buildlog_status->{on_end} = 'RaptorUnreciped::on_end_buildlog'; |
31 $buildlog_status->{on_end} = 'RaptorUnreciped::on_end_buildlog'; |
32 $buildlog_status->{on_chars} = 'RaptorUnreciped::on_chars_buildlog'; |
32 $buildlog_status->{on_chars} = 'RaptorUnreciped::on_chars_buildlog'; |
33 |
33 |
34 $buildlog_subtag_status->{name} = 'buildlog_subtag_status'; |
34 $buildlog_subtag_status->{name} = 'buildlog_subtag_status'; |
35 $buildlog_subtag_status->{next_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; |
36 |
41 |
37 my $characters = ''; |
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_NOTHINGTOBEDONEFOR = 'nothing_to_be_done_for'; |
|
49 my $CATEGORY_RAPTORUNRECIPED_IGNORINGOLDCOMMANDSFORTARGET = 'ignoring_old_commands_for_target'; |
|
50 my $CATEGORY_RAPTORUNRECIPED_OVERRIDINGCOMMANDSFORTARGET = 'overriding_commands_for_target'; |
|
51 |
|
52 sub process |
|
53 { |
|
54 my ($text, $component, $phase, $recipe, $file, $line) = @_; |
|
55 |
|
56 my $category = $CATEGORY_RAPTORUNRECIPED; |
|
57 my $severity = ''; |
|
58 my $subcategory = ''; |
|
59 |
|
60 if ($text =~ m,make\.exe: \*\*\* No rule to make target,) |
|
61 { |
|
62 $severity = $RaptorCommon::SEVERITY_MAJOR; |
|
63 my $subcategory = $CATEGORY_RAPTORUNRECIPED_NORULETOMAKETARGET; |
|
64 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
65 } |
|
66 elsif ($text =~ m,make\.exe: Target .* not remade because of errors,) |
|
67 { |
|
68 $severity = $RaptorCommon::SEVERITY_MINOR; |
|
69 my $subcategory = $CATEGORY_RAPTORUNRECIPED_TARGETNOTREMADEFORERRORS; |
|
70 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
71 } |
|
72 elsif ($text =~ m,: warning: ignoring old commands for target,) |
|
73 { |
|
74 $severity = $RaptorCommon::SEVERITY_MINOR; |
|
75 my $subcategory = $CATEGORY_RAPTORUNRECIPED_IGNORINGOLDCOMMANDSFORTARGET; |
|
76 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
77 } |
|
78 elsif ($text =~ m,: warning: overriding commands for target,) |
|
79 { |
|
80 $severity = $RaptorCommon::SEVERITY_MINOR; |
|
81 my $subcategory = $CATEGORY_RAPTORUNRECIPED_OVERRIDINGCOMMANDSFORTARGET; |
|
82 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
83 } |
|
84 elsif ($text =~ m,make\.exe: Nothing to be done for .*,) |
|
85 { |
|
86 $severity = $RaptorCommon::SEVERITY_MINOR; |
|
87 my $subcategory = $CATEGORY_RAPTORUNRECIPED_NOTHINGTOBEDONEFOR; |
|
88 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
89 } |
|
90 elsif ($text =~ m,^(true|false)$,) |
|
91 { |
|
92 # don't dump |
|
93 } |
|
94 else # log everything by default |
|
95 { |
|
96 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
97 } |
|
98 } |
38 |
99 |
39 sub on_start_buildlog |
100 sub on_start_buildlog |
40 { |
101 { |
41 my $filename = "$::basedir/unreciped.txt"; |
102 RaptorCommon::init(); |
42 print "Writing unreciped file $filename\n" if (!-f$filename); |
103 |
43 open(FILE, ">>$filename"); |
104 $filename = "$::basedir/raptor_unreciped.txt"; |
|
105 if (!-f$filename) |
|
106 { |
|
107 print "Writing unreciped file $filename\n"; |
|
108 open(FILE, ">$filename"); |
|
109 close(FILE); |
|
110 } |
44 } |
111 } |
45 |
112 |
46 sub on_chars_buildlog |
113 sub on_chars_buildlog |
47 { |
114 { |
48 my ($ch) = @_; |
115 my ($ch) = @_; |
49 |
116 |
50 my $characters = $ch->{Data}; |
117 #print "on_chars_buildlog\n"; |
51 |
118 |
52 print FILE $characters if ($characters =~ m,[^\s^\r^\n],); |
119 if ($store_chars) |
|
120 { |
|
121 $characters .= $ch->{Data}; |
|
122 |
|
123 #print "characters is now -->$characters<--\n"; |
|
124 } |
|
125 } |
|
126 |
|
127 sub on_end_buildlog_subtag |
|
128 { |
|
129 $store_chars = 1; |
|
130 } |
|
131 |
|
132 sub process_characters |
|
133 { |
|
134 #print "process_characters\n"; |
53 |
135 |
54 #print "characters is now -->$characters<--\n"; |
136 $characters =~ s,^[\r\n]*,,; |
|
137 $characters =~ s,[\r\n]*$,,; |
|
138 |
|
139 #print "characters is -->$characters<--\n"; |
|
140 |
|
141 my @lines = split(/[\r\n]/, $characters); |
|
142 for my $line (@lines) |
|
143 { |
|
144 if ($line =~ m,[^\s^\r^\n],) |
|
145 { |
|
146 #print "dumping chars\n"; |
|
147 |
|
148 if ($failure_item == 0 and -f "$filename") |
|
149 { |
|
150 open(FILE, "$filename"); |
|
151 { |
|
152 local $/ = undef; |
|
153 my $filecontent = <FILE>; |
|
154 $failure_item = $1 if ($filecontent =~ m/.*---failure_item_(\d+)/s); |
|
155 } |
|
156 close(FILE); |
|
157 } |
|
158 |
|
159 $failure_item++; |
|
160 |
|
161 open(FILE, ">>$filename"); |
|
162 print FILE "---failure_item_$failure_item\---\n"; |
|
163 print FILE "$line\n\n"; |
|
164 close(FILE); |
|
165 |
|
166 process($line, '', '', '', "raptor_unreciped.txt", $failure_item); |
|
167 } |
|
168 } |
|
169 |
|
170 $characters = ''; |
|
171 $store_chars = 0; |
|
172 } |
|
173 |
|
174 sub on_start_buildlog_subtag |
|
175 { |
|
176 #print "on_start_buildlog_subtag\n"; |
|
177 |
|
178 process_characters(); |
55 } |
179 } |
56 |
180 |
57 sub on_end_buildlog |
181 sub on_end_buildlog |
58 { |
182 { |
59 close(FILE); |
183 process_characters(); |
60 } |
184 } |
61 |
185 |
62 |
186 |
63 1; |
187 1; |