15 <#assign count = 0 /> |
15 <#assign count = 0 /> |
16 |
16 |
17 <#list data as csv_file> |
17 <#list data as csv_file> |
18 <#list csv_file as pkg_detail> |
18 <#list csv_file as pkg_detail> |
19 <target name="sf-prebuild-${count}"> |
19 <target name="sf-prebuild-${count}"> |
20 |
20 |
21 <!-- if defined the revision override take that as revision and change the url to point to FCL --> |
21 <!-- if defined the revision override take that as revision and change the url to point to FCL --> |
22 <if> |
22 <if> |
23 <not><equals arg1="${ant['sf.spec.sources.revision']}" arg2="" trim="true"/></not> |
23 <not><equals arg1="${ant['sf.spec.sources.revision']}" arg2="" trim="true"/></not> |
24 <then> |
24 <then> |
25 <property name="sources.${count}.revision" value="${ant['sf.spec.sources.revision']}"/> |
25 <property name="sources.${count}.revision" value="${ant['sf.spec.sources.revision']}"/> |
26 <propertyregex property="sources.${count}.URL" input="${pkg_detail.source}" regexp="/MCL/" casesensitive="false" replace="/FCL/" defaultValue="${pkg_detail.source}"/> |
26 <propertyregex property="sources.${count}.URL" input="${pkg_detail.source}" regexp="/MCL/" casesensitive="false" replace="/FCL/" defaultValue="${pkg_detail.source}"/> |
27 </then> |
27 </then> |
28 <else> |
28 <else> |
29 <property name="sources.${count}.revision" value="${pkg_detail.pattern}"/> |
29 <property name="sources.${count}.revision" value="${pkg_detail.pattern}"/> |
30 <property name="sources.${count}.URL" value="${pkg_detail.source}"/> |
30 <property name="sources.${count}.URL" value="${pkg_detail.source}"/> |
31 </else> |
31 </else> |
32 </if> |
32 </if> |
33 |
33 |
34 <!-- Create sf\layer dir on build dir --> |
34 <!-- Create sf\layer dir on build dir --> |
35 <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/> |
35 <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/> |
36 <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true" /> |
36 <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true" /> |
37 |
37 |
43 <propertyregex property="sf.spec.sourcesync.cachelocation.${count}" input="${dollar}{sources.${count}.URL}" regexp="^${ant['sf.spec.sourcesync.local.development.area']}/" casesensitive="false" replace="${dollar}{sf.spec.sourcesync.cachelocation.for.regex}/LocalDev/"/> |
43 <propertyregex property="sf.spec.sourcesync.cachelocation.${count}" input="${dollar}{sources.${count}.URL}" regexp="^${ant['sf.spec.sourcesync.local.development.area']}/" casesensitive="false" replace="${dollar}{sf.spec.sourcesync.cachelocation.for.regex}/LocalDev/"/> |
44 </then> |
44 </then> |
45 </if> |
45 </if> |
46 |
46 |
47 <!-- Convert source tag/branch to to changeset hash, in case it's a local tag on the server --> |
47 <!-- Convert source tag/branch to to changeset hash, in case it's a local tag on the server --> |
48 <retry tries="10" uniquename="${count}"> |
48 <retry tries="10" uniquename="${count}" failonerror="false"> |
49 <sequential> |
49 <sequential> |
50 <exec executable="hg" failonerror="true" output="${ant['temp.build.dir']}/sf.sourcesync.${count}.checksum" error="nul:"> |
50 <exec executable="hg" failonerror="true" output="${ant['temp.build.dir']}/sf.sourcesync.${count}.checksum" error="nul:"> |
51 <arg value="id"/> |
51 <arg value="id"/> |
52 <arg value="${dollar}{sources.${count}.URL}"/> |
52 <arg value="${dollar}{sources.${count}.URL}"/> |
53 <arg value="-r"/> |
53 <arg value="-r"/> |
102 <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
103 <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
103 </then> |
104 </then> |
104 </if> |
105 </if> |
105 </forget> |
106 </forget> |
106 <!-- In the meantime, by-pass it for this build --> |
107 <!-- In the meantime, by-pass it for this build --> |
107 <retry tries="30" uniquename="${count}"> |
108 <retry tries="30" uniquename="${count}" failonerror="false"> |
108 <sequential> |
109 <sequential> |
109 <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/> |
110 <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/> |
110 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true"> |
111 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true"> |
111 <arg value="clone"/> |
112 <arg value="clone"/> |
112 <arg value="-U"/> |
113 <arg value="-U"/> |
113 <arg value="${dollar}{sources.${count}.URL}"/> |
114 <arg value="${dollar}{sources.${count}.URL}"/> |
114 <arg value="${ant['build.drive']}${pkg_detail.dst}"/> |
115 <arg value="${ant['build.drive']}${pkg_detail.dst}"/> |
115 </exec> |
116 </exec> |
|
117 <property name="sf.spec.sourcesync.cache.clone.succeeded.${count}" value="1"/> |
116 </sequential> |
118 </sequential> |
117 <cleanup> |
119 <cleanup> |
118 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/> |
120 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/> |
119 </cleanup> |
121 </cleanup> |
120 </retry> |
122 </retry> |
|
123 <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}"/> |
121 </else> |
124 </else> |
122 </if> |
125 </if> |
123 <!-- Update to required revision --> |
126 <!-- Update to required revision --> |
124 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true"> |
127 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true"> |
125 <arg value="update"/> |
128 <arg value="update"/> |
127 <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/> |
130 <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/> |
128 </exec> |
131 </exec> |
129 </then> |
132 </then> |
130 <else> |
133 <else> |
131 <!-- Package not in cache, or cache not in use --> |
134 <!-- Package not in cache, or cache not in use --> |
132 <retry tries="10" uniquename="${count}"> |
135 <retry tries="10" uniquename="${count}" failonerror="false"> |
133 <sequential> |
136 <sequential> |
134 <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/> |
137 <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/> |
135 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true"> |
138 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true"> |
136 <arg value="clone"/> |
139 <arg value="clone"/> |
137 <arg value="-U"/> |
140 <arg value="-U"/> |
138 <arg value="${dollar}{sources.${count}.URL}"/> |
141 <arg value="${dollar}{sources.${count}.URL}"/> |
139 <arg value="${ant['build.drive']}${pkg_detail.dst}"/> |
142 <arg value="${ant['build.drive']}${pkg_detail.dst}"/> |
140 </exec> |
143 </exec> |
|
144 <property name="sf.spec.sourcesync.cache.clone.succeeded.${count}" value="1"/> |
141 </sequential> |
145 </sequential> |
142 <cleanup> |
146 <cleanup> |
143 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/> |
147 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/> |
144 </cleanup> |
148 </cleanup> |
145 </retry> |
149 </retry> |
|
150 <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}"/> |
146 <!-- Update to required version --> |
151 <!-- Update to required version --> |
147 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true"> |
152 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true"> |
148 <arg value="update"/> |
153 <arg value="update"/> |
149 <arg value="-r"/> |
154 <arg value="-r"/> |
150 <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/> |
155 <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/> |
151 </exec> |
156 </exec> |
152 <if> |
157 <if> |
153 <isset property="sf.spec.sourcesync.cachelocation.${count}"/> |
158 <isset property="sf.spec.sourcesync.cachelocation.${count}"/> |
154 <then> |
159 <then> |
|
160 <!-- Init cache --> |
|
161 <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
|
162 <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" /> |
|
163 <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
|
164 <!-- Initialise an empty repo --> |
|
165 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false"> |
|
166 <arg value="init"/> |
|
167 <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
|
168 </exec> |
|
169 <!-- Configure the paths and the speed-up flag on the cache repo --> |
|
170 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="false" message="[paths]${dollar}{line.separator}"/> |
|
171 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="default = ${dollar}{sources.${count}.URL}${dollar}{line.separator}"/> |
|
172 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="${dollar}{line.separator}"/> |
|
173 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="[server]${dollar}{line.separator}"/> |
|
174 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="uncompressed=True${dollar}{line.separator}"/> |
|
175 <echo message="(Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background)"/> |
155 <forget> |
176 <forget> |
156 <nice newpriority="1"/> |
177 <nice newpriority="1"/> |
157 <!-- Init cache --> |
|
158 <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
|
159 <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" /> |
|
160 <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
|
161 <!-- Clone source to get the right default repo --> |
|
162 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false"> |
|
163 <arg value="clone"/> |
|
164 <arg value="-r"/> |
|
165 <arg value="null"/> |
|
166 <arg value="${dollar}{sources.${count}.URL}"/> |
|
167 <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
|
168 </exec> |
|
169 <!-- Set the speed-up flag on the cache repo --> |
|
170 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="${dollar}{line.separator}"/> |
|
171 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="[server]${dollar}{line.separator}"/> |
|
172 <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="uncompressed=True${dollar}{line.separator}"/> |
|
173 <echo message="Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background"/> |
|
174 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false"> |
178 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false"> |
175 <arg value="push"/> |
179 <arg value="push"/> |
176 <arg value="-f"/> |
180 <arg value="-f"/> |
177 <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
181 <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/> |
178 </exec> |
182 </exec> |