common/tools/brag/uh2brag.pl
author Dario Sestito <darios@symbian.org>
Tue, 09 Feb 2010 12:22:45 +0000
changeset 883 1281d0f13d9b
parent 882 6ae47dc5d707
child 951 5d2cdb4d231d
permissions -rw-r--r--
Fix when accessing uh index from brag summary, pages linked from uh index are not found
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
882
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
#!perl -w
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
#
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
#
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
#
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
# Contributors:
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
#
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
# Description:
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
# Generate a BRAG-compatible XML summary from an index.html file coming out of the uh parser
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
use strict;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
use Getopt::Long;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
my $raptorSummary;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
my $help = 0;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
GetOptions((
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
	'index=s' => \$raptorSummary,
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
	'help!' => \$help
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
));
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
$help = 1 if (!$raptorSummary);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
if ($help)
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
{
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
	print "Generate an XML summary of the Raptor build from a summary.csv file\n";
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
	print "Usage: perl summarize.pl --index=INDEXFILE\n";
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
	exit(0);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
}
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
my $criticals = 0;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
my $majors = 0;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
my $minors = 0;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
my $unknowns = 0;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
# READ INDEX.HTML FILE
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
if (open(INDEX, $raptorSummary))
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
{
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
	while (my $line = <INDEX>)
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
	{
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
		if ($line =~ m{<tr><td><a href='.*'>.*</a></td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td></tr>})
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
		{
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
			$criticals += $1 if ($1);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
			$majors += $2 if ($2);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
			$minors += $3 if ($3);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
			$unknowns += $4 if ($4);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
		}
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
	}
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
	close(INDEX);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
}
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
# Print XML
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
print <<_END;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
<?xml-stylesheet type='text/xsl' href='brag.xsl'?>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
<buildStatus>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
<phase name="Build">
883
1281d0f13d9b Fix when accessing uh index from brag summary, pages linked from uh index are not found
Dario Sestito <darios@symbian.org>
parents: 882
diff changeset
    63
<step name=\"Raptor Build\" detailshref=\"../html/index.html\">
882
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
<failures level=\"critical\" count=\"$criticals\"/>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
<failures level=\"major\" count=\"$majors\"/>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
<failures level=\"minor\" count=\"$minors\"/>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
<failures level=\"unknown\" count=\"$unknowns\"/>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
</step>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
</phase>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
</buildStatus>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
_END
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
exit(0);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74