common/templates/source-spec.ant.xml.ftl
changeset 977 293f16b1c667
parent 952 ea541face66b
child 1042 f505fa5486eb
equal deleted inserted replaced
976:50e351dfaafe 977:293f16b1c667
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2 <project name="SF-SOURCESPEC" default="all" xmlns:hlm="http://www.nokia.com/helium">
     2 <project name="SF-SOURCESPEC" default="all" xmlns:hlm="http://www.nokia.com/helium">
     3 
     3 
     4 <#assign dollar = "$"/>
     4 <#assign dollar = "$"/>
       
     5 
       
     6     <import file="${dollar}{sf.common.config.dir}/build.retry.xml"/>
     5 
     7 
     6     <!-- Convert \s in cache location, because otherwise they disappear entirely when used in a regex replacement! -->
     8     <!-- Convert \s in cache location, because otherwise they disappear entirely when used in a regex replacement! -->
     7     <propertyregex property="sf.spec.sourcesync.cachelocation.for.regex" input="${dollar}{sf.spec.sourcesync.cachelocation}" regexp="\\" replace="/" global="true" defaultValue="${dollar}{sf.spec.sourcesync.cachelocation}"/>
     9     <propertyregex property="sf.spec.sourcesync.cachelocation.for.regex" input="${dollar}{sf.spec.sourcesync.cachelocation}" regexp="\\" replace="/" global="true" defaultValue="${dollar}{sf.spec.sourcesync.cachelocation}"/>
     8 
    10 
     9 <#assign fileset = "" />
    11 <#assign fileset = "" />
    28                 <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.for.regex}/LocalDev/"/>
    30                 <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.for.regex}/LocalDev/"/>
    29             </then>
    31             </then>
    30         </if>
    32         </if>
    31         
    33         
    32         <!-- Convert source tag/branch to to changeset hash, in case it's a local tag on the server -->
    34         <!-- Convert source tag/branch to to changeset hash, in case it's a local tag on the server -->
    33         <exec executable="hg" outputproperty="sf.sourcesync.${count}.checksum">
    35         <retry tries="10" uniquename="${count}">
    34             <arg value="id"/>
    36             <sequential>
    35             <arg value="${pkg_detail.source}"/>
    37                 <exec executable="hg" failonerror="true" output="${ant['temp.build.dir']}/sf.sourcesync.${count}.checksum" error="nul:">
    36             <arg value="-r"/>
    38                     <arg value="id"/>
    37             <arg value="${pkg_detail.pattern}"/>
    39                     <arg value="${pkg_detail.source}"/>
    38             <arg value="-q"/>
    40                     <arg value="-r"/>
    39         </exec>
    41                     <arg value="${pkg_detail.pattern}"/>
    40         
    42                     <arg value="-q"/>
       
    43                 </exec>
       
    44                 <loadfile property="sf.sourcesync.${count}.checksum" srcFile="${ant['temp.build.dir']}/sf.sourcesync.${count}.checksum"/>
       
    45                 <propertyregex property="sf.sourcesync.${count}.checksum" override="true" input="${dollar}{sf.sourcesync.${count}.checksum}" regexp="(\S{12})" select="\1"/>
       
    46             </sequential>
       
    47         </retry>
       
    48 
    41         <if>
    49         <if>
    42             <and>
    50             <and>
    43                 <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
    51                 <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
    44                 <available file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" type="dir"/>
    52                 <available file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" type="dir"/>
    45             </and>
    53             </and>
    46             <then>
    54             <then>
    47                 <!-- Package in cache already -->
    55                 <!-- Package in cache already -->
    48                 <echo message="Pull from ${pkg_detail.source} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
    56                 <retry tries="3" uniquename="${count}" failonerror="0">
    49                 <exec executable="hg" dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="false" resultproperty="sf.spec.sourcesync.cache.pull.error.code.${count}">
    57                     <sequential>
    50                     <arg value="pull"/>
    58                         <echo message="Pull from ${pkg_detail.source} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
    51                     <arg value="${pkg_detail.source}"/>
    59                         <exec executable="hg" dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true">
    52                 </exec>
    60                             <arg value="pull"/>
       
    61                             <arg value="${pkg_detail.source}"/>
       
    62                         </exec>
       
    63                         <property name="sf.spec.sourcesync.cache.pull.succeeded.${count}" value="1"/>
       
    64                     </sequential>
       
    65                 </retry>
    53                 <if>
    66                 <if>
    54                     <equals arg1="0" arg2="${dollar}{sf.spec.sourcesync.cache.pull.error.code.${count}}"/>
    67                     <isset property="sf.spec.sourcesync.cache.pull.succeeded.${count}"/>
    55                     <then>
    68                     <then>
    56                         <echo message="Clone from ${dollar}{sf.spec.sourcesync.cachelocation.${count}} to ${ant['build.drive']}${pkg_detail.dst}"/>
    69                         <echo message="Clone from ${dollar}{sf.spec.sourcesync.cachelocation.${count}} to ${ant['build.drive']}${pkg_detail.dst}"/>
    57                         <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
    70                         <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
    58                             <arg value="clone"/>
    71                             <arg value="clone"/>
    59                             <arg value="-U"/>
    72                             <arg value="-U"/>
    76                                     <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
    89                                     <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
    77                                 </then>
    90                                 </then>
    78                             </if>
    91                             </if>
    79                         </forget>
    92                         </forget>
    80                         <!-- In the meantime, by-pass it for this build -->
    93                         <!-- In the meantime, by-pass it for this build -->
       
    94                         <retry tries="30" uniquename="${count}">
       
    95                             <sequential>
       
    96                                 <echo message="Clone from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
       
    97                                 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
       
    98                                     <arg value="clone"/>
       
    99                                     <arg value="-U"/>
       
   100                                     <arg value="${pkg_detail.source}"/>
       
   101                                     <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
       
   102                                 </exec>
       
   103                             </sequential>
       
   104                             <cleanup>
       
   105                                 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/>
       
   106                             </cleanup>
       
   107                         </retry>
       
   108                     </else>
       
   109                 </if>
       
   110                 <!-- Update to required revision -->
       
   111                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
       
   112                     <arg value="update"/>
       
   113                     <arg value="-r"/>
       
   114                     <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
       
   115                 </exec>
       
   116             </then>
       
   117             <else>
       
   118                 <!-- Package not in cache, or cache not in use -->
       
   119                 <retry tries="10" uniquename="${count}">
       
   120                     <sequential>
    81                         <echo message="Clone from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
   121                         <echo message="Clone from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
    82                         <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
   122                         <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
    83                             <arg value="clone"/>
   123                             <arg value="clone"/>
    84                             <arg value="-U"/>
   124                             <arg value="-U"/>
    85                             <arg value="${pkg_detail.source}"/>
   125                             <arg value="${pkg_detail.source}"/>
    86                             <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
   126                             <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    87                         </exec>
   127                         </exec>
    88                     </else>
   128                     </sequential>
    89                 </if>
   129                     <cleanup>
    90                 <!-- Update to required revision -->
   130                         <delete dir="${ant['build.drive']}${pkg_detail.dst}"/>
    91                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
   131                     </cleanup>
    92                     <arg value="update"/>
   132                 </retry>
    93                     <arg value="-r"/>
       
    94                     <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
       
    95                 </exec>
       
    96             </then>
       
    97             <else>
       
    98                 <echo message="Clone from ${pkg_detail.source} to ${ant['build.drive']}${pkg_detail.dst}"/>
       
    99                 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
       
   100                     <arg value="clone"/>
       
   101                     <arg value="-U"/>
       
   102                     <arg value="${pkg_detail.source}"/>
       
   103                     <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
       
   104                 </exec>
       
   105                 <!-- Update to required version -->
   133                 <!-- Update to required version -->
   106                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
   134                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
   107                     <arg value="update"/>
   135                     <arg value="update"/>
   108                     <arg value="-r"/>
   136                     <arg value="-r"/>
   109                     <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
   137                     <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>