uh_parser/RaptorError.pm
author Dario Sestito <darios@symbian.org>
Fri, 09 Apr 2010 11:50:20 +0100
changeset 230 c01247054e72
parent 228 ba90e30c0f3c
child 231 914d8060176c
permissions -rw-r--r--
Add new failed_to_parse_xml_file category for Raptor errors
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
#
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
# Description:
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Raptor parser module.
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
# Extract, analyzes and dumps raptor errors i.e. content of <error> tags from a raptor log file
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
package RaptorError;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
use strict;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
use RaptorCommon;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
our $reset_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
my $buildlog_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
my $buildlog_error_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
$reset_status->{name} = 'reset_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
$reset_status->{next_status} = {buildlog=>$buildlog_status};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
$buildlog_status->{name} = 'buildlog_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
$buildlog_status->{next_status} = {error=>$buildlog_error_status};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
$buildlog_status->{on_start} = 'RaptorError::on_start_buildlog';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
$buildlog_error_status->{name} = 'buildlog_error_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
$buildlog_error_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
$buildlog_error_status->{on_start} = 'RaptorError::on_start_buildlog_error';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
$buildlog_error_status->{on_end} = 'RaptorError::on_end_buildlog_error';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
$buildlog_error_status->{on_chars} = 'RaptorError::on_chars_buildlog_error';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
my $filename = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
228
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
    40
my $raptor_error_info = {};
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
    41
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
my $characters = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
my $CATEGORY_RAPTORERROR = 'raptor_error';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
my $CATEGORY_RAPTORERROR_CANNOTPROCESSSCHEMAVERSION = 'cannot_process_schema_version';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
my $CATEGORY_RAPTORERROR_NOBLDINFFOUND = 'no_bld_inf_found';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
my $CATEGORY_RAPTORERROR_CANTFINDMMPFILE = 'cant_find_mmp_file';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
my $CATEGORY_RAPTORERROR_MAKEEXITEDWITHERRORS = 'make_exited_with_errors';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
my $CATEGORY_RAPTORERROR_TOOLDIDNOTRETURNVERSION = 'tool_didnot_return_version';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
my $CATEGORY_RAPTORERROR_UNKNOWNBUILDCONFIG = 'unknown_build_config';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
my $CATEGORY_RAPTORERROR_NOBUILDCONFIGSGIVEN = 'no_build_configs_given';
185
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
    52
my $CATEGORY_RAPTORERROR_COULDNOTEXPORT = 'missing_source_file';
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
    53
my $CATEGORY_RAPTORERROR_MISSINGBLDINFFILE = 'missing_bld_inf_file';
230
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
    54
my $CATEGORY_RAPTORERROR_FAILEDTOPARSEXMLFILE = 'failed_to_parse_xml_file';
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
sub process
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
{
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    58
	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
    59
	
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    60
	my $dumped = 1;
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
	my $category = $CATEGORY_RAPTORERROR;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
	my $severity = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
	my $subcategory = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
	if ($text =~ m,Cannot process schema version .* of file,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
		$severity = $RaptorCommon::SEVERITY_CRITICAL;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
		$subcategory = $CATEGORY_RAPTORERROR_CANNOTPROCESSSCHEMAVERSION;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    70
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
	elsif ($text =~ m,No bld\.inf found at,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
		$severity = $RaptorCommon::SEVERITY_MAJOR;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
		$subcategory = $CATEGORY_RAPTORERROR_NOBLDINFFOUND;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    76
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
	elsif ($text =~ m,Can't find mmp file,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
	{
181
314156ec7d7c Can't find mmp file should be severity Major
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
    80
		$severity = $RaptorCommon::SEVERITY_MAJOR;
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
		$subcategory = $CATEGORY_RAPTORERROR_CANTFINDMMPFILE;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    82
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
	elsif ($text =~ m,The make-engine exited with errors,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
		$severity = $RaptorCommon::SEVERITY_CRITICAL;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
		$subcategory = $CATEGORY_RAPTORERROR_MAKEEXITEDWITHERRORS;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    88
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
	elsif ($text =~ m,tool .* from config .* did not return version .* as required,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
		$severity = $RaptorCommon::SEVERITY_CRITICAL;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
		$subcategory = $CATEGORY_RAPTORERROR_TOOLDIDNOTRETURNVERSION;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
    94
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
	elsif ($text =~ m,Unknown build configuration '.*',)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
		$severity = $RaptorCommon::SEVERITY_CRITICAL;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
		$subcategory = $CATEGORY_RAPTORERROR_UNKNOWNBUILDCONFIG;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   100
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
	elsif ($text =~ m,No build configurations given,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
		$severity = $RaptorCommon::SEVERITY_CRITICAL;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
		$subcategory = $CATEGORY_RAPTORERROR_NOBUILDCONFIGSGIVEN;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   106
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
	}
230
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
   108
	elsif ($text =~ m,Failed to parse XML file,)
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
   109
	{
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
   110
		$severity = $RaptorCommon::SEVERITY_CRITICAL;
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
   111
		$subcategory = $CATEGORY_RAPTORERROR_FAILEDTOPARSEXMLFILE;
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
   112
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file);
c01247054e72 Add new failed_to_parse_xml_file category for Raptor errors
Dario Sestito <darios@symbian.org>
parents: 228
diff changeset
   113
	}
185
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   114
	elsif ($text =~ m,Could not export .* to .* : \[Errno 2\] No such file or directory: .*,)
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   115
	{
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   116
		$severity = $RaptorCommon::SEVERITY_MAJOR;
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   117
		$subcategory = $CATEGORY_RAPTORERROR_COULDNOTEXPORT;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   118
		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: 181
diff changeset
   119
	}
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   120
	elsif ($text =~ m,win32/mingw/bin/cpp\.exe: .*bld\.inf:.*bld\.inf: No such file or directory,)
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   121
	{
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   122
		$severity = $RaptorCommon::SEVERITY_MAJOR;
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   123
		$subcategory = $CATEGORY_RAPTORERROR_MISSINGBLDINFFILE;
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   124
		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: 181
diff changeset
   125
	}
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   126
	elsif ($text =~ m,^Preprocessor exception: ''Errors in .*bld\.inf'' : in command,)
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   127
	{
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
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: 181
diff changeset
   130
	}
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   131
	elsif ($text =~ m,Source of export does not exist: .*,)
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
diff changeset
   132
	{
978ef35b4e5f Add more categories for unreciped and raptor error failures
Dario Sestito <darios@symbian.org>
parents: 181
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: 181
diff changeset
   135
	}
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
	else # log everything by default
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   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
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   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
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
sub on_start_buildlog
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
	RaptorCommon::init();
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
sub on_start_buildlog_error
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
{
228
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   151
  my ($el) = @_;
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   152
	
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   153
	#print "on_start_buildlog_error\n";
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   154
	
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   155
	$raptor_error_info = {};
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   156
	
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   157
	my $attributes = $el->{Attributes};
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   158
	for (keys %{$attributes})
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   159
	{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   160
		$raptor_error_info->{$attributes->{$_}->{'LocalName'}} = $attributes->{$_}->{'Value'};
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   161
		#print "$_ -> $attributes->{$_}->{'Value'}\n";
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   162
	}
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
sub on_chars_buildlog_error
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
	my ($ch) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
	#print "on_chars_buildlog_error\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
	$characters .= $ch->{Data};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
	#print "characters is now -->$characters<--\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
sub on_end_buildlog_error
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
	#print "on_end_buildlog_error\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
	
228
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   180
	my $package = '';
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   181
	if ($raptor_error_info->{bldinf})
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   182
	{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   183
    $::allbldinfs->{$raptor_error_info->{bldinf}} = 1;
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   184
    
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   185
    # normalize bldinf path
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   186
		$raptor_error_info->{bldinf} = lc($raptor_error_info->{bldinf});
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   187
		$raptor_error_info->{bldinf} =~ s,^[A-Za-z]:,,;
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   188
		$raptor_error_info->{bldinf} =~ s,[\\],/,g;
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   189
		
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   190
		if ($raptor_error_info->{bldinf} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   191
		{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   192
			$package = $1;
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   193
			$package =~ s,/,_,;
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   194
		}
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   195
		else
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   196
		{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   197
			print "WARNING: can't understand bldinf attribute of raptor error: $raptor_error_info->{bldinf}. Won't associate to package.\n";
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   198
		}
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   199
  }
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   200
	
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
	$characters =~ s,^[\r\n]*,,;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
	$characters =~ s,[\r\n]*$,,;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
	if ($characters =~ m,[^\s^\r^\n],)
228
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   205
	{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   206
    my $bldinf_field = '';
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   207
    if ($package)
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   208
		{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   209
			$filename = "$::raptorbitsdir/$package.txt";
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   210
			$bldinf_field = $raptor_error_info->{bldinf};
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   211
		}
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   212
		else
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   213
		{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   214
		  $filename = "$::raptorbitsdir/raptor_error.txt";
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   215
		}
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   216
		
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   217
		if (!-f$filename)
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   218
		{
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   219
			print "Writing file $filename\n";
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   220
			open(FILE, ">$filename");
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   221
			close(FILE);
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   222
		}
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   223
		
ba90e30c0f3c Use the bldinf attribute to assign Raptor errors and warnings to the related package
Dario Sestito <darios@symbian.org>
parents: 186
diff changeset
   224
		my $dumped = process($characters, $::current_log_file, $bldinf_field, '', '', '', "$package.txt");
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   225
		
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   226
		if ($dumped)
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
		{
186
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   228
			open(FILE, ">>$filename");
b76adfbc6648 Don't dump failures which aren't reported
Dario Sestito <darios@symbian.org>
parents: 185
diff changeset
   229
			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
   230
			print FILE "$characters\n\n";
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
			close(FILE);
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
		}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
	$characters = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
1;