common/tools/raptor/uh.pl
author Dario Sestito <darios@symbian.org>
Fri, 05 Feb 2010 15:18:22 +0000
changeset 880 3d35abce1659
parent 879 e88616591730
permissions -rw-r--r--
Commented out log-to-brag call on build environment checker as its results shouldn't be brag affecting
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
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
    75
our $allbldinfs = {};
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
    76
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
for (@logfiles)
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
	print "Reading file: $_\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
	$current_log_file = $_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
	$parser->parse_uri($_);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
    85
my @allpackages = distinct_packages($allbldinfs);
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
    86
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
print "Generating HTML...\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
system("rd /S /Q $outputdir") if (-d $outputdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
mkdir ($outputdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
my $raptor_errors = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
my $raptor_warnings = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
my $raptor_unreciped = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
my $general_failures_num_by_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
my $general_failures_by_category_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
my $recipe_failures_num_by_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
my $recipe_failures_by_package_severity = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
#my $severities = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
my @severities = ('critical', 'major', 'minor', 'unknown');
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
# READ SUMMARY.CSV FILE
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
my $csv_file = "$raptorbitsdir/summary.csv";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
my $csv_linenum = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
open(CSV, $csv_file);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
while(<CSV>)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
	$csv_linenum ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
	my $line = $_;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
	if ($line =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
		my $failure = {};
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
		$failure->{category} = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
		$failure->{subcategory} = $2;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
		$failure->{severity} = $3;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
		$failure->{config} = $4;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
		$failure->{component} = $5;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
		$failure->{mmp} = $6;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
		$failure->{phase} = $7;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
		$failure->{recipe} = $8;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
		$failure->{file} = $9;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
		$failure->{linenum} = $10;
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
		my $failure_package = '';
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})
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: 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
   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
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
		if ($failure->{category} =~ m,^recipe_failure$,i and !$failure->{component})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
			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
   136
			next;
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
		if ($failure->{component})
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
			if ($failure->{component} =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
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
				$failure_package = $1;
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
			else
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
				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
   147
				next;
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
		}
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
		$failure->{subcategory} = 'uncategorized' if (!$failure->{subcategory});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
		$failure->{severity} = 'unknown' if (!$failure->{severity});
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
		$failure->{mmp} = '-' if (!$failure->{mmp});
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
		# populate severities dynamically.
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
		#$severities->{$failure->{severity}} = 1;
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
		# put failure items into their category container
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
		if ($failure->{category} =~ /^raptor_(error|warning|unreciped)$/i)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
			$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
   162
			my $general_failure = $general_failures_num_by_severity->{$failure->{category}};
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
			if (!defined $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
				$general_failure->{$failure->{severity}} = 1;
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
			else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
				$general_failure->{$failure->{severity}} ++;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
			}
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
			$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
   174
			$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
   175
			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
   176
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
		elsif ($failure->{category} =~ /^recipe_failure$/i)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
			$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
   180
			my $package_failure = $recipe_failures_num_by_severity->{$failure_package};
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
			if (!defined $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
				$package_failure->{$failure->{severity}} = 1;
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
			else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
			{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
				$package_failure->{$failure->{severity}} ++;
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
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
			$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
   192
			$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
   193
			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
   194
		}
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
	else
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
		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
   199
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
close(CSV);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
# PRINT HTML SUMMARY
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
my $aggregated_html = "$outputdir/index.html";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
open(AGGREGATED, ">$aggregated_html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
print AGGREGATED "RAPTOR BUILD SUMMARY<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
print AGGREGATED "<br/>GENERAL FAILURES<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
print AGGREGATED "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
my $tableheader = "<tr><th>category</th>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
for (@severities) { $tableheader .= "<th>$_</th>"; }
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
$tableheader .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
print AGGREGATED "$tableheader\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
for my $category (keys %{$general_failures_num_by_severity})
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
	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
   217
	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
   218
	for (@severities)
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
		my $failuresbyseverity = 0;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
		$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
   222
		$categoryline .= "<td>$failuresbyseverity</td>";
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
	$categoryline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
	print AGGREGATED "$categoryline\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
print AGGREGATED "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
print AGGREGATED "<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   230
print AGGREGATED "<br/>PACKAGE-SPECIFIC FAILURES<br/>\n";
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
print AGGREGATED "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
$tableheader = "<tr><th>package</th>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
for (@severities) { $tableheader .= "<th>$_</th>"; }
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
$tableheader .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
print AGGREGATED "$tableheader\n";
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   236
for my $package (@allpackages)
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
{
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   238
	if (defined $recipe_failures_num_by_severity->{$package})
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
	{
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   240
		print_package_specific_summary($package, $recipe_failures_by_package_severity->{$package});
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   241
		my $packagesummaryhtml = $package;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   242
		$packagesummaryhtml =~ s,/,_,;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   243
		$packagesummaryhtml .= ".html";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   244
		my $packageline = "<tr><td><a href='$packagesummaryhtml'>$package</a></td>";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   245
		for (@severities)
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   246
		{
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   247
			my $failuresbyseverity = 0;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   248
			$failuresbyseverity = $recipe_failures_num_by_severity->{$package}->{$_} if (defined $recipe_failures_num_by_severity->{$package}->{$_});
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   249
			$packageline .= "<td>$failuresbyseverity</td>";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   250
		}
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   251
		$packageline .= "</tr>";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   252
		print AGGREGATED "$packageline\n";
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
	}
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   254
	else
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   255
	{
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   256
		my $packageline = "<tr><td>$package</td>";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   257
		for (@severities) { $packageline .= "<td>0</td>"; }
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   258
		$packageline .= "</tr>";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   259
		print AGGREGATED "$packageline\n";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   260
	}
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
print AGGREGATED "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
close(AGGREGATED);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
translate_detail_files_to_html();
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
print "OK, done. Please open $outputdir/index.html.\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
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
sub print_category_specific_summary
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   272
	my ($category, $failures_by_severity) = @_;
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
	my $filenamebase = $category;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
	$filenamebase =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   276
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   277
	open(SPECIFIC, ">$outputdir/$filenamebase.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
	print SPECIFIC "FAILURES FOR CATEGORY $category<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
	for my $severity (@severities)
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
		if (defined $failures_by_severity->{$severity})
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
			print SPECIFIC "<br/>".uc($severity)."<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
			print SPECIFIC "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
			# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
			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
   288
			print SPECIFIC "$tableheader\n";
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
			for my $failure (@{$failures_by_severity->{$severity}})
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
				my $failureline = "<tr><td>$failure->{subcategory}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   293
				$failureline .= "<td>$failure->{config}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   294
				$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
   295
				$failureline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
				print SPECIFIC "$failureline\n";
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
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
			print SPECIFIC "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
			print SPECIFIC "<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
		}
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
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   304
	close(SPECIFIC);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   305
}
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
sub print_package_specific_summary
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   308
{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   309
	my ($package, $failures_by_severity) = @_;
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
	my $filenamebase = $package;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   312
	$filenamebase =~ s,/,_,;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
	open(SPECIFIC, ">$outputdir/$filenamebase.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
	print SPECIFIC "FAILURES FOR PACKAGE $package<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
	for my $severity (@severities)
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
	{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
		if (defined $failures_by_severity->{$severity})
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   321
			print SPECIFIC "<br/>".uc($severity)."<br/>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
			print SPECIFIC "<table border='1'>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
			# $subcategory, $severity, $mmp, $phase, $recipe, $file, $line
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
			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
   325
			print SPECIFIC "$tableheader\n";
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
			for my $failure (@{$failures_by_severity->{$severity}})
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
				my $failureline = "<tr><td>$failure->{subcategory}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
				$failureline .= "<td>$failure->{config}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
				$failureline .= "<td>$failure->{mmp}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
				$failureline .= "<td>$failure->{phase}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
				$failureline .= "<td>$failure->{recipe}</td>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
				$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
   335
				$failureline .= "</tr>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
				print SPECIFIC "$failureline\n";
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
			
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   339
			print SPECIFIC "</table>\n";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
			print SPECIFIC "<br/>\n";
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
	}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
	close(SPECIFIC);
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
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
sub translate_detail_files_to_html
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
	opendir(DIR, $raptorbitsdir);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
	my @failurefiles = readdir(DIR);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   351
	closedir(DIR);	
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
	@failurefiles = grep(/\.txt$/, @failurefiles);
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
	for my $file (@failurefiles)
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
		$file =~ /(.*)\.txt$/;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
		my $filenamebase = $1;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
		my $filecontent = '';
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
		open(FILE, "$raptorbitsdir/$file");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
		{
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
			local $/=undef;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
			$filecontent = <FILE>;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   364
		}
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   365
		close(FILE);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   366
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   367
		$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
   368
		$filecontent = "<pre>$filecontent</pre>";
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   369
		
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   370
		open(FILE, ">$outputdir/$filenamebase\_failures.html");
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   371
		print FILE $filecontent;
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   372
		close(FILE);
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   373
	}
879
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   374
}
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   375
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   376
sub distinct_packages
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   377
{
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   378
	my ($allbldinfs) = @_;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   379
	
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   380
	my $allpackages = {};
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   381
	
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   382
	for my $bldinf (keys %{$allbldinfs})
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   383
	{
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   384
		# normalize bldinf path
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   385
		$bldinf = lc($bldinf);
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   386
		$bldinf =~ s,^[A-Za-z]:,,;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   387
		$bldinf =~ s,[\\],/,g;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   388
		
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   389
		my $package = '';
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   390
		if ($bldinf =~ m,/((os|mw|app|tools|ostools|adaptation)/[^/]*),)
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   391
		{
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   392
			$package = $1;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   393
		}
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   394
		else
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   395
		{
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   396
			print "WARNING: can't understand bldinf attribute of recipe: $bldinf. Won't dump to failed recipes file.\n";
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   397
		}
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   398
		
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   399
		$allpackages->{$package} = 1;
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   400
	}
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   401
	
e88616591730 Make index.html report on all packages, including the ones built successfully. Make the list of packages be alphabetically sorted
Dario Sestito <darios@symbian.org>
parents: 791
diff changeset
   402
	return sort {$a cmp $b} keys %{$allpackages};
764
d00048f1b036 Improved Raptor parser, now "uh"
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   403
}