32 $buildlog_error_status->{next_status} = {}; |
32 $buildlog_error_status->{next_status} = {}; |
33 $buildlog_error_status->{on_start} = 'RaptorError::on_start_buildlog_error'; |
33 $buildlog_error_status->{on_start} = 'RaptorError::on_start_buildlog_error'; |
34 $buildlog_error_status->{on_end} = 'RaptorError::on_end_buildlog_error'; |
34 $buildlog_error_status->{on_end} = 'RaptorError::on_end_buildlog_error'; |
35 $buildlog_error_status->{on_chars} = 'RaptorError::on_chars_buildlog_error'; |
35 $buildlog_error_status->{on_chars} = 'RaptorError::on_chars_buildlog_error'; |
36 |
36 |
|
37 my $filename = ''; |
|
38 |
37 my $characters = ''; |
39 my $characters = ''; |
38 |
40 |
39 my $category = $RaptorCommon::CATEGORY_RAPTORERROR; |
41 my $category = $RaptorCommon::CATEGORY_RAPTORERROR; |
40 |
42 |
41 sub process |
43 sub process |
42 { |
44 { |
43 my ($text) = @_; |
45 my ($text, $component, $phase, $recipe, $file, $line) = @_; |
44 |
46 |
45 my $severity = $RaptorCommon::SEVERITY_UNKNOWN; |
47 my $severity = $RaptorCommon::SEVERITY_UNKNOWN; |
46 |
48 |
47 if ($text =~ m,Cannot process schema version .* of file,) |
49 if ($text =~ m,Cannot process schema version .* of file,) |
48 { |
50 { |
49 $severity = $RaptorCommon::SEVERITY_CRITICAL; |
51 $severity = $RaptorCommon::SEVERITY_CRITICAL; |
50 |
52 my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_CANNOTPROCESSSCHEMAVERSION; |
51 #dump_error($category, $severity, $text); |
53 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
52 print "$category, $severity, $text\n"; |
54 } |
|
55 elsif ($text =~ m,No bld\.inf found at,) |
|
56 { |
|
57 $severity = $RaptorCommon::SEVERITY_CRITICAL; |
|
58 my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_NOBLDINFFOUND; |
|
59 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
|
60 } |
|
61 else # log everything by default |
|
62 { |
|
63 $severity = $RaptorCommon::SEVERITY_UNKNOWN; |
|
64 my $subcategory = ''; |
|
65 RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line); |
53 } |
66 } |
54 } |
67 } |
55 |
68 |
56 sub on_start_buildlog_error |
69 sub on_start_buildlog_error |
57 { |
70 { |
58 my $filename = "$::basedir/errors.txt"; |
71 $filename = "$::basedir/errors.txt"; |
59 print "Writing error file $filename\n" if (!-f$filename); |
72 print "Writing error file $filename\n" if (!-f$filename); |
60 open(FILE, ">>$filename"); |
73 open(FILE, ">>$filename"); |
61 } |
74 } |
62 |
75 |
63 sub on_chars_buildlog_error |
76 sub on_chars_buildlog_error |
73 |
86 |
74 sub on_end_buildlog_error |
87 sub on_end_buildlog_error |
75 { |
88 { |
76 #print "on_end_buildlog_error\n"; |
89 #print "on_end_buildlog_error\n"; |
77 |
90 |
78 process($characters); |
|
79 |
|
80 print FILE $characters if ($characters =~ m,[^\s^\r^\n],); |
91 print FILE $characters if ($characters =~ m,[^\s^\r^\n],); |
81 print FILE "\n" if ($characters !~ m,[\r\n]$, ); |
92 print FILE "\n" if ($characters !~ m,[\r\n]$, ); |
|
93 close(FILE); |
|
94 |
|
95 # get the line number - not really optimized |
|
96 my $linecount = 0; |
|
97 open(FILE, "$filename"); |
|
98 for ($linecount = 0; <FILE>; $linecount++) { } |
|
99 close(FILE); |
|
100 |
|
101 process($characters, '', '', '', "errors.txt", $linecount); |
82 |
102 |
83 $characters = ''; |
103 $characters = ''; |
84 |
|
85 close(FILE); |
|
86 } |
104 } |
87 |
105 |
88 |
106 |
89 1; |
107 1; |