author | Maciej Seroka <maciejs@symbian.org> |
Thu, 19 Aug 2010 13:29:44 +0100 | |
changeset 1213 | 6f2a3431cc87 |
parent 1181 | 4bdc287cd2c7 |
child 1244 | c04fc0405d17 |
permissions | -rw-r--r-- |
1050
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
1 |
# Copyright (c) 2009 Symbian Foundation Ltd |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
2 |
# This component and the accompanying materials are made available |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
3 |
# under the terms of the License "Eclipse Public License v1.0" |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
4 |
# which accompanies this distribution, and is available |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
5 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
6 |
# |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
7 |
# Initial Contributors: |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
8 |
# Symbian Foundation Ltd - initial contribution. |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
9 |
# |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
10 |
# Contributors: |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
11 |
# |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
12 |
# Description: |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
13 |
# Translates uh report (index.html) to a Diamonds file |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
14 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
15 |
use strict; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
16 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
17 |
use Getopt::Long; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
18 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
19 |
my $input = "\\output\\logs\\html\\index.html"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
20 |
my $output = "\\output\\logs\\diamonds_uh.xml"; |
1181
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
21 |
my $bit_output = "\\output\\logs\\bitinfo.txt"; |
1050
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
22 |
my $help = 0; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
23 |
GetOptions(( |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
24 |
'in=s' => \$input, |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
25 |
'out=s' => \$output, |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
26 |
'help!' => \$help |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
27 |
)); |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
28 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
29 |
if ($help) |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
30 |
{ |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
31 |
print "Translates uh report (index.html) to a Diamonds file\n"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
32 |
print "Usage: perl uh2diamonds.pl [--in=UHINDEX] [--out=XMLFILE]\n"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
33 |
print "\n"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
34 |
print "UHINDEX is optional, its default is \\output\\logs\\html\\index.html\n"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
35 |
print "XMLFILE is optional, its default is \\output\\logs\\diamonds_uh.xml\n"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
36 |
exit(0); |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
37 |
} |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
38 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
39 |
my $critical = 0; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
40 |
my $major = 0; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
41 |
my $minor = 0; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
42 |
my $unknown = 0; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
43 |
my $missing = 0; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
44 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
45 |
open(INDEX, $input) or die "Can't open $input for reading"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
46 |
while (<INDEX>) |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
47 |
{ |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
48 |
my $line = $_; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
49 |
if ($line =~ m,<tr><td><a href='.*'>\w+</a></td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td></tr>,) |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
50 |
{ |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
51 |
$critical += $1; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
52 |
$major += $2; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
53 |
$minor += $3; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
54 |
$unknown += $4; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
55 |
} |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
56 |
elsif($line =~ m,<tr><td><a href='.+'>.+</a></td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td><td>(\d+)</td></tr>,) |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
57 |
{ |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
58 |
$critical += $1; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
59 |
$major += $2; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
60 |
$minor += $3; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
61 |
$unknown += $4; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
62 |
$missing += $5; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
63 |
} |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
64 |
} |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
65 |
close(INDEX); |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
66 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
67 |
my $xml_content = <<_EOX; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
68 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
69 |
<?xml version=\"1.0\" encoding=\"utf-8\"?> |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
70 |
<diamonds-build> |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
71 |
<schema>14</schema> |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
72 |
<faults> |
1051
044ab1b95cae
Reverse order of Diamonds summary info
Dario Sestito <darios@symbian.org>
parents:
1050
diff
changeset
|
73 |
<total severity=\"Missing Artifacts\">$missing</total> |
044ab1b95cae
Reverse order of Diamonds summary info
Dario Sestito <darios@symbian.org>
parents:
1050
diff
changeset
|
74 |
<total severity=\"Raptor Build Unknown\">$unknown</total> |
1050
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
75 |
<total severity=\"Raptor Build Minor\">$minor</total> |
1051
044ab1b95cae
Reverse order of Diamonds summary info
Dario Sestito <darios@symbian.org>
parents:
1050
diff
changeset
|
76 |
<total severity=\"Raptor Build Major\">$major</total> |
044ab1b95cae
Reverse order of Diamonds summary info
Dario Sestito <darios@symbian.org>
parents:
1050
diff
changeset
|
77 |
<total severity=\"Raptor Build Critical\">$critical</total> |
1050
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
78 |
</faults> |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
79 |
</diamonds-build> |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
80 |
_EOX |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
81 |
|
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
82 |
if (open(XML, ">$output")) |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
83 |
{ |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
84 |
print XML $xml_content; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
85 |
close(XML); |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
86 |
print "Wrote Diamonds file: $output\n"; |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
87 |
} |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
88 |
else |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
89 |
{ |
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
90 |
warn "Could not write to file: $output\n"; |
1181
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
91 |
} |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
92 |
|
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
93 |
if (open(BITINFO, ">>$bit_output")) |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
94 |
{ |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
95 |
print BITINFO "failure\tmissing,$missing\n"; |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
96 |
print BITINFO "failure\tminor,$minor\n"; |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
97 |
print BITINFO "failure\tmajor,$major\n"; |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
98 |
print BITINFO "failure\tcritical,$critical\n"; |
4bdc287cd2c7
Add uh parser info to BIT db
Dario Sestito <darios@symbian.org>
parents:
1051
diff
changeset
|
99 |
close(BITINFO); |
1050
34dcbee2af5e
Fix: Diamonds summary build info should be more related to the raptor build breakdown from the UH parser
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
100 |
} |