Improved diagnostic output: when the build fails because a package cannot be cloned into the build drive, it says which package and the repo source and destination.
Improved caching logic, so that it doesn't depend on network availability as much.
Improved indentation.
--- 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"/>