Merge
authorShabe Razvi <shaber@symbian.org>
Thu, 01 Oct 2009 19:32:21 +0100
changeset 559 6f2b69218788
parent 558 e103dd5a90d5 (current diff)
parent 557 c6145fb2403d (diff)
child 560 c17c3d55efb7
Merge
--- a/common/tools/brag/brag.xsl	Thu Oct 01 19:31:32 2009 +0100
+++ b/common/tools/brag/brag.xsl	Thu Oct 01 19:32:21 2009 +0100
@@ -1,24 +1,52 @@
 <xsl:stylesheet version="1.0"
-	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-	xmlns:fn="http://www.w3.org/2005/xpath-functions"
-	>
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions">
+
+<!-- Initialise keys (sort of like hashes?) to enable us to list distinct packages/severities -->
+<xsl:key name="packages" match="stage/step/failures/failure" use="@package"/>
+<xsl:key name="severities" match="stage/step/failures" use="@severity"/>
+
+<!-- Main template -->
 <xsl:template match="/">
 	<html>
-	<link href="http://developer.symbian.org/css/reset.css" rel="stylesheet" type="text/css" />
-	<link href="http://developer.symbian.org/css/portal-merged.css" rel="stylesheet" type="text/css" />
-	<link href="http://developer.symbian.org/css/iefix.css" rel="stylesheet" type="text/css" />
 	<head><title>Build Status</title></head>
 	<body>
-	<h2>Build Status</h2>
+	<h1>Build Status</h1>
+
+	<xsl:variable name="criticalCount" select="count(stage/step/failures[@level='critical']/failure)"/>
+	<xsl:variable name="majorCount" select="count(stage/step/failures[@level='major']/failure)"/>
+	<xsl:variable name="minorCount" select="count(stage/step/failures[@level='minor']/failure)"/>
+	<xsl:variable name="unknownCount" select="count(stage/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
+
+	<h2>
+	Overall BRAG staus: 
+	<xsl:choose>
+		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
+		<xsl:when test="$majorCount != 0">RED</xsl:when>
+		<xsl:when test="$minorCount != 0">AMBER</xsl:when>
+		<xsl:when test="$unknownCount != 0">GREEN</xsl:when>
+		<xsl:otherwise>GOLD!</xsl:otherwise>
+	</xsl:choose>
+	</h2>
+
+	<h2>Breakdown by severity</h2>
+	<table border="1">
+	<tr><td>Critical</td><td><xsl:value-of select="$criticalCount"/></td></tr>
+	<tr><td>Major</td><td><xsl:value-of select="$majorCount"/></td></tr>
+	<tr><td>Minor</td><td><xsl:value-of select="$minorCount"/></td></tr>
+	<tr><td>Unknown</td><td><xsl:value-of select="$unknownCount"/></td></tr>
+	<tr><th>Grand total</th><th><xsl:value-of select="count(stage/step/failures/failure)"/></th></tr>
+	</table>
+
+	<h2>Breakdown by stage/step</h2>
 	<table border="1">
 
 	<xsl:for-each select="stage">
 		<tr>
-		<th>Stage: <xsl:value-of select="@name"/></th>
+		<th colspan='2'>Stage: <xsl:value-of select="@name"/></th>
 		</tr>
 		<xsl:for-each select="step">
 			<tr>
-			<td>Step: <xsl:value-of select="@name"/></td>
+			<td colspan='2'>Step: <xsl:value-of select="@name"/></td>
 			</tr>
 			<xsl:for-each select="failures">
 				<tr>
@@ -31,26 +59,18 @@
 
 	</table>
 
-	<xsl:variable name="criticalCount" select="count(stage/step/failures[@level='critical']/failure)"/>
-	<xsl:variable name="majorCount" select="count(stage/step/failures[@level='major']/failure)"/>
-	<xsl:variable name="minorCount" select="count(stage/step/failures[@level='minor']/failure)"/>
-	<xsl:variable name="unknownCount" select="count(stage/step/failures[@level!='critical' and @level!='major' and @level!='minor']/failure)"/>
-
-	<p>Total number of critical errors = <xsl:value-of select="$criticalCount"/></p>
-	<p>Total number of major errors = <xsl:value-of select="$majorCount"/></p>
-	<p>Total number of minor errors = <xsl:value-of select="$minorCount"/></p>
-	<p>Total number of unknown errors = <xsl:value-of select="$unknownCount"/></p>
-
-	<h2>
-	Final BRAG staus: 
-	<xsl:choose>
-		<xsl:when test="$criticalCount != 0">BLACK</xsl:when>
-		<xsl:when test="$majorCount != 0">RED</xsl:when>
-		<xsl:when test="$minorCount != 0">AMBER</xsl:when>
-		<xsl:when test="$unknownCount != 0">GREEN</xsl:when>
-		<xsl:otherwise>GOLD!</xsl:otherwise>
-	</xsl:choose>
-	</h2>
+	<!-- If any failures are tied to a specific package... -->
+	<xsl:if test="stage/step/failures/failure[@package]">
+		<h2>Breakdown by package</h2>
+		<table border="1">
+		<tr><th>Package</th><th>Total failures</th></tr>
+		<!-- Use the Muenchian Method to get a set of distinct packages -->
+		<xsl:for-each select="stage/step/failures/failure[generate-id(.) = generate-id(key('packages', @package))]">
+			<xsl:sort select="@package"/>
+			<tr><td><xsl:value-of select="@package"/></td><td><xsl:value-of select="count(key('packages', @package))"/></td></tr>
+		</xsl:for-each>
+		</table>
+	</xsl:if>
 
 	</body>
 	</html>
--- a/common/tools/brag/raptorToBRAG.pl	Thu Oct 01 19:31:32 2009 +0100
+++ b/common/tools/brag/raptorToBRAG.pl	Thu Oct 01 19:32:21 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);