common/tools/raptor/uh.pl
author Dario Sestito <darios@symbian.org>
Fri, 13 Nov 2009 17:47:50 +0000
changeset 764 d00048f1b036
child 791 9054e820b1e6
permissions -rw-r--r--
Improved Raptor parser, now "uh"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
#
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
# Description:
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Unite and HTML-ize Raptor log files
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
use strict;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
use FindBin;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
use lib $FindBin::Bin;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
use RaptorError;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
use RaptorWarning;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
use RaptorInfo;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
use RaptorUnreciped;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
use RaptorRecipe;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
use XML::SAX;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
use RaptorSAXHandler;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
use Getopt::Long;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
our $raptorbitsdir = 'raptorbits';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
our $basedir = '';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
my $outputdir = "html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
our $raptor_config = 'dummy_config';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
our $current_log_file = '';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
my $help = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
GetOptions((
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
	'basedir=s' => \$basedir,
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
	'help!' => \$help
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
));
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
my @logfiles = @ARGV;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
$help = 1 if (!@logfiles);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
if ($help)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
	print "Unite and HTML-ize Raptor log files.\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
	print "Usage: perl uh.pl [OPTIONS] FILE1 FILE2 ...\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
	print "where OPTIONS are:\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
	print "\t--basedir=DIR Generate output under DIR (defaults to current dir)\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
	exit(0);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
if ($basedir)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
	$raptorbitsdir = "$basedir/raptorbits";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
	$outputdir = "$basedir/html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
mkdir($basedir) if (!-d$basedir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
system("rmdir /S /Q $raptorbitsdir") if (-d $raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
mkdir($raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
#print "Created dir $raptorbitsdir.\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
# create empty summary file anyway
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
open(SUMMARY, ">$raptorbitsdir/summary.csv");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
close(SUMMARY);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
my $saxhandler = RaptorSAXHandler->new();
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
$saxhandler->add_observer('RaptorError', $RaptorError::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
$saxhandler->add_observer('RaptorWarning', $RaptorWarning::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
$saxhandler->add_observer('RaptorInfo', $RaptorInfo::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
$saxhandler->add_observer('RaptorUnreciped', $RaptorUnreciped::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
$saxhandler->add_observer('RaptorRecipe', $RaptorRecipe::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
for (@logfiles)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
	print "Reading file: $_\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
	$current_log_file = $_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
	$parser->parse_uri($_);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
print "Generating HTML...\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
system("rd /S /Q $outputdir") if (-d $outputdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
mkdir ($outputdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
my $raptor_errors = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
my $raptor_warnings = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
my $raptor_unreciped = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
my $general_failures_num_by_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
my $general_failures_by_category_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
my $recipe_failures_num_by_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
my $recipe_failures_by_package_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
#my $severities = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
my @severities = ('critical', 'major', 'minor', 'unknown');
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
# READ SUMMARY.CSV FILE
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
my $csv_file = "$raptorbitsdir/summary.csv";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
my $csv_linenum = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
open(CSV, $csv_file);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
while(<CSV>)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
	$csv_linenum ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
	my $line = $_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
	if ($line =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
		my $failure = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
		$failure->{category} = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
		$failure->{subcategory} = $2;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
		$failure->{severity} = $3;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
		$failure->{config} = $4;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
		$failure->{component} = $5;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
		$failure->{mmp} = $6;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
		$failure->{phase} = $7;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
		$failure->{recipe} = $8;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
		$failure->{file} = $9;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
		$failure->{linenum} = $10;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
		my $failure_package = '';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
		if (!$failure->{category})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
			print "WARNING: summary line without a category at $csv_file line $csv_linenum. Skipping\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
			next;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
		if ($failure->{category} =~ m,^recipe_failure$,i and !$failure->{component})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
			print "WARNING: recipe_failure with component field empty at $csv_file line $csv_linenum. Skipping\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
			next;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
		if ($failure->{component})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
			if ($failure->{component} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
				$failure_package = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
			else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
				print "WARNING: summary line with wrong component path at $csv_file line $csv_linenum. Skipping\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
				next;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
		$failure->{subcategory} = 'uncategorized' if (!$failure->{subcategory});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
		$failure->{severity} = 'unknown' if (!$failure->{severity});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
		$failure->{mmp} = '-' if (!$failure->{mmp});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
		# populate severities dynamically.
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
		#$severities->{$failure->{severity}} = 1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
		# put failure items into their category container
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
		if ($failure->{category} =~ /^raptor_(error|warning|unreciped)$/i)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
			$general_failures_num_by_severity->{$failure->{category}} = {} if (!defined $general_failures_num_by_severity->{$failure->{category}});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
			my $general_failure = $general_failures_num_by_severity->{$failure->{category}};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
			if (!defined $general_failure->{$failure->{severity}})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
				$general_failure->{$failure->{severity}} = 1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
			else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
				$general_failure->{$failure->{severity}} ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
			$general_failures_by_category_severity->{$failure->{category}} = {} if (!defined $general_failures_by_category_severity->{$failure->{category}});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
			$general_failures_by_category_severity->{$failure->{category}}->{$failure->{severity}} = [] if (!defined $general_failures_by_category_severity->{$failure->{category}}->{$failure->{severity}});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
			push(@{$general_failures_by_category_severity->{$failure->{category}}->{$failure->{severity}}}, $failure);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
		elsif ($failure->{category} =~ /^recipe_failure$/i)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
			$recipe_failures_num_by_severity->{$failure_package} = {} if (!defined $recipe_failures_num_by_severity->{$failure_package});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
			my $package_failure = $recipe_failures_num_by_severity->{$failure_package};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
			if (!defined $package_failure->{$failure->{severity}})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
				$package_failure->{$failure->{severity}} = 1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
			else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
				$package_failure->{$failure->{severity}} ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   183
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
			$recipe_failures_by_package_severity->{$failure_package} = {} if (!defined $recipe_failures_by_package_severity->{$failure_package});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
			$recipe_failures_by_package_severity->{$failure_package}->{$failure->{severity}} = [] if (!defined $recipe_failures_by_package_severity->{$failure_package}->{$failure->{severity}});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
			push(@{$recipe_failures_by_package_severity->{$failure_package}->{$failure->{severity}}}, $failure);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
	else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
		print "WARNING: line does not match expected format at $csv_file line $csv_linenum. Skipping\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
close(CSV);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
# PRINT HTML SUMMARY
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
my $aggregated_html = "$outputdir/index.html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
open(AGGREGATED, ">$aggregated_html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
print AGGREGATED "RAPTOR BUILD SUMMARY<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
print AGGREGATED "<br/>GENERAL FAILURES<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
print AGGREGATED "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
my $tableheader = "<tr><th>category</th>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
for (@severities) { $tableheader .= "<th>$_</th>"; }
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
$tableheader .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
print AGGREGATED "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
for my $category (keys %{$general_failures_num_by_severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
	print_category_specific_summary($category, $general_failures_by_category_severity->{$category});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
	my $categoryline = "<tr><td><a href='$category.html'>$category</a></td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
	for (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
		my $failuresbyseverity = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
		$failuresbyseverity = $general_failures_num_by_severity->{$category}->{$_} if (defined $general_failures_num_by_severity->{$category}->{$_});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
		$categoryline .= "<td>$failuresbyseverity</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
	$categoryline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
	print AGGREGATED "$categoryline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
print AGGREGATED "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
print AGGREGATED "<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
print AGGREGATED "<br/>PACKGE-SPECIFIC FAILURES<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
print AGGREGATED "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
$tableheader = "<tr><th>package</th>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
for (@severities) { $tableheader .= "<th>$_</th>"; }
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
$tableheader .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
print AGGREGATED "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
for my $package (keys %{$recipe_failures_num_by_severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
	print_package_specific_summary($package, $recipe_failures_by_package_severity->{$package});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
	my $packagesummaryhtml = $package;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
	$packagesummaryhtml =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
	$packagesummaryhtml .= ".html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
	my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
	for (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
		my $failuresbyseverity = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
		$failuresbyseverity = $recipe_failures_num_by_severity->{$package}->{$_} if (defined $recipe_failures_num_by_severity->{$package}->{$_});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
		$packageline .= "<td>$failuresbyseverity</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
	$packageline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
	print AGGREGATED "$packageline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
print AGGREGATED "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
close(AGGREGATED);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
translate_detail_files_to_html();
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   250
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
print "OK, done. Please open $outputdir/index.html.\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   252
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
sub print_category_specific_summary
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
	my ($category, $failures_by_severity) = @_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
	my $filenamebase = $category;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
	$filenamebase =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
	open(SPECIFIC, ">$outputdir/$filenamebase.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
	print SPECIFIC "FAILURES FOR CATEGORY $category<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
	for my $severity (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
		if (defined $failures_by_severity->{$severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
			print SPECIFIC "<br/>".uc($severity)."<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
			print SPECIFIC "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
			# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
			my $tableheader = "<tr><th>category</th><th>log file</th><th>log snippet</th></tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   272
			print SPECIFIC "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   273
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
			for my $failure (@{$failures_by_severity->{$severity}})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   276
				my $failureline = "<tr><td>$failure->{subcategory}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   277
				$failureline .= "<td>$failure->{config}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
				$failureline .= "<td><a href='$filenamebase\_failures.html#failure_item_$failure->{linenum}'>item $failure->{linenum}</a></td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
				$failureline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
				print SPECIFIC "$failureline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   281
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
			print SPECIFIC "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   284
			print SPECIFIC "<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   288
	close(SPECIFIC);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   289
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   290
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   291
sub print_package_specific_summary
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   292
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   293
	my ($package, $failures_by_severity) = @_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   294
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   295
	my $filenamebase = $package;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
	$filenamebase =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   297
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   298
	open(SPECIFIC, ">$outputdir/$filenamebase.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
	print SPECIFIC "FAILURES FOR PACKAGE $package<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
	for my $severity (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   302
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   303
		if (defined $failures_by_severity->{$severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   304
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   305
			print SPECIFIC "<br/>".uc($severity)."<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
			print SPECIFIC "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   307
			# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   308
			my $tableheader = "<tr><th>category</th><th>configuration</th><th>mmp</th><th>phase</th><th>recipe</th><th>log snippet</th></tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   309
			print SPECIFIC "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   310
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   311
			for my $failure (@{$failures_by_severity->{$severity}})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   312
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
				my $failureline = "<tr><td>$failure->{subcategory}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
				$failureline .= "<td>$failure->{config}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
				$failureline .= "<td>$failure->{mmp}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
				$failureline .= "<td>$failure->{phase}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
				$failureline .= "<td>$failure->{recipe}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
				$failureline .= "<td><a href='$filenamebase\_failures.html#failure_item_$failure->{linenum}'>item $failure->{linenum}</a></td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
				$failureline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
				print SPECIFIC "$failureline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   321
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
			print SPECIFIC "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
			print SPECIFIC "<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   325
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   326
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
	close(SPECIFIC);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
sub translate_detail_files_to_html
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
	opendir(DIR, $raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
	my @failurefiles = readdir(DIR);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
	closedir(DIR);	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
	@failurefiles = grep(/\.txt$/, @failurefiles);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   337
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
	for my $file (@failurefiles)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   339
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
		$file =~ /(.*)\.txt$/;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
		my $filenamebase = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
		my $filecontent = '';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
		open(FILE, "$raptorbitsdir/$file");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   346
			local $/=undef;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
			$filecontent = <FILE>;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
		close(FILE);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   351
		$filecontent =~ s,---(failure_item_\d+)---,<a name="$1">---$1---</a>,g;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
		$filecontent = "<pre>$filecontent</pre>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
		open(FILE, ">$outputdir/$filenamebase\_failures.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   355
		print FILE $filecontent;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   356
		close(FILE);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
}