--- a/common/tools/brag/raptorToBRAG.pl Wed Oct 07 11:09:46 2009 +0100
+++ b/common/tools/brag/raptorToBRAG.pl Wed Oct 07 11:12:20 2009 +0100
@@ -37,9 +37,23 @@
# Start to build structure to be output as XML (same format as XML::Parser would create for us)
my $xmlNewline = bless { Text => "\n" }, "Characters";
-my $data = [bless {name => "build", Kids => [ $xmlNewline ] }, "stage"];
+my $buildStatus =
+[
+ bless
+ {
+ Kids =>
+ [
+ $xmlNewline,
+ bless
+ {
+ name => "Build",
+ Kids => [ $xmlNewline ]
+ }, "phase",
+ ]
+ }, "buildStatus"
+];
# Get a shortcut reference to the bit we will use a lot
-my $buildStage = $data->[0];
+my $buildPhase = $buildStatus->[0]->{Kids}->[-1];
# READ SUMMARY.CSV FILE
open(CSV, $raptorSummary);
@@ -63,6 +77,7 @@
next;
}
+ # Populate the hash using a hash slice
my $failure = {};
@{$failure}{@keys} = @values;
@@ -82,7 +97,7 @@
# Look through the steps to see if we already have one to match this config
my $step;
- foreach (@{$buildStage->{Kids}})
+ foreach (@{$buildPhase->{Kids}})
{
next unless ref $_ eq "step";
if ($_->{name} eq $failure->{config})
@@ -95,7 +110,13 @@
{
# First item found in this step - create step entry
$step = bless { name => $failure->{config}, Kids => [ $xmlNewline ] }, "step";
- push @{$buildStage->{Kids}}, $step, $xmlNewline;
+ push @{$buildPhase->{Kids}}, $step, $xmlNewline;
+ # Also create empty <failures> tags with severities in a sensible order
+ foreach my $severity (qw{critical major minor})
+ {
+ my $failureSet = bless { level => $severity, Kids => [ $xmlNewline ] }, "failures";
+ push @{$step->{Kids}}, $failureSet, $xmlNewline;
+ }
}
# Look through the sets of failures in this step to see if we hve one which matches this severity
@@ -117,7 +138,15 @@
}
# Now create the failure itself, and add it to this failure set
- my $failureItem = bless { href => "", Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ] }, "failure";
+ my $failureItem = bless {
+# href => "",
+ Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ]
+ }, "failure";
+ if ($failure->{component})
+ {
+ $failure->{component} =~ s{^(/sf/.*?/.*?)/.*$}{$1};
+ $failureItem->{package} = $failure->{component};
+ }
push @{$failureSet->{Kids}}, $failureItem, $xmlNewline;
}
close(CSV);
@@ -125,7 +154,7 @@
# Print XML
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print "<?xml-stylesheet type='text/xsl' href='brag.xsl'?>\n";
-printTree($data->[0]);
+printTree($buildStatus->[0]);
print "\n";
exit(0);