Merge
authorSimon Howkins <simonh@symbian.org>
Fri, 14 Aug 2009 12:08:05 +0100
changeset 349 1fa0548ccf38
parent 348 bf437da77ab4 (diff)
parent 318 2f60611cdea9 (current diff)
child 354 32e90c026ea4
child 362 35ec0d29a3d8
Merge
--- a/build.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/build.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -1,17 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="SF-CONFIG">
+<project name="SF-CONFIG" xmlns:hlm="http://www.nokia.com/helium">
   <!-- location of this config -->
   <dirname property="sf.config.dir" file="${ant.file.SF-CONFIG}"/>
-  <property name="sf.project.location" value="${sf.config.dir}/../build/config"/>
+  
+  <property name="sf.subproject.path" value=""/>
+  <property name="sf.project.location" value="${sf.config.dir}/../build/config/${sf.subproject.path}"/>
   <property name="sf.project.name" value="job"/>
      
   <!-- import job properties -->
-  <import file="${sf.project.location}/${sf.project.name}_props.ant.xml" />
+  <import file="${sf.project.location}/${sf.project.name}_props.ant.xml" optional="yes"/>
+  
+  <!-- set sf.spec.job.name and sf.spec.job.codeline if they are not specified in the project's job_props.ant.xml -->
+  <path id="lib.path">
+    <fileset dir="${helium.dir}/external/antlibs" includes="**/*.jar"/>
+  </path>
+  <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="lib.path"/>
+  <propertyregex override="yes" property="jobname" input="${sf.subproject.path}" regexp=".*[\\/]([^\\^/]+)" replace="\1"/>
+  <property name="jobname" value="${sf.subproject.path}"/>
+  <propertyregex override="yes" property="codeline" input="${sf.subproject.path}" regexp="^([^\\^/]+)[\\/].*" replace="\1"/>
+  <property name="codeline" value="default"/>
+  <property name="sf.spec.job.name" value="${jobname}"/>
+  <property name="sf.spec.job.codeline" value="${codeline}"/>
   
   <!-- import project properties/targets/references -->
   <import file="sf-${sf.project.type}/build.xml" />
   
   <!-- import job references -->
-  <import file="${sf.project.location}/${sf.project.name}_refs.ant.xml" />
+  <import file="${sf.project.location}/${sf.project.name}_refs.ant.xml" optional="yes"/>
   
 </project>
\ No newline at end of file
--- a/common/build.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/common/build.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -232,6 +232,7 @@
             <istrue value="${sf.spec.publish.enable}"/>
             <then>
                 <runtarget target="diamonds"/>
+                <runtarget target="sf-tag-build"/>
             </then>
         </if>
         
@@ -347,6 +348,15 @@
       </if>
     </target>
     
+    <target name="sf-tag-build">
+      <echo>[SF-TAG-BUILD]</echo>
+      <fmpp sourceFile="${sf.common.config.dir}/diamonds/sf-tag-build.xml.ftl" outputFile="${build.drive}/output/logs/sf-tag-build.xml">
+        <data expandProperties="yes">
+          ant: antProperties()
+        </data>
+      </fmpp>
+    </target>
+    
     <target name="sf-postbuild">
         <echo>[SF-POSTBUILD]</echo>
         <parallel>                
@@ -502,22 +512,12 @@
         </if>
     </target>
 
-    <target name="sf-build-noprep" depends="sf-truclean,sf-compile,sf-postbuild">
+    <target name="sf-build-noprep" depends="sf-truclean,sf-model-from-project,sf-compile,sf-postbuild">
         <echo>[SF-BUILD-NOPREP]</echo>
     </target>
     
     <target name="create-canonical-sysdef-file">
-        <if>
-            <istrue value="${sf.spec.systemdefinition.assemble}"/>
-            <then>
-                <echo message="Calling Helium create-canonical-sysdef-file target to assemble sysdef fragments."/>
-                <runtarget target="compile.create-canonical-sysdef-file"/>
-            </then>
-            <else>
-                <echo message="Will use ${build.drive}/${sf.spec.systemdefinition.location} as is as sysdef file"/>
-                <copy file="${build.drive}/${sf.spec.systemdefinition.location}" tofile="${build.drive}/output/build/canonical_system_definition.xml" failonerror="true" verbose="true"/>
-            </else>
-        </if>
+      <copy file="${build.drive}/${sf.spec.systemdefinition.location}" tofile="${canonical.sysdef.file}" failonerror="true" verbose="true"/>
     </target>
     
   <target name="sf-truclean">
@@ -539,23 +539,26 @@
       </else>
     </if>
   </target>
-    
-    <target name="sf-compile">
-        <!-- TODO: add here assigments to raptor-related ant references -->
-    
-        <!-- hlm:argSet id="sbs.tools.var">
-            <hlm:arg name="config" value="${sf.spec.sbs.config}" />
-            <hlm:arg name="singlejob" value="..." />
-            <hlm:arg name="enable-filter" value="..." />
-        </hlm:argSet -->
-        
-        <!-- target name="compile-main-prebuild" -->
-        <antcall target="compile-main" inheritAll="false">
-            <param name="build.system" value="${sf.spec.build.system}"/>
-            <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
-            <!--<reference refid="sf.system.definition.files" torefid="system.definition.files" />-->
-        </antcall>    
-    </target>
+  
+  <target name="sf-model-from-project">
+    <if>
+      <isset property="sf.spec.systemdefinition.source"/>
+      <then>
+        <echo message="Using ${sf.spec.systemdefinition.source} as model file"/>
+        <echo message="Copying to ${build.drive}/definition.xml"/>
+        <copy file="${sf.project.location}/${sf.spec.systemdefinition.source}" tofile="${build.drive}${sf.spec.systemdefinition.location}"/>
+      </then>
+      <else>
+        <!-- Collate the system definition from the packages listed in sources.csv -->
+        <echo message="Building system model from ${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+        <exec executable="perl" dir="${build.drive}/" output="${build.drive}${sf.spec.systemdefinition.location}" logError="true" failonerror="true">
+          <arg value="${sf.common.config.dir}/tools/csvToSysDef.pl"/>
+          <arg value="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+          <arg value="${sf.config.dir}/../build/config/3k"/>
+        </exec>
+      </else>
+    </if>
+  </target>
     
     <target name="sf-get-source" depends="sf-generate-source-spec">
         <ant antfile="${sf.common.config.dir}/generated/source-spec.ant.xml" />
@@ -711,7 +714,6 @@
     </target>
     
     <target name ="sf-make-junction">
-        
         <mkdir dir="${sf.spec.test.epocroot}"/>
 
         <exec executable="perl" dir="${sf.common.config.dir}/tools/ats" failonerror="false" output="${build.log.dir}/ATS_${build.id}_make_junction.log">
@@ -869,7 +871,7 @@
           </fileset>
         </path>
         <sequential>
-          <propertyregex override="yes" property="preprocessedlogfile" input="@{logfile}" regexp=".*[\\|\/].*\.\d+_+(.*)_compile\.log" replace="\1_compile_preprocessed.log"/>
+          <propertyregex override="yes" property="preprocessedlogfile" input="@{logfile}" regexp=".*[\\|\/].*\.T?\d+_+(.*)_compile\.log" replace="\1_compile_preprocessed.log"/>
 	        <echo message="Preprocessing @{logfile}..."/>
           <exec executable="perl" dir="${sf.common.config.dir}/tools/raptor" failonerror="false" input="@{logfile}" output="${build.log.dir}/analysis/${preprocessedlogfile}" error="${build.log.dir}/analysis/${build.id}_preprocess.log" append="true">
             <arg value="${sf.common.config.dir}/tools/raptor/preprocess_log.pl"/>
--- a/common/common_props.ant.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/common/common_props.ant.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -54,6 +54,7 @@
     <property name="sf.spec.publish.diamonds.server" value="v800002.ad-sfpd.intra"/>
     <property name="sf.spec.publish.diamonds.port" value="80"/>
     <property name="sf.spec.publish.diamonds.path" value="/diamonds/builds/"/>
+    <property name="sf.spec.publish.diamonds.tag" value="test"/>
     
     <property name="sf.spec.tagafterbuild.enable" value="false"/>
 
--- a/common/diamonds/config.xml.ftl	Fri Aug 14 11:06:38 2009 +0100
+++ b/common/diamonds/config.xml.ftl	Fri Aug 14 12:08:05 2009 +0100
@@ -71,6 +71,7 @@
             defer="true"/>
             
         <!-- SF specific -->
+        <target name="sf-tag-build"/>
         <target name="sf-diamondize-bom"/>
         <target name="sf-run-analysis"/>
     </targets>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/diamonds/sf-tag-build.xml.ftl	Fri Aug 14 12:08:05 2009 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<diamonds-build>
+  <schema>10</schema>
+  <tags>
+    <tag>${ant['sf.spec.publish.diamonds.tag']}</tag>
+  </tags>
+</diamonds-build>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/sysdefdowngrade/sysdefdowngrade.pl	Fri Aug 14 12:08:05 2009 +0100
@@ -0,0 +1,93 @@
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Extracts output text in <buildlog> context which doesn't belong to <recipe>'s
+
+use strict;
+use Getopt::Long;
+
+my $XALAN_PATH = "xalan-j_2_7_1";
+my $XSLT_FILE = "sysdefdowngrade.xsl";
+
+my $modelfile = '';
+my $csvsourcesfile = '';
+my $help = 0;
+GetOptions((
+	'model=s' => \$modelfile,
+	'sources=s' => \$csvsourcesfile,
+	'help!' => \$help
+));
+
+$help = 1 if (!$modelfile or !$csvsourcesfile);
+
+if ($help)
+{
+	print "Checks that a model file is not in version 3.0.0. If it is transforms it to a version usable by Raptor\n";
+	print "Usage: perl sysdefdowngrade.pl --model=MODELFILE --sources=SOURCESFILE\n\n";
+	exit(0);
+}
+
+my $isversion3 = 0;
+open(MODELFILE, "$modelfile") or die("Can't open model file $modelfile");
+while(<MODELFILE>)
+{
+	if ($_ =~ /<SystemDefinition schema="3\.0\.0"/)
+	{
+		$isversion3 = 1;
+		last;
+	}
+}
+close(MODELFILE);
+
+if (!$isversion3)
+{
+	print "Model file is not version 3.0.0. Nothing to do.";
+	exit(0);
+}
+
+my $param_path = '';
+open(SOURCESFILE, "$csvsourcesfile") or die("Can't open sources file $csvsourcesfile");
+while(<SOURCESFILE>)
+{
+	if ($_ =~ m{[^,]*,([\\/]sf[\\/][^,]*),[^,]*,[^,]*,[^,]*})
+	{
+		$param_path = $1;
+		#print "param_path= $param_path\n";
+		last;
+	}
+}
+close(SOURCESFILE);
+
+if (!$param_path)
+{
+	print "Error: could not determine path parameter from sources file. Quitting.\n";
+	exit(0);
+}
+
+$param_path =~ s,\\,/,g;
+
+my $transformcmd = "java -jar $XALAN_PATH\\xalan.jar -xsl $XSLT_FILE -in $modelfile -out $modelfile.transformed";
+$transformcmd .= " -param Path $param_path";
+
+print "Executing: $transformcmd\n";
+system("$transformcmd");
+
+# ren doesn't work with forward slashes
+$modelfile =~ s,/,\\,g;
+
+$modelfile =~ m,.*[\\/](.*),;
+my $modelfile_name = $1;
+print "Executing: ren $modelfile $modelfile_name.orig\n";
+system("ren $modelfile $modelfile_name.orig");
+
+print "Executing: ren $modelfile.transformed $modelfile_name\n";
+system("ren $modelfile.transformed $modelfile_name");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/sysdefdowngrade/sysdefdowngrade.xsl	Fri Aug 14 12:08:05 2009 +0100
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:output method="xml" indent="yes"/>
+	
+	<xsl:param name="Path">os/deviceplatformrelease/foundation_system/system_model</xsl:param>
+	<!-- $Path is the location of the root system definition XML file. Must not end in /
+		This is used to compute the absolute paths the 2.0 syntax needs-->
+
+<xsl:template match="/*">
+	<xsl:message terminate="yes">Cannot process this document</xsl:message>
+</xsl:template>
+
+<!-- can only handle 3.0.0 to 2.0.1 transforms
+	Assumes only packages are using href
+ -->
+<xsl:template match="/SystemDefinition[@schema='3.0.0']"> 
+	<!-- process root system definition or package definition-->
+	<xsl:call-template name="DTD"/> <!-- insert 2.0.01 DTD -->
+  <SystemDefinition name="{*/@name}" schema="2.0.1">
+  	<xsl:apply-templates select="*|comment()"/>
+  </SystemDefinition>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition[@schema='3.0.0' and systemModel]"> 
+	<xsl:call-template name="DTD"/> <!-- insert 2.0.01 DTD -->
+  <SystemDefinition name="{systemModel/@name}" schema="2.0.1">
+  	<xsl:apply-templates select="*|comment()"/>
+  </SystemDefinition>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition/package[@href]" priority="2">
+	<xsl:message terminate="yes">Package definition cannot link another package</xsl:message>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition/package" priority="1">
+	<!-- process package definition file--> 
+  <systemModel>
+  	<layer name="anonymous"> <!-- fake layer -->
+		<block>
+			<xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!--  valid attribuites for 2.0 -->
+		  	<xsl:apply-templates select="*|comment()">
+		  		<xsl:with-param name="path" select="concat($Path,'/')"/> <!-- need to keep tack of where the current document is -->
+		  	</xsl:apply-templates>			
+		</block>  
+   	</layer>
+  </systemModel>
+</xsl:template>
+
+
+
+<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
+<xsl:template match="@*|comment()"><xsl:copy-of select="."/></xsl:template> 
+	<!-- comments are copied verbatim. Attribtues are copied by default -->
+
+<xsl:template match="systemModel">
+	<xsl:copy>
+  	<xsl:apply-templates select="*|comment()"> <!-- no attributes -->
+  		<xsl:with-param name="path" select="$Path"/> <!-- need to keep tack of where the current document is -->
+  	</xsl:apply-templates>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template mode="copy" match="@*">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template mode="copy" match="@id"> <!-- id in 3.0 is name in 2.0 -->
+	<xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
+</xsl:template>
+
+<xsl:template mode="copy" match="@name">  <!-- name in 3.0 is long-name in 2.0.1 -->
+	<xsl:if test=".!=../@id"> <!-- don't bother if it will be the same as name -->
+		<xsl:attribute name="long-name"><xsl:value-of select="."/></xsl:attribute>
+	</xsl:if>
+</xsl:template>
+	
+<xsl:template match="layer"><xsl:param name="path"/>
+	<layer>
+		<xsl:apply-templates mode="copy" select="@id|@name|@span|@levels"/> <!--  valid attribuites for 2.0 -->
+		<xsl:apply-templates select="*|comment()"> 
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</layer>
+</xsl:template>
+
+<xsl:template match="layer/package"><!-- translates to block -->
+	<xsl:param name="path"/>
+	<block>
+		<xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!--  valid attribuites for 2.0 -->
+		<xsl:choose>
+			<xsl:when test="@href">
+				<xsl:variable name="this" select="."/>
+				<xsl:for-each select="document(@href,.)/SystemDefinition/*">
+					<xsl:if test="@id!=$this/@id">
+						<xsl:message terminate="yes">Error: IDs do not match: <xsl:value-of select="@id"/> vs <xsl:value-of select="$this/@id"/></xsl:message>
+					</xsl:if>
+					<xsl:if test="@name and @name!=@id and not($this/@name and $this/@name=$this/@id)">
+						<!-- set long-name only if name is different from the id and not set in child doc -->
+						<xsl:attribute name="long-name"><xsl:value-of select="@name"/></xsl:attribute>
+					</xsl:if>						
+					<xsl:for-each select="@span|@levels|@level">
+						<!-- copy only if not set in child doc -->
+						<xsl:if test="not(this/@*[name()=name(current())])">
+							<xsl:copy-of select="."/>
+						</xsl:if>
+					</xsl:for-each>
+					<xsl:apply-templates select="*|comment()">
+	  					<xsl:with-param name="path">
+	  						<xsl:call-template name="normpath">
+	  							<xsl:with-param name="path" select="concat($path,'/',$this/@href)"/>
+	  						</xsl:call-template>
+	  					</xsl:with-param> 
+	  				</xsl:apply-templates>
+				</xsl:for-each>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates select="*|comment()">
+  					<xsl:with-param name="path" select="$path"/> 
+  				</xsl:apply-templates>
+			</xsl:otherwise>
+		</xsl:choose>
+	</block>
+</xsl:template>
+
+<xsl:template match="package/package">	<!-- translates to subblock --><xsl:param name="path"/>
+	<subblock>
+		<xsl:apply-templates mode="copy" select="@id|@name"/>
+		<xsl:apply-templates select="*|comment()">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</subblock>
+</xsl:template>
+
+<xsl:template match="package/package/pacakge"> <!-- cannot nest this deep --><xsl:param name="path"/>
+	<xsl:message>Excessive nesting of packages: Ignoring <xsl:value-of select="@id"/></xsl:message>
+	<xsl:apply-templates select="*|comment()">
+		<xsl:with-param name="path" select="$path"/> 
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<xsl:template match="collection"><xsl:param name="path"/>
+	<collection>
+		<xsl:apply-templates mode="copy" select="@id|@name|@level"/>
+		<xsl:apply-templates select="*|comment()">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</collection>
+</xsl:template>
+
+
+<xsl:template match="component"><xsl:param name="path"/>
+	<component>
+		<xsl:apply-templates mode="copy" select="@id|@name|@deprecated|@introduced|@filter|@purpose"/>
+		<xsl:if test="contains(concat(' ',@class,' '),' plugin ')">
+			<xsl:attribute name="plugin">Y</xsl:attribute>
+		</xsl:if>
+		<xsl:call-template name="class">
+			<xsl:with-param name="remove">plugin</xsl:with-param>
+			<xsl:with-param name="add">
+				<xsl:if test="not(*) and comment()">placeholder</xsl:if>
+				<xsl:if test="@target='desktop'"> PC</xsl:if>
+			</xsl:with-param>
+		</xsl:call-template>
+	  	<xsl:apply-templates select="*|comment()">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</component>
+</xsl:template>
+
+<xsl:template match="unit[@base and not(@mrp or @bldFile)]"/>
+
+<xsl:template match="unit"><xsl:param name="path"/>
+	<unit>
+		<xsl:apply-templates select="@mrp|@bldFile|@late">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+		<xsl:copy-of select="@filter|@root|@version|@prebuilt|@priority"/>
+	</unit>
+</xsl:template>
+
+<xsl:template match="unit/@late"> <!-- 2.0 uses Y/N, 3.0 uses yes/no -->
+	<xsl:attribute name="{name()}">
+		<xsl:choose>
+			<xsl:when test=".='yes'">Y</xsl:when>
+			<xsl:when test=".='no'">N</xsl:when>
+		</xsl:choose>
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="@mrp|@bldFile"><xsl:param name="path"/>
+	<xsl:attribute name="{name()}">
+	<xsl:choose>
+		<xsl:when test="starts-with(.,'/')"> <!-- keep absolute paths verbatim (barring the leading / ) -->
+			<xsl:value-of select="substring-after(substring(.,2),'/')"/>
+		</xsl:when>
+		<xsl:otherwise>	
+			<xsl:call-template name="normpath">
+  				<xsl:with-param name="path">
+  					<xsl:call-template name="before">
+						<xsl:with-param name="text" select="$path"/>
+					</xsl:call-template>
+					<xsl:value-of select="."/>
+  				</xsl:with-param>
+  			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="meta"/> <!-- strip all meta tags -->
+
+<xsl:template match="meta[info/@contract]"> <!-- except contract -->
+	<xsl:copy-of select="info/@contract"/>
+</xsl:template>
+
+<xsl:template name="class"><xsl:param name="remove"/><xsl:param name="add"/>
+<!--  returns the value of the class attribute with the space-separated list of names in $remove taken out and those in $add added on (does not check for duplicates) -->
+	<xsl:param name="class" select="normalize-space(@class)"/>
+	<xsl:variable name="r">
+		<xsl:text> </xsl:text>
+		<xsl:choose>
+			<xsl:when test="contains($remove,' ')"><xsl:value-of select="substring-before($remove,' ')"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$remove"/></xsl:otherwise>
+		</xsl:choose>
+		<xsl:text> </xsl:text>
+	</xsl:variable>
+	<xsl:variable name="c">
+		<xsl:choose>
+			<xsl:when test="contains(concat(' ',$class,' '),$r)">
+				<xsl:value-of select="substring-before(concat(' ',$class,' '),$r)"/>
+				<xsl:text> </xsl:text>
+				<xsl:value-of select="substring-after(concat(' ',$class,' '),$r)"/>
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="$class"/></xsl:otherwise>
+		</xsl:choose>
+		<xsl:if test="normalize-space($add)!=''"><xsl:value-of select="concat(' ',normalize-space($add))"/></xsl:if>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="contains($remove,' ')">
+			<xsl:call-template name="class">
+				<xsl:with-param name="remove" select="substring-after($remove,' ')"/>
+				<xsl:with-param name="class" select="$c"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="normalize-space($c)!=''">
+			<xsl:attribute name="class">
+				<xsl:value-of select="normalize-space($c)"/>
+			</xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="normpath"><xsl:param name="path"/>
+<!-- normalize out any ".." in the path in $path  -->
+<xsl:choose>
+	<xsl:when test="contains($path,'/../')">
+	<xsl:call-template name="normpath">
+		<xsl:with-param name="path">
+		<xsl:call-template name="before">
+			<xsl:with-param name="text" select="substring-before($path,'/../')"/>
+		</xsl:call-template>
+		<xsl:value-of select="substring-after($path,'/../')"/>
+		</xsl:with-param>
+		</xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+<!-- return all text before the last / -->
+<xsl:template name="before"><xsl:param name="text"/>
+<xsl:if test="contains($text,'/')">
+	<xsl:value-of select="substring-before($text,'/')"/>/<xsl:call-template name="before"><xsl:with-param name="text" select="substring-after($text,'/')"/></xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="DTD">
+<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE SystemDefinition [
+<!ELEMENT SystemDefinition ( systemModel )>
+<!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED
+>
+<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not.  -->
+
+<!-- System Model Section of DTD -->
+<!ELEMENT systemModel (layer+)>
+
+<!ELEMENT layer (block* | collection*)*>
+<!-- Kernel Services, Base Services, OS Services, Etc -->
+<!ATTLIST layer
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+  levels NMTOKENS #IMPLIED
+  span CDATA #IMPLIED
+>
+
+<!ELEMENT block (subblock* | collection*)*>
+ <!-- Generic OS services, Comms Services, etc -->
+<!ATTLIST block
+  levels NMTOKENS #IMPLIED
+  span CDATA #IMPLIED
+  level NMTOKEN #IMPLIED
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+>
+
+<!ELEMENT subblock (collection)*>
+<!-- Cellular Baseband Services, Networking Services, etc -->
+<!ATTLIST subblock
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+>
+
+<!ELEMENT collection (component)*>
+<!-- Screen Driver, Content Handling, etc -->
+<!ATTLIST collection
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+  level NMTOKEN #IMPLIED
+>
+
+<!ELEMENT component (unit)*>
+<!-- contains units or is a  package or prebuilt -->
+<!ATTLIST component
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+  deprecated CDATA #IMPLIED
+  introduced CDATA #IMPLIED
+  contract CDATA #IMPLIED
+  plugin (Y|N) "N"
+  filter CDATA #IMPLIED
+  class NMTOKENS #IMPLIED
+  supports CDATA #IMPLIED
+  purpose ( optional | mandatory | development ) "optional"
+>
+
+<!ELEMENT unit EMPTY >
+<!-- must be buildable (bld.inf) -->
+<!-- bldFile  may someday be removed in favour of mrp -->
+<!ATTLIST unit
+  mrp CDATA #IMPLIED
+  filter CDATA #IMPLIED
+  bldFile CDATA #IMPLIED
+  root CDATA #IMPLIED
+  version NMTOKEN #IMPLIED
+  prebuilt NMTOKEN #IMPLIED
+  late (Y|N) #IMPLIED
+  priority CDATA #IMPLIED
+>
+]>
+]]></xsl:text>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Binary file common/sysdefdowngrade/xalan-j_2_7_1/serializer.jar has changed
Binary file common/sysdefdowngrade/xalan-j_2_7_1/xalan.jar has changed
Binary file common/sysdefdowngrade/xalan-j_2_7_1/xercesImpl.jar has changed
Binary file common/sysdefdowngrade/xalan-j_2_7_1/xml-apis.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/csvToSysDef.pl	Fri Aug 14 12:08:05 2009 +0100
@@ -0,0 +1,195 @@
+#!perl -w
+
+use strict;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use XML::Parser;
+use Text::CSV;
+
+my $sourcesCSV = shift or die "First arg must be source csv file";
+my $backupBaseDir = shift or die "Second arg must be path to tree of package_definitions to use if not found in the source packages";
+shift and die "No more than two arguments please";
+
+# Load CSV
+open my $csvText, "<", $sourcesCSV or die;
+my $csv = Text::CSV->new();
+my @keys;
+my @packages;
+while (my $line = <$csvText>)
+{
+	chomp $line;
+	next unless $line;
+	unless ($csv->parse($line))
+	{
+		my $err = $csv->error_input();
+		die "Failed to parse line '$line': $err";
+	}
+
+	if (! @keys)
+	{
+		# First line - note the column names
+		@keys =  $csv->fields();
+	}
+	else
+	{
+		# Already got the keys, so get the data
+		my %package;
+		# Read into a hash slice
+		@package{@keys} = $csv->fields();
+		push @packages, \%package;
+	}
+}
+close $csvText;
+
+my $parser = new XML::Parser(Style => "Objects") or die;
+my $outTree;
+
+# For each package in CSV...
+foreach my $package (@packages)
+{
+	# If the sources.csv does not include a sys def for this package, it doesn't get built
+	next unless $package->{sysdef};
+	# If it's in the "backup" location, use that one (ie our copy overrides the package's own copy)
+	my $pkgDef = "$package->{dst}/$package->{sysdef}";
+	$pkgDef =~ s{^/sf/}{};
+	$pkgDef =~ s{/[^/]*$}{};
+	$pkgDef = "$backupBaseDir/$pkgDef/package_definition.xml";
+	if (!-f $pkgDef)
+	{
+		# Not there, so look for the pkg defn in the root of the package tree
+		warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
+		$pkgDef = "$package->{dst}/$package->{sysdef}";
+	}
+	die "Unable to locate any package_definition at all for $package->{dst}" unless -f $pkgDef;
+
+	warn "Including $pkgDef for $package->{dst}\n";
+	my $pkgTree = eval { $parser->parsefile($pkgDef) } or die "Failed to parse $pkgDef : $@";
+	if (!$outTree)
+	{
+		# The first file is taken verbatim
+		$outTree = $pkgTree;
+	}
+	else
+	{
+		# Merge into output Tree
+		mergeTrees($outTree->[0], $pkgTree->[0]);
+	}
+}
+
+# Output total tree
+print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+printTree($outTree->[0]);
+print "\n";
+
+exit;
+
+sub mergeTrees
+{
+	my $baseTree = shift or die;
+	my $extrasTree = shift or die;
+
+	die ("Package Definitions do not match: ".(ref $baseTree)." vs ".(ref $extrasTree)) unless ref $baseTree eq ref $extrasTree;
+	return if ref $baseTree eq "main::Characters";
+
+	foreach my $extraChild (@{$extrasTree->{Kids}})
+	{
+		# Work out whether this child should be merged with a namesake, or appended
+		my $mergeIt = undef;
+
+		my $extraChildTag = ref $extraChild;
+		$extraChildTag =~ s{^main::}{};
+		
+		if ($extraChildTag =~ m{^(SystemDefinition|systemModel)$})
+		{
+			# Should be merged if there's already one there
+			# Look for a namesake in the base
+			$mergeIt = matchTag($baseTree->{Kids}, $extraChild, undef);
+		}
+		elsif ($extraChildTag =~ m{layer|block|package|collection|component})
+		{
+			# Should be merged if there is another tag with the same "name" attribute
+			# Look for a namesake in the base
+			$mergeIt = matchTag($baseTree->{Kids}, $extraChild, "name");
+		}
+
+		if ($mergeIt)
+		{
+			# Merge children
+			mergeTrees($mergeIt, $extraChild);
+		}
+		else
+		{
+			# Add this child
+			push @{$baseTree->{Kids}}, $extraChild;
+		}
+	}
+}
+
+sub matchTag
+{
+	my $peers = shift;
+	my $outsider = shift;
+	my $attr = shift;
+
+	foreach my $peer (@$peers)
+	{
+		if (ref $peer eq ref $outsider && (!defined $attr || $peer->{$attr} eq $outsider->{$attr}))
+		{
+			return $peer;
+		}
+	}
+	
+	return undef;
+}
+
+sub printTree
+{
+	my $tree = shift or die;
+	die unless ref $tree;
+
+	my $tagName = ref $tree;
+	$tagName =~ s{^main::}{};
+	if ($tagName eq "Characters")
+	{
+		print $tree->{Text};
+		return;
+	}
+	
+	print "<$tagName";
+
+	foreach my $attr (
+		sort {
+			my $order = "name long-name tech_domain level span schema levels filter introduced deprecated purpose class plugin origin-model bldFile mrp version priority";
+			my $ixA = index $order, $a;
+			my $ixB = index $order, $b;
+			die "$a $b" if $ixA + $ixB == -2;
+			$ixA - $ixB;
+		}
+		grep {
+			! ref $tree->{$_}
+		}
+		keys %$tree)
+	{
+		print " $attr=\"$tree->{$attr}\"";
+	}
+
+	my $children = $tree->{Kids};
+	if (scalar @$children)
+	{
+		print ">";
+		foreach my $child (@$children)
+		{
+			printTree($child);
+		}
+		print "</$tagName";
+	}
+	else
+	{
+		print "/"
+	}
+
+	print ">";
+}
+
--- a/common/tools/raptor/RaptorCommon.pm	Fri Aug 14 11:06:38 2009 +0100
+++ b/common/tools/raptor/RaptorCommon.pm	Fri Aug 14 12:08:05 2009 +0100
@@ -19,9 +19,26 @@
 our $CATEGORY_RAPTORERROR = 'raptor_error';
 our $CATEGORY_RAPTORERROR_CANNOTPROCESSSCHEMAVERSION = 'cannot_process_schema_version';
 our $CATEGORY_RAPTORERROR_NOBLDINFFOUND = 'no_bld_inf_found';
+our $CATEGORY_RAPTORERROR_CANTFINDMMPFILE = 'cant_find_mmp_file';
+our $CATEGORY_RAPTORERROR_MAKEEXITEDWITHERRORS = 'make_exited_with_errors';
+our $CATEGORY_RAPTORERROR_TOOLDIDNOTRETURNVERSION = 'tool_didnot_return_version';
 
 our $SEVERITY_UNKNOWN = 'unknown';
 our $SEVERITY_CRITICAL = 'critical';
+our $SEVERITY_MAJOR = 'major';
+our $SEVERITY_NORMAL = 'normal';
+our $SEVERITY_MINOR = 'minor';
+
+sub init
+{
+	my $filename = "$::basedir/summary.csv";
+	if (!-f$filename)
+	{
+		print "Writing summary file $filename\n";
+		open(SUMMARY, ">$filename");
+		close(SUMMARY);
+	}
+}
 
 sub dump_fault
 {
--- a/common/tools/raptor/RaptorError.pm	Fri Aug 14 11:06:38 2009 +0100
+++ b/common/tools/raptor/RaptorError.pm	Fri Aug 14 12:08:05 2009 +0100
@@ -27,6 +27,7 @@
 
 $buildlog_status->{name} = 'buildlog_status';
 $buildlog_status->{next_status} = {error=>$buildlog_error_status};
+$buildlog_status->{on_start} = 'RaptorError::on_start_buildlog';
 
 $buildlog_error_status->{name} = 'buildlog_error_status';
 $buildlog_error_status->{next_status} = {};
@@ -54,22 +55,51 @@
 	}
 	elsif ($text =~ m,No bld\.inf found at,)
 	{
+		$severity = $RaptorCommon::SEVERITY_MAJOR;
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_NOBLDINFFOUND;
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
+	}
+	elsif ($text =~ m,Can't find mmp file,)
+	{
+		$severity = $RaptorCommon::SEVERITY_NORMAL;
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_CANTFINDMMPFILE;
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
+	}
+	elsif ($text =~ m,The make-engine exited with errors,)
+	{
 		$severity = $RaptorCommon::SEVERITY_CRITICAL;
-		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_NOBLDINFFOUND;
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_MAKEEXITEDWITHERRORS;
+		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
+	}
+	elsif ($text =~ m,tool .* from config .* did not return version .* as required,)
+	{
+		$severity = $RaptorCommon::SEVERITY_CRITICAL;
+		my $subcategory = $RaptorCommon::CATEGORY_RAPTORERROR_TOOLDIDNOTRETURNVERSION;
 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
 	}
 	else # log everything by default
 	{
-		$severity = $RaptorCommon::SEVERITY_UNKNOWN;
+		$severity = $RaptorCommon::SEVERITY_NORMAL;
 		my $subcategory = '';
 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
 	}
 }
 
+sub on_start_buildlog
+{
+	RaptorCommon::init();
+	
+	$filename = "$::basedir/errors.txt";
+	if (!-f$filename)
+	{
+		print "Writing error file $filename\n";
+		open(FILE, ">$filename");
+		close(FILE);
+	}
+}
+
 sub on_start_buildlog_error
 {
-	$filename = "$::basedir/errors.txt";
-	print "Writing error file $filename\n" if (!-f$filename);
 	open(FILE, ">>$filename");
 }
 
--- a/common/tools/raptor/RaptorReleaseable.pm	Fri Aug 14 11:06:38 2009 +0100
+++ b/common/tools/raptor/RaptorReleaseable.pm	Fri Aug 14 12:08:05 2009 +0100
@@ -35,6 +35,7 @@
 
 $buildlog_status->{name} = 'buildlog_status';
 $buildlog_status->{next_status} = {whatlog=>$whatlog_status};
+$buildlog_status->{on_start} = 'RaptorReleaseable::on_start_buildlog';
 
 $whatlog_status->{name} = 'whatlog_status';
 $whatlog_status->{next_status} = {bitmap=>$bitmap_status, resource=>$resource_status, build=>$build_status, export=>$export_status, stringtable=>$stringtable_status, archive=>$archive_status, '?default?'=>$whatlog_default_status};
@@ -88,6 +89,11 @@
 my $curfiletype = 'unknown';
 my $characters = '';
 
+sub on_start_buildlog
+{
+	mkdir("$::basedir/releaseables");
+}
+
 sub on_start_whatlog
 {
 	my ($el) = @_;
@@ -223,7 +229,6 @@
 			my $layer = $1;
 			my $package = $2;
 			
-			mkdir("$::basedir/releaseables");
 			mkdir("$::basedir/releaseables/$layer");
 			mkdir("$::basedir/releaseables/$layer/$package");
 			
--- a/sf-package/build.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/sf-package/build.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -13,6 +13,15 @@
   <import file="${sf.package.config.dir}/package_refs.ant.xml" />
   
   <target name="sf-compile">
+  
+    <!-- Check that package_definition is not in v 3.0.0 otherwise transforms it to 2.0.1 -->
+    <echo message="Check that model file is in a version usable by Raptor"/>
+    <exec executable="perl" dir="${sf.common.config.dir}/sysdefdowngrade" failonerror="false" output="${build.log.dir}/sysdefdowngrade.log">
+      <arg value="sysdefdowngrade.pl"/>
+      <arg value="--model=${build.drive}/${sf.spec.systemdefinition.location}"/>
+      <arg value="--sources=${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+    </exec>
+    
     <runtarget target="sf-package-compile"/>
   </target>
   
@@ -21,72 +30,127 @@
     <hlm:sbsMakeOptions engine="gmake" id="sbs.fullbuild.options"/>
     <hlm:sbsMakeOptions engine="gmake" id="sbs.toolsbuild.options"/>
     
-    <!-- CLEAN -->
-    <hlm:argSet id="sbs.main.clean.sbs.var">
-      <hlm:arg name="config" value="${sf.spec.sbs.config}" />
+    <!-- BUILD tools2_rel CLEAN -->
+    <!--
+    <hlm:argSet id="sbs.tools2_rel.clean.var">
+      <hlm:arg name="config" value="tools2_rel" />
+      <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}"/>
+      <hlm:arg name="command" value="CLEAN"/>
+    </hlm:argSet>
+    <antcall target="compile-main" inheritAll="false" inheritRefs="true">
+      <param name="build.system" value="${sf.spec.build.system}" />
+      <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
+      <reference refid="sbs.tools2_rel.clean.var" torefid="sbs.var" />
+      <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
+      <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
+    </antcall>
+    -->
+    
+    <!-- BUILD tools2_rel -->
+    <hlm:argSet id="sbs.tools2_rel.var">
+      <hlm:arg name="config" value="tools2_rel.whatlog" />
       <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
-      <hlm:arg name="command" value="CLEAN" />
     </hlm:argSet>
     <antcall target="compile-main" inheritAll="false" inheritRefs="true">
       <param name="build.system" value="${sf.spec.build.system}" />
-      <!-- param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" / -->
       <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
-      <!-- param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/ -->
-      <reference refid="sbs.main.clean.sbs.var" torefid="sbs.var" />
-      <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
+      <reference refid="sbs.tools2_rel.var" torefid="sbs.var" />
+      <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
       <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
     </antcall>
     
-    <!-- BUILD tools2 -->
-    <hlm:argSet id="sbs.tools2.var">
-      <hlm:arg name="config" value="tools2_rel" />
-      <hlm:arg name="singlejob" value="false" />
+    <!-- BUILD tools CLEAN -->
+    <!-- 
+    <hlm:argSet id="sbs.tools.clean.var">
+      <hlm:arg name="config" value="tools"/>
+      <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
+      <hlm:arg name="command" value="CLEAN"/>
+    </hlm:argSet>
+    <antcall target="compile-main" inheritAll="false" inheritRefs="true">
+      <param name="build.system" value="${sf.spec.build.system}" />
+      <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
+      <reference refid="sbs.tools.clean.var" torefid="sbs.var" />
+      <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
+      <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
+    </antcall>
+    -->
+    
+    <!-- BUILD tools -->
+    <!-- 
+    <hlm:argSet id="sbs.tools.var">
+      <hlm:arg name="config" value="tools.whatlog"/>
       <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
     </hlm:argSet>
     <antcall target="compile-main" inheritAll="false" inheritRefs="true">
       <param name="build.system" value="${sf.spec.build.system}" />
-      <!-- param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" / -->
       <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
-      <!-- param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/ -->
-      <reference refid="sbs.tools2.var" torefid="sbs.var" />
+      <reference refid="sbs.tools.var" torefid="sbs.var" />
       <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
       <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
     </antcall>
+    -->
     
-    <!-- BUILD tools -->
-    <hlm:argSet id="sbs.tools.var">
-      <hlm:arg name="config" value="tools_rel" />
-      <hlm:arg name="singlejob" value="true" />
+    <!-- BUILD winscw CLEAN -->
+    <!--
+    <hlm:argSet id="sbs.winscw.clean.var">
+      <hlm:arg name="config" value="winscw" />
+      <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
+      <hlm:arg name="command" value="CLEAN"/>
+    </hlm:argSet>
+    <antcall target="compile-main" inheritAll="false" inheritRefs="true">
+      <param name="build.system" value="${sf.spec.build.system}" />
+      <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
+      <reference refid="sbs.winscw.clean.var" torefid="sbs.var" />
+      <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
+      <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
+    </antcall>
+    -->
+    
+    <!-- BUILD winscw -->
+    <hlm:argSet id="sbs.winscw.var">
+      <hlm:arg name="config" value="winscw.whatlog" />
       <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
     </hlm:argSet>
     <antcall target="compile-main" inheritAll="false" inheritRefs="true">
       <param name="build.system" value="${sf.spec.build.system}" />
-      <!-- param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" / -->
       <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
-      <!-- param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/ -->
-      <reference refid="sbs.tools.var" torefid="sbs.var" />
-      <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
+      <reference refid="sbs.winscw.var" torefid="sbs.var" />
+      <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
       <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
     </antcall>
     
-    <!-- BUILD -->
-    <hlm:argSet id="sbs.main.sbs.var">
-      <hlm:arg name="config" value="${sf.spec.sbs.config}.whatlog" />
+    <!-- BUILD armv5 CLEAN -->
+    <!--
+    <hlm:argSet id="sbs.armv5.clean.var">
+      <hlm:arg name="config" value="armv5" />
+      <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
+      <hlm:arg name="command" value="CLEAN"/>
+    </hlm:argSet>
+    <antcall target="compile-main" inheritAll="false" inheritRefs="true">
+      <param name="build.system" value="${sf.spec.build.system}" />
+      <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
+      <reference refid="sbs.armv5.clean.var" torefid="sbs.var" />
+      <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
+      <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
+    </antcall>
+    -->
+    
+    <!-- BUILD armv5 -->
+    <hlm:argSet id="sbs.armv5.var">
+      <hlm:arg name="config" value="armv5.whatlog" />
       <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
     </hlm:argSet>
     <antcall target="compile-main" inheritAll="false" inheritRefs="true">
       <param name="build.system" value="${sf.spec.build.system}" />
-      <!-- param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" / -->
       <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
-      <!-- param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/ -->
-      <reference refid="sbs.main.sbs.var" torefid="sbs.var" />
+      <reference refid="sbs.armv5.var" torefid="sbs.var" />
       <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
       <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
     </antcall>
     
     <!-- CHECK -->
     <exec executable="cmd" dir="${build.drive}/" output="${build.drive}/output\logs\build_check_compile.log">
-      <arg value="/c sbs.bat -s ${build.drive}/output\build\canonical_system_definition_SF.xml -k -c ${sf.spec.sbs.config} -j 32 --check -m ${build.drive}/output\logs\build_check_Makefile"/>
+      <arg value="/c sbs.bat -s ${build.drive}/output\build\canonical_system_definition_SF.xml -k -c tools2_rel -c winscw -c armv5 -j 32 --check -m ${build.drive}/output\logs\build_check_Makefile"/>
       <!-- argument of -j option can be parameterized with: ${number.of.threads} -->
     </exec>
     
--- a/sf-package/package_props.ant.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/sf-package/package_props.ant.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -4,7 +4,7 @@
   
   <property name="sf.spec.baseline.enable" value="true"/>
   <property name="sf.spec.baseline.select" value="location"/>
-  <property name="sf.spec.baseline.location" value="\\bishare\Releases\PDK_candidate_2.0.c_flat"/>
+  <property name="sf.spec.baseline.location" value="\\bishare\Releases\PDK_candidate_2.0.d_flat"/>
   <property name="sf.spec.baseline.getenv_options" value="-i emu -i rnd -i tools -i info"/>
   
   <property name="sf.spec.toolsbaseline.enable" value="false"/>
@@ -12,6 +12,10 @@
   <property name="sf.spec.build.clean.enable" value="true"/>
   
   <property name="sf.spec.systemdefinition.assemble" value="false"/>
+  <!-- if this is defined then the model is taken from this location (relative to the project dir) and copied to BUILDDRIVE\definition.xml -->
+<!--  <property name="sf.spec.systemdefinition.source" value="package_definition.xml"/> -->
+  <!-- location of the model (related to the build drive) -->
+  <property name="sf.spec.systemdefinition.location" value="\definition.xml"/>
   <property name="sf.spec.sysdef.configurations.list" value="SF"/>
   
   <property name="sf.spec.sbs.config" value="winscw"/>
--- a/sf-package/package_refs.ant.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/sf-package/package_refs.ant.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -4,8 +4,8 @@
 
   <path id="sf.spec.system.definition.files">
     <fileset dir="${sf.spec.job.drive}/" casesensitive="false">
-      <include name="${sf.spec.systemdefinition.location}" />
+      <include name="${sf.spec.systemdefinition.location}"/>
     </fileset>
   </path>
-
-  </project>
\ No newline at end of file
+  
+</project>
\ No newline at end of file
--- a/sf-platform/build.xml	Fri Aug 14 11:06:38 2009 +0100
+++ b/sf-platform/build.xml	Fri Aug 14 12:08:05 2009 +0100
@@ -8,81 +8,47 @@
    -->
 
   <!-- workaround until GenXML can merge v2.0.0 fragments -->
-  <target name="create-canonical-sysdef-file">
-
-    <runtarget target="preprocess-sysdef-files"/>
-    <echo message="Exporting preprocessed System Definition"/>
-    <if><istrue value="${sf.spec.splitbuild}"/>
-       <then>
-       <if><istrue value="${sf.spec.os.skipbuild}" />
-            <then><echo message="Skipping OS sysdef creation"/></then>
-       <else>
-            <!-- TODO use better method to export or wait for GenXML fix?-->
-            <copy file="${build.output.dir}\build\input\0000000000000001_system_model_os.xml"
-            tofile="${canonical.sysdef.file}" failonerror="false" verbose="true"/>
-       </else>
-       </if>
+  <!--
+    This target is effectively a callback, called from compile-main.
+    Its responsibility is to convert the set of peices in ref "system.definition.files" into one sys def with absolute paths
 
-       <if><istrue value="${sf.spec.s60.skipbuild}" />
-            <then><echo message="Skipping S60 sysdef creation"/></then>
-       <else>
-            <!-- TODO use better method to export or wait for GenXML fix?-->
-            <copy file="${build.output.dir}\build\input\0000000000000001_system_model_s60.xml"
-            tofile="${canonical.sysdef.file}" failonerror="false" verbose="true"/>
-	   </else>
-	   </if>
-	   </then>
-	
-	<else>
-	    <!-- TODO use better method to export or wait for GenXML fix?-->
-        <copy file="${build.output.dir}\build\input\0000000000000001_system_model.xml"
-        tofile="${canonical.sysdef.file}" failonerror="false" verbose="true"/>
-
-	</else>
-        </if>
-
-  </target>
+    However, in our builds, we know that there will only be one sysdef peice passed in, so that makes things a lot simpler
+  -->
+  <target name="create-canonical-sysdef-file">
+    <fail message="Symbian builds create a canonical system definition from exactly one peice">
+      <condition>
+        <resourcecount refid="system.definition.files" when="ne" count="1"/>
+      </condition>
+    </fail>
 
-  <!--
-    == Name: PREPROCESS-SYSDEF-FILES
-    ==
-    == Desc: Override of default target in order to deal with symbian os
-    ==       system_definition.xml that does not have /sf source prefix
-    ==
-    ==       TODO get this moved as a Helium core target?
-    -->
-  <target name="preprocess-sysdef-files">
-        <mkdir dir="${build.output.dir}/build/input"/>
-        <delete verbose="true">
-            <fileset dir="${build.output.dir}/build/input/" includes="**"/>
-        </delete>
+    <!-- Locate the first/only item referenced -->
+    <for param="file">
+      <resources refid="system.definition.files"/>
+      <sequential>
+        <echo message="@{file}"/>
+        <!-- Once a property is set, it stays set - bingo! -->
+        <property name="sf.first.system.definition" value="@{file}"/>
+      </sequential>
+    </for>
 
-        <for param="file">
-            <resources refid="system.definition.files"/>
-            <sequential>
-                <copy todir="${build.output.dir}/build/input" verbose="true">
-                    <fileset file="@{file}"/>
-                    <filterchain>
-                        <replaceregex pattern="bldFile=&quot;os" replace="bldFile=&quot;sf\\\\os" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;os" replace="mrp=&quot;sf\\\\os" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;mw" replace="bldFile=&quot;sf\\\\mw" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;mw" replace="mrp=&quot;sf\\\\mw" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;app" replace="bldFile=&quot;sf\\\\app" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;app" replace="mrp=&quot;sf\\\\app" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;tools" replace="bldFile=&quot;sf\\\\tools" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;tools" replace="mrp=&quot;sf\\\\tools" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;adaptation" replace="bldFile=&quot;sf\\\\adaptation" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;adaptation" replace="mrp=&quot;sf\\\\adaptation" flags="gi"/>
-                        
-                        <expandproperties/>
-                    </filterchain>
-                    <mapper>
-                        <scriptmapper language="jep" src="${helium.dir}/tools/common/jep/unique_filename.jep"/>
-                    </mapper>
-                </copy>
-            </sequential>
-        </for>
-    </target>
+    <!-- Having located the file, copy it to the final desired location, absoluting tha paths as we go -->
+    <copy tofile="${canonical.sysdef.file}" file="${sf.first.system.definition}" overwrite="true" verbose="true">
+      <filterchain>
+        <replaceregex pattern="bldFile=&quot;os" replace="bldFile=&quot;/sf/os" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;os" replace="mrp=&quot;/sf/os" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;mw" replace="bldFile=&quot;/sf/mw" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;mw" replace="mrp=&quot;/sf/mw" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;app" replace="bldFile=&quot;/sf/app" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;app" replace="mrp=&quot;/sf/app" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;tools" replace="bldFile=&quot;/sf/tools" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;tools" replace="mrp=&quot;/sf/tools" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;adaptation" replace="bldFile=&quot;/sf/adaptation" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;adaptation" replace="mrp=&quot;/sf/adaptation" flags="gi"/>
+        <expandproperties/>
+      </filterchain>
+    </copy>
+
+ </target>
 
   <!--
     == Name: SF-COMPILE