common/tools/brag/raptorToBRAG.pl
changeset 556 fa2414b24dc4
parent 547 19f9d5fc6406
child 569 5af7cc0d44a1
--- a/common/tools/brag/raptorToBRAG.pl	Thu Oct 01 14:54:20 2009 +0100
+++ b/common/tools/brag/raptorToBRAG.pl	Thu Oct 01 16:17:02 2009 +0100
@@ -63,6 +63,7 @@
 		next;
 	}
 	
+	# Populate the hash using a hash slice
 	my $failure = {};
 	@{$failure}{@keys} = @values;
 	
@@ -96,6 +97,12 @@
 		# First item found in this step - create step entry
 		$step = bless { name => $failure->{config}, Kids => [ $xmlNewline ] }, "step";
 		push @{$buildStage->{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 +124,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);