--- a/common/templates/source-spec.ant.xml.ftl Mon Feb 08 14:50:19 2010 +0000
+++ b/common/templates/source-spec.ant.xml.ftl Tue Feb 09 17:49:27 2010 +0000
@@ -7,84 +7,118 @@
<#assign change_list = "" />
<#assign dollar = "$"/>
<#assign count = 0 />
-<#if ("${ant['sf.spec.sourcesync.archive']}")?? && "${ant['sf.spec.sourcesync.archive']}" == "true">
- <#assign fast_sync = true />
-<#else>
- <#assign fast_sync = false />
-</#if>
-<#if ("${ant['sf.spec.sourcesync.bug419']}")?? && "${ant['sf.spec.sourcesync.bug419']}" == "true">
- <#assign bug419 = true />
-<#else>
- <#assign bug419 = false />
-</#if>
<#list data as csv_file>
<#list csv_file as pkg_detail>
<target name="sf-prebuild-${count}">
- <sequential>
- <!-- create sf\layer dir -->
- <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
- <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false" />
- <!-- Don't use hg archive with tags, as we can have wildcards in the tags... -->
- <#if fast_sync && ("${pkg_detail.type}"!="tag") >
- <!-- Identify the version on the cache first -->
- <exec executable="hg" dir="${pkg_detail.source}" outputproperty="sf.sourcesync.${count}.checksum">
- <arg value="identify"/>
- <arg value="-i"/>
- <arg value="-r"/>
- <arg value="${pkg_detail.pattern}"/>
- </exec>
- <!-- hg archive on the version we found -->
- <exec executable="hg" dir="${pkg_detail.source}">
- <arg value="archive"/>
- <arg value="-r"/>
- <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
- <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
- </exec>
- <#else>
- <exec executable="hg" dir="${ant['build.drive']}/">
- <arg value="clone"/>
- <arg value="-U"/>
- <arg value="${pkg_detail.source}"/>
- <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
- </exec>
-
- <#if bug419 >
- <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
- <arg value="identify"/>
- <arg value="-i"/>
- <arg value="-r"/>
- <arg value="${pkg_detail.pattern}"/>
- </exec>
- <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}">
- <arg value="update"/>
- <arg value="-r"/>
- <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
- </exec>
- <#else>
- <hlm:scm verbose="true" scmUrl="scm:hg:${pkg_detail.source}">
- <!--hlm:checkout basedir="${ant['build.drive']}${pkg_detail.dst}"/-->
- <#if "${pkg_detail.type}"=="tag" >
- <hlm:tags basedir="${ant['build.drive']}${pkg_detail.dst}" reference="hg.tags.id${dollar}{refid}"/>
- <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
- <hlm:latestTag pattern="${pkg_detail.pattern}">
- <hlm:tagSet refid="hg.tags.id${dollar}{refid}" />
- </hlm:latestTag>
- </hlm:update>
- </#if>
- <#if "${pkg_detail.type}"== "changeset" || "${pkg_detail.type}"=="branch">
- <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
- <hlm:tag name="${pkg_detail.pattern}"/>
- </hlm:update>
- </#if>
- </hlm:scm>
- </#if>
+
+ <!-- Create sf\layer dir on build dir -->
+ <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
+ <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true" />
+
+ <if>
+ <istrue value="${dollar}{sf.spec.sourcesync.usecache}"/>
+ <then>
+ <!-- Work out cache location from source location -->
+ <propertyregex property="sf.spec.sourcesync.cachelocation.${count}" input="${pkg_detail.source}" regexp="^http://developer.symbian.org/" casesensitive="false" replace="${dollar}{sf.spec.sourcesync.cachelocation}/Live/"/>
+ <propertyregex property="sf.spec.sourcesync.cachelocation.${count}" input="${pkg_detail.source}" regexp="^${ant['sf.spec.sourcesync.local.development.area']}/" casesensitive="false" replace="${dollar}{sf.spec.sourcesync.cachelocation}/LocalDev/"/>
+ </then>
+ </if>
+
+ <if>
+ <and>
+ <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
+ <available file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" type="dir"/>
+ </and>
+ <then>
+ <!-- Package in cache already -->
+ <!-- Clone null revision from source to get the right default repo -->
+ <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
+ <arg value="clone"/>
+ <arg value="-r"/>
+ <arg value="null"/>
+ <arg value="${pkg_detail.source}"/>
+ <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
+ </exec>
+ <echo message="Pull from ${dollar}{sf.spec.sourcesync.cachelocation.${count}} to ${ant['build.drive']}${pkg_detail.dst}"/>
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}/" failonerror="true">
+ <arg value="pull"/>
+ <arg value="-f"/>
+ <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+ </exec>
+ <echo message="Pull from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
+ <arg value="pull"/>
+ <arg value="${pkg_detail.source}"/>
+ </exec>
+ <!-- Update to required revision -->
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
+ <arg value="update"/>
+ <arg value="-r"/>
+ <arg value="${pkg_detail.pattern}"/>
+ </exec>
+ <!-- Record the changeset selected, for the BOM -->
<exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
- <arg value="identify"/>
- <arg value="-i"/>
- </exec>
- </#if>
- </sequential>
+ <arg value="identify"/>
+ <arg value="-i"/>
+ </exec>
+ <forget>
+ <echo message="Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background"/>
+ <nice newpriority="1"/>
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false">
+ <arg value="push"/>
+ <arg value="-f"/>
+ <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+ </exec>
+ </forget>
+ </then>
+ <else>
+ <echo message="Clone from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
+ <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
+ <arg value="clone"/>
+ <arg value="-U"/>
+ <arg value="${pkg_detail.source}"/>
+ <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
+ </exec>
+ <!-- Update to required version -->
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
+ <arg value="update"/>
+ <arg value="-r"/>
+ <arg value="${pkg_detail.pattern}"/>
+ </exec>
+ <!-- Record the changeset selected, for the BOM -->
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
+ <arg value="identify"/>
+ <arg value="-i"/>
+ </exec>
+ <if>
+ <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
+ <then>
+ <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="${pkg_detail.source}"/>
+ <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+ </exec>
+ <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"/>
+ <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+ </exec>
+ </forget>
+ </then>
+ </if>
+ </else>
+ </if>
</target>
<target name="sf-bom-info-${count}">
@@ -103,11 +137,7 @@
</if>
<echo message="Writing BOM changes since ${dollar}{sf.previous.pdk.tag} for ${pkg_detail.dst}" />
<echo file="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true" message="${dollar}{line.separator}${pkg_detail.source}${dollar}{line.separator}${pkg_detail.dst}${dollar}{line.separator}${dollar}{line.separator}" />
- <#if fast_sync >
- <exec executable="hg" dir="${pkg_detail.source}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
- <#else>
- <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
- </#if>
+ <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
<arg value="log"/>
<arg value="-r"/>
<arg value="${dollar}{sf.sourcesync.${count}.checksum}:${dollar}{sf.previous.pdk.tag}"/>
@@ -132,7 +162,7 @@
</path>
<target name="all">
- <parallel threadsPerProcessor="1">
+ <parallel threadsPerProcessor="1" failonany="true">
${sync_list}
</parallel>