Bugfixes and additional validation for sysdeftools
authorBob Rosenberg <bob.rosenberg@nokia.com>
Tue, 26 Oct 2010 11:04:46 +0100
changeset 661 199bb033aacf
parent 660 66ff3e731c60
child 662 60be34e1b006
child 664 44b0e894b7ab
Bugfixes and additional validation for sysdeftools
metatools/sysdeftools/group/contents.xml
metatools/sysdeftools/lib/joinsysdef-module.xsl
metatools/sysdeftools/lib/test-model.xsl
--- a/metatools/sysdeftools/group/contents.xml	Mon Oct 18 10:33:54 2010 +0100
+++ b/metatools/sysdeftools/group/contents.xml	Tue Oct 26 11:04:46 2010 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ProductsDefinition schema="3.0.0">
 	<product name="BuildEnvironment" long-name="Build Environment">
-		<tool name="sysdeftools" long-name="System Definition Tools" default-src="metatools/sysdeftools" default-dst="/" version="1.0.3">
+		<tool name="sysdeftools" long-name="System Definition Tools" default-src="metatools/sysdeftools" default-dst="/" version="1.0.4">
 
 			<!-- core functionality -->
 			<file filename="*.pl"/> 
--- a/metatools/sysdeftools/lib/joinsysdef-module.xsl	Mon Oct 18 10:33:54 2010 +0100
+++ b/metatools/sysdeftools/lib/joinsysdef-module.xsl	Tue Oct 26 11:04:46 2010 +0100
@@ -467,7 +467,7 @@
 	<xsl:variable name="prefix" select="name($namespaces[.=$ns])"/>
 	<xsl:attribute name="{name()}">
 	<xsl:choose>
-		<xsl:when test="$prefix = 'id-namespace' or  (not($namespaces[name()='id-namespace']) and $ns=$defaultns)"/> <!-- it's the default namespace, no prefix -->
+		<xsl:when test="$prefix = 'id-namespace' or $namespaces[name()='id-namespace']=$ns or  (not($namespaces[name()='id-namespace']) and $ns=$defaultns)"/> <!-- it's the default namespace, no prefix -->
 		<xsl:when test="$prefix='' and contains(.,':')">
 			<!-- complex: copy id and copy namespace (namespace should be copied already)-->
 			<xsl:value-of select="."/>
--- a/metatools/sysdeftools/lib/test-model.xsl	Mon Oct 18 10:33:54 2010 +0100
+++ b/metatools/sysdeftools/lib/test-model.xsl	Tue Oct 26 11:04:46 2010 +0100
@@ -75,7 +75,7 @@
 <xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.')] | systemModel">
 	<xsl:param name="filename"  select="$Filename"/>
 		
-<xsl:if test="//unit and not(self::systemModel)">
+<xsl:if test="descendant::unit and not(self::systemModel)">
 <xsl:call-template name="Section">
 	<xsl:with-param name="text"><xsl:value-of select="translate(substring(name(*),1,1),'clp','CLP')"/><xsl:value-of select="substring(name(*),2)"/> Definition: <xsl:value-of select="*/@name"/></xsl:with-param>
 	<xsl:with-param name="id"><xsl:value-of select="*/@id"/></xsl:with-param>
@@ -335,7 +335,7 @@
 <xsl:template match="layer | package | collection | component">
 	<xsl:param name="filename"/>
 
-<xsl:if test="self::package and not(parent::SystemDefinition)">
+<xsl:if test="self::package[not(@href)] and not(parent::SystemDefinition)">
 <xsl:call-template name="Section">
 	<xsl:with-param name="id"><xsl:value-of select="@id"/></xsl:with-param>
 	<xsl:with-param name="text"><xsl:value-of select="translate(substring(name(),1,1),'clp','CLP')"/><xsl:value-of select="substring(name(),2)"/>: <xsl:value-of select="@name"/></xsl:with-param>
@@ -348,7 +348,7 @@
 <xsl:if test="self::component">
 	<xsl:choose>
 		<xsl:when test="count(unit[not(@filter | @version)]) = 0 "/>
-		<xsl:when test="count(unit[not(@version)]) &gt; 1 and @filter='s60'">
+		<xsl:when test="count(unit[not(@version)]) &gt; 1 and descendant-or-self::*[contains(@filter,'s60')]">
 			<xsl:call-template name="Warning"><xsl:with-param name="text">S60 Component <id><xsl:value-of select="@id"/></id> has <xsl:value-of select="count(unit)"/> units.</xsl:with-param></xsl:call-template>
 		</xsl:when>
 		<xsl:when test="count(unit[not(@version)]) &gt; 1">
@@ -505,7 +505,7 @@
 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<id><xsl:value-of select="."/></id>" contains reserved character "-" </xsl:with-param></xsl:call-template>
 </xsl:if>
 
-<xsl:if test="contains(.,'.') and not(parent::package) and not(contains(ancestor::pacakge/@id,'.'))">
+<xsl:if test="contains(.,'.') and not(parent::package) and not(contains(ancestor::package/@id,'.'))">
 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<xsl:value-of select="."/>" contains reserved character "<code>.</code>" </xsl:with-param></xsl:call-template>
 </xsl:if>
 
@@ -550,6 +550,19 @@
 		<xsl:call-template name="Error"><xsl:with-param name="text"><code><xsl:value-of select="name()"/></code> path "<xsl:value-of select="."/>" must use only forward slashes</xsl:with-param></xsl:call-template>
 </xsl:if>
 
+<xsl:if test="count(//unit[@bldFile=current()]/..) &gt; 1">
+		<xsl:call-template name="Error"><xsl:with-param name="text"><code><xsl:value-of select="name()"/></code> path "<xsl:value-of select="."/>" appears in components <xsl:for-each select="//unit[@bldFile=current()]/..">
+			<id><xsl:value-of select="@id"/></id>
+			<xsl:choose>
+			<xsl:when test="position()=last() - 1"> and </xsl:when>
+			<xsl:when test="position()!=last()">, </xsl:when>
+			</xsl:choose>
+			</xsl:for-each>
+		</xsl:with-param>
+		<xsl:with-param name="sub">Use filters or config metadata to control what kind of builds a component can appear in</xsl:with-param>
+		</xsl:call-template>
+</xsl:if>
+
 <!-- this is a realtive path, so just check that it's the expected number of dirs down -->
 	<xsl:variable name="fullpath"><xsl:call-template name="normpath">
 				<xsl:with-param name="path">