author | Dario Sestito <darios@symbian.org> |
Thu, 04 Mar 2010 17:14:46 +0000 | |
changeset 184 | 38468523076d |
parent 183 | 20288e22722e |
child 186 | b76adfbc6648 |
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 |
my $failure_item = 0; |
|
40 |
||
41 |
my $characters = ''; |
|
42 |
||
43 |
my $CATEGORY_RAPTORWARNING = 'raptor_warning'; |
|
44 |
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
|
45 |
my $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND = 'while_searching_for_deffile_file_not_found'; |
177 | 46 |
|
47 |
sub process |
|
48 |
{ |
|
49 |
my ($text, $logfile, $component, $mmp, $phase, $recipe, $file, $line) = @_; |
|
50 |
||
51 |
my $category = $CATEGORY_RAPTORWARNING; |
|
52 |
my $severity = ''; |
|
53 |
my $subcategory = ''; |
|
54 |
||
55 |
if ($text =~ m,missing flag ENABLE_ABIV2_MODE,) |
|
56 |
{ |
|
57 |
$severity = $RaptorCommon::SEVERITY_MINOR; |
|
58 |
my $subcategory = $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2; |
|
59 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file, $line); |
|
60 |
} |
|
183
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
61 |
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
|
62 |
{ |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
63 |
$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
|
64 |
my $subcategory = $CATEGORY_RAPTORWARNING_WHILESEARCHINGFORDEFFILEFILENOTFOUND; |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
65 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file, $line); |
20288e22722e
Add while_searching_for_deffile_file_not_found category for warning failures
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
66 |
} |
177 | 67 |
else # log everything by default |
68 |
{ |
|
69 |
RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file, $line); |
|
70 |
} |
|
71 |
} |
|
72 |
||
73 |
sub on_start_buildlog |
|
74 |
{ |
|
75 |
RaptorCommon::init(); |
|
76 |
||
77 |
$filename = "$::raptorbitsdir/raptor_warning.txt"; |
|
78 |
if (!-f$filename) |
|
79 |
{ |
|
80 |
print "Writing warnings file $filename\n"; |
|
81 |
open(FILE, ">$filename"); |
|
82 |
close(FILE); |
|
83 |
} |
|
84 |
} |
|
85 |
sub on_start_buildlog_warning |
|
86 |
{ |
|
87 |
open(FILE, ">>$filename"); |
|
88 |
} |
|
89 |
||
90 |
sub on_chars_buildlog_warning |
|
91 |
{ |
|
92 |
my ($ch) = @_; |
|
93 |
||
94 |
#print "on_chars_buildlog_warning\n"; |
|
95 |
||
96 |
$characters .= $ch->{Data}; |
|
97 |
||
98 |
#print "characters is now -->$characters<--\n"; |
|
99 |
} |
|
100 |
||
101 |
sub on_end_buildlog_warning |
|
102 |
{ |
|
103 |
#print "on_end_buildlog_warning\n"; |
|
104 |
||
105 |
$characters =~ s,^[\r\n]*,,; |
|
106 |
$characters =~ s,[\r\n]*$,,; |
|
107 |
||
108 |
if ($characters =~ m,[^\s^\r^\n],) |
|
109 |
{ |
|
110 |
if ($failure_item == 0 and -f "$filename") |
|
111 |
{ |
|
112 |
open(FILE, "$filename"); |
|
113 |
{ |
|
114 |
local $/ = undef; |
|
115 |
my $filecontent = <FILE>; |
|
116 |
$failure_item = $1 if ($filecontent =~ m/.*---failure_item_(\d+)/s); |
|
117 |
} |
|
118 |
close(FILE); |
|
119 |
} |
|
120 |
||
121 |
$failure_item++; |
|
122 |
||
123 |
open(FILE, ">>$filename"); |
|
124 |
print FILE "---failure_item_$failure_item\---\n"; |
|
125 |
print FILE "$characters\n\n"; |
|
126 |
close(FILE); |
|
127 |
||
128 |
process($characters, $::current_log_file, '', '', '', '', "raptor_warning.txt", $failure_item); |
|
129 |
} |
|
130 |
||
131 |
$characters = ''; |
|
132 |
} |
|
133 |
||
134 |
||
135 |
1; |