common/tools/brag/raptorToBRAG.pl
changeset 556 fa2414b24dc4
parent 547 19f9d5fc6406
child 569 5af7cc0d44a1
equal deleted inserted replaced
555:499a0581085d 556:fa2414b24dc4
    61 	{
    61 	{
    62 		warn "WARNING: line does not match expected format at $raptorSummary line $.. Skipping\n";
    62 		warn "WARNING: line does not match expected format at $raptorSummary line $.. Skipping\n";
    63 		next;
    63 		next;
    64 	}
    64 	}
    65 	
    65 	
       
    66 	# Populate the hash using a hash slice
    66 	my $failure = {};
    67 	my $failure = {};
    67 	@{$failure}{@keys} = @values;
    68 	@{$failure}{@keys} = @values;
    68 	
    69 	
    69 	if (!$failure->{category})
    70 	if (!$failure->{category})
    70 	{
    71 	{
    94 	unless ($step)
    95 	unless ($step)
    95 	{
    96 	{
    96 		# First item found in this step - create step entry
    97 		# First item found in this step - create step entry
    97 		$step = bless { name => $failure->{config}, Kids => [ $xmlNewline ] }, "step";
    98 		$step = bless { name => $failure->{config}, Kids => [ $xmlNewline ] }, "step";
    98 		push @{$buildStage->{Kids}}, $step, $xmlNewline;
    99 		push @{$buildStage->{Kids}}, $step, $xmlNewline;
       
   100 		# Also create empty <failures> tags with severities in a sensible order
       
   101 		foreach my $severity (qw{critical major minor})
       
   102 		{
       
   103 			my $failureSet = bless { level => $severity, Kids => [ $xmlNewline ] }, "failures";
       
   104 			push @{$step->{Kids}}, $failureSet, $xmlNewline;
       
   105 		}
    99 	}
   106 	}
   100 	
   107 	
   101 	# Look through the sets of failures in this step to see if we hve one which matches this severity
   108 	# Look through the sets of failures in this step to see if we hve one which matches this severity
   102 	my $failureSet;
   109 	my $failureSet;
   103 	foreach (@{$step->{Kids}})
   110 	foreach (@{$step->{Kids}})
   115 		$failureSet = bless { level => $failure->{severity}, Kids => [ $xmlNewline ] }, "failures";
   122 		$failureSet = bless { level => $failure->{severity}, Kids => [ $xmlNewline ] }, "failures";
   116 		push @{$step->{Kids}}, $failureSet, $xmlNewline;
   123 		push @{$step->{Kids}}, $failureSet, $xmlNewline;
   117 	}
   124 	}
   118 
   125 
   119 	# Now create the failure itself, and add it to this failure set
   126 	# Now create the failure itself, and add it to this failure set
   120 	my $failureItem = bless { href => "", Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ] }, "failure";
   127 	my $failureItem = bless {
       
   128 #		href => "",
       
   129 		Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ]
       
   130 	}, "failure";
       
   131 	if ($failure->{component})
       
   132 	{
       
   133 		$failure->{component} =~ s{^(/sf/.*?/.*?)/.*$}{$1};
       
   134 		$failureItem->{package} = $failure->{component};
       
   135 	}
   121 	push @{$failureSet->{Kids}}, $failureItem, $xmlNewline;
   136 	push @{$failureSet->{Kids}}, $failureItem, $xmlNewline;
   122 }
   137 }
   123 close(CSV);
   138 close(CSV);
   124 
   139 
   125 # Print XML
   140 # Print XML