common/templates/source-spec.ant.xml.ftl
changeset 1206 4518bca1baf0
parent 1173 7659931b2194
child 1264 cdda4a9d1d16
--- a/common/templates/source-spec.ant.xml.ftl	Tue Aug 10 15:41:52 2010 +0100
+++ b/common/templates/source-spec.ant.xml.ftl	Tue Aug 10 18:11:17 2010 +0100
@@ -17,19 +17,19 @@
 <#list data as csv_file>
   <#list csv_file as pkg_detail>
     <target name="sf-prebuild-${count}">
-    	
-    	<!-- if defined the revision override take that as revision and change the url to point to FCL -->
-    	<if>
-    		<not><equals arg1="${ant['sf.spec.sources.revision']}" arg2="" trim="true"/></not>
-    		<then>
-    			<property name="sources.${count}.revision" value="${ant['sf.spec.sources.revision']}"/>
-    			<propertyregex property="sources.${count}.URL" input="${pkg_detail.source}" regexp="/MCL/" casesensitive="false" replace="/FCL/" defaultValue="${pkg_detail.source}"/>
-    		</then>
-    		<else>
-    			<property name="sources.${count}.revision" value="${pkg_detail.pattern}"/>
-    			<property name="sources.${count}.URL" value="${pkg_detail.source}"/>
-    		</else>
-    	</if>
+        
+        <!-- if defined the revision override take that as revision and change the url to point to FCL -->
+        <if>
+            <not><equals arg1="${ant['sf.spec.sources.revision']}" arg2="" trim="true"/></not>
+            <then>
+                <property name="sources.${count}.revision" value="${ant['sf.spec.sources.revision']}"/>
+                <propertyregex property="sources.${count}.URL" input="${pkg_detail.source}" regexp="/MCL/" casesensitive="false" replace="/FCL/" defaultValue="${pkg_detail.source}"/>
+            </then>
+            <else>
+                <property name="sources.${count}.revision" value="${pkg_detail.pattern}"/>
+                <property name="sources.${count}.URL" value="${pkg_detail.source}"/>
+            </else>
+        </if>
         
         <!-- Create sf\layer dir on build dir -->
         <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
@@ -45,7 +45,7 @@
         </if>
         
         <!-- Convert source tag/branch to to changeset hash, in case it's a local tag on the server -->
-        <retry tries="10" uniquename="${count}">
+        <retry tries="10" uniquename="${count}" failonerror="false">
             <sequential>
                 <exec executable="hg" failonerror="true" output="${ant['temp.build.dir']}/sf.sourcesync.${count}.checksum" error="nul:">
                     <arg value="id"/>
@@ -58,6 +58,7 @@
                 <propertyregex property="sf.sourcesync.${count}.checksum" override="true" input="${dollar}{sf.sourcesync.${count}.checksum}" regexp="(\S{12})" select="\1"/>
             </sequential>
         </retry>
+        <fail unless="sf.sourcesync.${count}.checksum" message="Failed to get changeset ID for revision '${dollar}{sources.${count}.revision}' for repo ${dollar}{sources.${count}.URL}"/>
 
         <if>
             <and>
@@ -104,7 +105,7 @@
                             </if>
                         </forget>
                         <!-- In the meantime, by-pass it for this build -->
-                        <retry tries="30" uniquename="${count}">
+                        <retry tries="30" uniquename="${count}" failonerror="false">
                             <sequential>
                                 <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                                 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
@@ -113,11 +114,13 @@
                                     <arg value="${dollar}{sources.${count}.URL}"/>
                                     <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
                                 </exec>
+                                <property name="sf.spec.sourcesync.cache.clone.succeeded.${count}" value="1"/>
                             </sequential>
                             <cleanup>
                                 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/>
                             </cleanup>
                         </retry>
+                        <fail unless="sf.spec.sourcesync.cache.clone.succeeded.${count}" message="ERROR: Failed to clone ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                     </else>
                 </if>
                 <!-- Update to required revision -->
@@ -129,7 +132,7 @@
             </then>
             <else>
                 <!-- Package not in cache, or cache not in use -->
-                <retry tries="10" uniquename="${count}">
+                <retry tries="10" uniquename="${count}" failonerror="false">
                     <sequential>
                         <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                         <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
@@ -138,11 +141,13 @@
                             <arg value="${dollar}{sources.${count}.URL}"/>
                             <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
                         </exec>
+                        <property name="sf.spec.sourcesync.cache.clone.succeeded.${count}" value="1"/>
                     </sequential>
                     <cleanup>
                         <delete dir="${ant['build.drive']}${pkg_detail.dst}"/>
                     </cleanup>
                 </retry>
+                <fail unless="sf.spec.sourcesync.cache.clone.succeeded.${count}" message="ERROR: Failed to clone ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                 <!-- Update to required version -->
                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
                     <arg value="update"/>
@@ -152,25 +157,24 @@
                 <if>
                     <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
                     <then>
+                        <!-- Init cache -->
+                        <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+                        <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" />
+                        <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+                        <!-- Initialise an empty repo -->
+                        <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false">
+                            <arg value="init"/>
+                            <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+                        </exec>
+                        <!-- Configure the paths and the speed-up flag on the cache repo -->
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="false" message="[paths]${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="default = ${dollar}{sources.${count}.URL}${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="[server]${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="uncompressed=True${dollar}{line.separator}"/>
+                        <echo message="(Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background)"/>
                         <forget>
                             <nice newpriority="1"/>
-                            <!-- Init cache -->
-                            <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
-                            <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" />
-                            <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
-                            <!-- Clone source to get the right default repo -->
-                            <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false">
-                                <arg value="clone"/>
-                                <arg value="-r"/>
-                                <arg value="null"/>
-                                <arg value="${dollar}{sources.${count}.URL}"/>
-                                <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
-                            </exec>
-                            <!-- Set the speed-up flag on the cache repo -->
-                            <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="${dollar}{line.separator}"/>
-                            <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="[server]${dollar}{line.separator}"/>
-                            <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="uncompressed=True${dollar}{line.separator}"/>
-                            <echo message="Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background"/>
                             <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false">
                                 <arg value="push"/>
                                 <arg value="-f"/>