common/tools/raptor/RaptorWarning.pm
author Shabe Razvi <shaber@symbian.org>
Wed, 06 Jan 2010 22:30:41 +0000
changeset 838 a1ebf7f8e66f
parent 764 d00048f1b036
permissions -rw-r--r--
Move gcc into tools_epoc.zip so that syborg/beagle rom building works during build from source only.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
#
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
# Description:
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Raptor parser module.
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
# Extract, analyzes and dumps raptor warnings i.e. content of <warning> tags from a raptor log file
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
package RaptorWarning;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
use strict;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
use RaptorCommon;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
our $reset_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
my $buildlog_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
my $buildlog_warning_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
$reset_status->{name} = 'reset_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
$reset_status->{next_status} = {buildlog=>$buildlog_status};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
$buildlog_status->{name} = 'buildlog_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
$buildlog_status->{next_status} = {warning=>$buildlog_warning_status};
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    30
$buildlog_status->{on_start} = 'RaptorWarning::on_start_buildlog';
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
$buildlog_warning_status->{name} = 'buildlog_warning_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
$buildlog_warning_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
$buildlog_warning_status->{on_start} = 'RaptorWarning::on_start_buildlog_warning';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
$buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
$buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    38
my $filename = '';
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    39
my $failure_item = 0;
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    40
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
my $characters = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    43
my $CATEGORY_RAPTORWARNING = 'raptor_warning';
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    44
my $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2 = 'missing_enable_abiv2_mode';
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
sub process
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
{
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents: 383
diff changeset
    48
	my ($text, $logfile, $component, $mmp, $phase, $recipe, $file, $line) = @_;
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
	
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    50
	my $category = $CATEGORY_RAPTORWARNING;
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    51
	my $severity = '';
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    52
	my $subcategory = '';
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
	
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    54
	if ($text =~ m,missing flag ENABLE_ABIV2_MODE,)
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
	{
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    56
		$severity = $RaptorCommon::SEVERITY_MINOR;
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    57
		my $subcategory = $CATEGORY_RAPTORWARNING_MISSINGFLAGABIV2;
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents: 383
diff changeset
    58
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file, $line);
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    59
	}
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    60
	else # log everything by default
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    61
	{
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents: 383
diff changeset
    62
		RaptorCommon::dump_fault($category, $subcategory, $severity, $logfile, $component, $mmp, $phase, $recipe, $file, $line);
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    66
sub on_start_buildlog
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    67
{
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    68
	RaptorCommon::init();
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    69
	
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents: 383
diff changeset
    70
	$filename = "$::raptorbitsdir/raptor_warning.txt";
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    71
	if (!-f$filename)
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    72
	{
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    73
		print "Writing warnings file $filename\n";
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    74
		open(FILE, ">$filename");
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    75
		close(FILE);
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    76
	}
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    77
}
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
sub on_start_buildlog_warning
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
	open(FILE, ">>$filename");
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
sub on_chars_buildlog_warning
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
	my ($ch) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
	#print "on_chars_buildlog_warning\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
	$characters .= $ch->{Data};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
	#print "characters is now -->$characters<--\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
sub on_end_buildlog_warning
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
	#print "on_end_buildlog_warning\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
	
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    98
	$characters =~ s,^[\r\n]*,,;
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
    99
	$characters =~ s,[\r\n]*$,,;
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
   100
	
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   101
	if ($characters =~ m,[^\s^\r^\n],)
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   102
	{
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   103
		if ($failure_item == 0 and -f "$filename")
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   104
		{
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   105
			open(FILE, "$filename");
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   106
			{
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   107
				local $/ = undef;
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   108
				my $filecontent = <FILE>;
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   109
				$failure_item = $1 if ($filecontent =~ m/.*---failure_item_(\d+)/s);
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   110
			}
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   111
			close(FILE);
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   112
		}
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   113
		
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   114
		$failure_item++;
364
4dc3b5b1577c Enable analysis of Raptor warnings. Publish to Diamonds
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
   115
	
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   116
		open(FILE, ">>$filename");
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   117
		print FILE "---failure_item_$failure_item\---\n";
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   118
		print FILE "$characters\n\n";
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   119
		close(FILE);
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   120
		
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents: 383
diff changeset
   121
		process($characters, $::current_log_file, '', '', '', '', "raptor_warning.txt", $failure_item);
383
52675b624b66 Add raptor build html summary computation
Dario Sestito <darios@symbian.org>
parents: 364
diff changeset
   122
	}
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
	$characters = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
1;