common/tools/raptor/uh.pl
author Simon Howkins <simonh@symbian.org>
Tue, 08 Dec 2009 12:00:46 +0000
changeset 815 3ae590eac695
parent 791 9054e820b1e6
child 879 e88616591730
permissions -rw-r--r--
Re-assessed some of the raptor error messages to reflect the inconsequential nature of missing the MS dev tools when not trying to build the tools target.
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
791
9054e820b1e6 Fix releaseables are missing. Fix stray call to summarize.pl
Dario Sestito <darios@symbian.org>
parents: 764
diff changeset
    58
$raptorbitsdir =~ s,/,\\,g; # this is because rmdir doens't cope correctly with the forward slashes
9054e820b1e6 Fix releaseables are missing. Fix stray call to summarize.pl
Dario Sestito <darios@symbian.org>
parents: 764
diff changeset
    59
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
system("rmdir /S /Q $raptorbitsdir") if (-d $raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
mkdir($raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
#print "Created dir $raptorbitsdir.\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
# create empty summary file anyway
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
open(SUMMARY, ">$raptorbitsdir/summary.csv");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
close(SUMMARY);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
my $saxhandler = RaptorSAXHandler->new();
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
$saxhandler->add_observer('RaptorError', $RaptorError::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
$saxhandler->add_observer('RaptorWarning', $RaptorWarning::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
$saxhandler->add_observer('RaptorInfo', $RaptorInfo::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
$saxhandler->add_observer('RaptorUnreciped', $RaptorUnreciped::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
$saxhandler->add_observer('RaptorRecipe', $RaptorRecipe::reset_status);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
for (@logfiles)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
	print "Reading file: $_\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
	$current_log_file = $_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
	$parser->parse_uri($_);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
}
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
print "Generating HTML...\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
system("rd /S /Q $outputdir") if (-d $outputdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
mkdir ($outputdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
my $raptor_errors = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
my $raptor_warnings = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
my $raptor_unreciped = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
my $general_failures_num_by_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
my $general_failures_by_category_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
my $recipe_failures_num_by_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
my $recipe_failures_by_package_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
#my $severities = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
my @severities = ('critical', 'major', 'minor', 'unknown');
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
# READ SUMMARY.CSV FILE
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
my $csv_file = "$raptorbitsdir/summary.csv";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
my $csv_linenum = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
open(CSV, $csv_file);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
while(<CSV>)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
	$csv_linenum ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
	my $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
	if ($line =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
		my $failure = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
		$failure->{category} = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
		$failure->{subcategory} = $2;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
		$failure->{severity} = $3;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
		$failure->{config} = $4;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
		$failure->{component} = $5;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
		$failure->{mmp} = $6;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
		$failure->{phase} = $7;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
		$failure->{recipe} = $8;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
		$failure->{file} = $9;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
		$failure->{linenum} = $10;
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
		my $failure_package = '';
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
		if (!$failure->{category})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
			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
   126
			next;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
		}
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
		if ($failure->{category} =~ m,^recipe_failure$,i and !$failure->{component})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
			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
   132
			next;
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})
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
			if ($failure->{component} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
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
				$failure_package = $1;
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
			else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
				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
   143
				next;
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
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
		$failure->{subcategory} = 'uncategorized' if (!$failure->{subcategory});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
		$failure->{severity} = 'unknown' if (!$failure->{severity});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
		$failure->{mmp} = '-' if (!$failure->{mmp});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
		# populate severities dynamically.
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
		#$severities->{$failure->{severity}} = 1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
		# put failure items into their category container
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
		if ($failure->{category} =~ /^raptor_(error|warning|unreciped)$/i)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
			$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
   158
			my $general_failure = $general_failures_num_by_severity->{$failure->{category}};
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
			if (!defined $general_failure->{$failure->{severity}})
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
				$general_failure->{$failure->{severity}} = 1;
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
			else
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
				$general_failure->{$failure->{severity}} ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
			$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
   170
			$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
   171
			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
   172
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
		elsif ($failure->{category} =~ /^recipe_failure$/i)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
			$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
   176
			my $package_failure = $recipe_failures_num_by_severity->{$failure_package};
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
			if (!defined $package_failure->{$failure->{severity}})
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
				$package_failure->{$failure->{severity}} = 1;
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
			else
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
				$package_failure->{$failure->{severity}} ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
			$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
   188
			$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
   189
			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
   190
		}
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
	else
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
		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
   195
	}
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
close(CSV);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
# PRINT HTML SUMMARY
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
my $aggregated_html = "$outputdir/index.html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
open(AGGREGATED, ">$aggregated_html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
print AGGREGATED "RAPTOR BUILD SUMMARY<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
print AGGREGATED "<br/>GENERAL FAILURES<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
print AGGREGATED "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
my $tableheader = "<tr><th>category</th>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
for (@severities) { $tableheader .= "<th>$_</th>"; }
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
$tableheader .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
print AGGREGATED "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
for my $category (keys %{$general_failures_num_by_severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
	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
   213
	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
   214
	for (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
		my $failuresbyseverity = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
		$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
   218
		$categoryline .= "<td>$failuresbyseverity</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
	$categoryline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
	print AGGREGATED "$categoryline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
print AGGREGATED "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
print AGGREGATED "<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
print AGGREGATED "<br/>PACKGE-SPECIFIC FAILURES<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
print AGGREGATED "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
$tableheader = "<tr><th>package</th>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
for (@severities) { $tableheader .= "<th>$_</th>"; }
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
$tableheader .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
print AGGREGATED "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
for my $package (keys %{$recipe_failures_num_by_severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
	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
   235
	my $packagesummaryhtml = $package;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
	$packagesummaryhtml =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
	$packagesummaryhtml .= ".html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
	my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
	for (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
		my $failuresbyseverity = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
		$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
   243
		$packageline .= "<td>$failuresbyseverity</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
	$packageline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
	print AGGREGATED "$packageline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
print AGGREGATED "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
close(AGGREGATED);
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
translate_detail_files_to_html();
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
print "OK, done. Please open $outputdir/index.html.\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
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
sub print_category_specific_summary
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 ($category, $failures_by_severity) = @_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
	my $filenamebase = $category;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
	$filenamebase =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
	open(SPECIFIC, ">$outputdir/$filenamebase.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
	print SPECIFIC "FAILURES FOR CATEGORY $category<br/>\n";
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
	for my $severity (@severities)
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
		if (defined $failures_by_severity->{$severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
			print SPECIFIC "<br/>".uc($severity)."<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
			print SPECIFIC "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   272
			# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   273
			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
   274
			print SPECIFIC "$tableheader\n";
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
			for my $failure (@{$failures_by_severity->{$severity}})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   277
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
				my $failureline = "<tr><td>$failure->{subcategory}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
				$failureline .= "<td>$failure->{config}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
				$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
   281
				$failureline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
				print SPECIFIC "$failureline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   284
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
			print SPECIFIC "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
			print SPECIFIC "<br/>\n";
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
	}
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
	close(SPECIFIC);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   291
}
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
sub print_package_specific_summary
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 ($package, $failures_by_severity) = @_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   297
	my $filenamebase = $package;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   298
	$filenamebase =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
	open(SPECIFIC, ">$outputdir/$filenamebase.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
	print SPECIFIC "FAILURES FOR PACKAGE $package<br/>\n";
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
	for my $severity (@severities)
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
		if (defined $failures_by_severity->{$severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   307
			print SPECIFIC "<br/>".uc($severity)."<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   308
			print SPECIFIC "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   309
			# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   310
			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
   311
			print SPECIFIC "$tableheader\n";
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
			for my $failure (@{$failures_by_severity->{$severity}})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
				my $failureline = "<tr><td>$failure->{subcategory}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
				$failureline .= "<td>$failure->{config}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
				$failureline .= "<td>$failure->{mmp}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
				$failureline .= "<td>$failure->{phase}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
				$failureline .= "<td>$failure->{recipe}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
				$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
   321
				$failureline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
				print SPECIFIC "$failureline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
			}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   325
			print SPECIFIC "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   326
			print SPECIFIC "<br/>\n";
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
	}
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
	close(SPECIFIC);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
}
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
sub translate_detail_files_to_html
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
	opendir(DIR, $raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
	my @failurefiles = readdir(DIR);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   337
	closedir(DIR);	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
	@failurefiles = grep(/\.txt$/, @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
	for my $file (@failurefiles)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
		$file =~ /(.*)\.txt$/;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
		my $filenamebase = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
		my $filecontent = '';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   346
		open(FILE, "$raptorbitsdir/$file");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
			local $/=undef;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
			$filecontent = <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
		close(FILE);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
		$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
   354
		$filecontent = "<pre>$filecontent</pre>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   355
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   356
		open(FILE, ">$outputdir/$filenamebase\_failures.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
		print FILE $filecontent;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
		close(FILE);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
}