common/tools/brag/uh2brag.pl
author Simon Howkins <simonh@symbian.org>
Tue, 25 May 2010 20:30:36 +0100
changeset 1046 871bdf0d7610
parent 962 a5e5d79cd09a
child 1244 c04fc0405d17
permissions -rw-r--r--
Updated template for tagging source code so it uses the TAGS branch.
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
	{
962
a5e5d79cd09a Add number of missing files to major failures count
dario.sestito@v800052.ad-sfpd.intra
parents: 951
diff changeset
    46
		if ($line =~ m{<tr><td><a href='.*'>.*</a></td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td>(<td>(\d+)</td>)?})
882
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);
962
a5e5d79cd09a Add number of missing files to major failures count
dario.sestito@v800052.ad-sfpd.intra
parents: 951
diff changeset
    50
			$majors += $6 if ($6); # add number of missing files to majors
882
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
			$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
    52
			$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
    53
		}
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
	}
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
	close(INDEX);
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
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
# Print XML
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
print <<_END;
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
<?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
    61
<?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
    62
<buildStatus>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
<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
    64
<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
    65
<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
    66
<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
    67
<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
    68
<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
    69
</step>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
</phase>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
</buildStatus>
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
_END
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
exit(0);
6ae47dc5d707 Make BRAG point to the results of UH parser instead of intermediate artifacts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75