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