| 814 |
mhunt |
1 |
package com.erggroup.buildtool.ripple;
|
|
|
2 |
|
|
|
3 |
import java.io.File;
|
|
|
4 |
|
|
|
5 |
import java.sql.SQLException;
|
|
|
6 |
|
|
|
7 |
import java.util.Iterator;
|
| 866 |
mhunt |
8 |
import java.util.ListIterator;
|
| 814 |
mhunt |
9 |
import java.util.Vector;
|
|
|
10 |
|
|
|
11 |
import org.apache.log4j.Logger;
|
|
|
12 |
|
| 830 |
mhunt |
13 |
import java.util.regex.PatternSyntaxException;
|
|
|
14 |
|
| 814 |
mhunt |
15 |
/**Plans release impact by generating a set of Strings containing build file content.
|
|
|
16 |
*/
|
|
|
17 |
public class RippleEngine
|
|
|
18 |
{
|
|
|
19 |
/**collection of gbemachtypes in String form associated with the baseline
|
|
|
20 |
* limited to the following items "win32", "sparc", "solaris10_sparc32", "solaris10_x86", "linux_i386"
|
|
|
21 |
* accessed by Package::isLinuxBuilt, isSolarisBuilt, isWin32Built
|
|
|
22 |
* @attribute
|
|
|
23 |
*/
|
| 864 |
mhunt |
24 |
Vector<String> mGbeMachtypeCollection = new Vector<String>();
|
| 866 |
mhunt |
25 |
|
| 814 |
mhunt |
26 |
/**configured mail server
|
|
|
27 |
* @attribute
|
|
|
28 |
*/
|
| 868 |
mhunt |
29 |
public String mMailServer = new String();
|
| 814 |
mhunt |
30 |
|
|
|
31 |
/**configured mail sender user
|
|
|
32 |
* @attribute
|
|
|
33 |
*/
|
| 868 |
mhunt |
34 |
public String mMailSender = new String();
|
| 814 |
mhunt |
35 |
|
| 868 |
mhunt |
36 |
/**configured global email target
|
|
|
37 |
* @attribute
|
|
|
38 |
*/
|
|
|
39 |
public String mGlobalTarget = new String();
|
|
|
40 |
|
| 814 |
mhunt |
41 |
/**name associated with the baseline
|
|
|
42 |
* @attribute
|
|
|
43 |
*/
|
| 868 |
mhunt |
44 |
public String mBaselineName = new String();
|
| 814 |
mhunt |
45 |
|
|
|
46 |
/**collection of released pv_ids associated with the release
|
|
|
47 |
* @attribute
|
|
|
48 |
*/
|
| 864 |
mhunt |
49 |
Vector<Integer> mReleasedPvIDCollection = new Vector<Integer>();
|
| 814 |
mhunt |
50 |
|
|
|
51 |
/**timestamp associated with build file generation
|
|
|
52 |
* @attribute
|
|
|
53 |
*/
|
|
|
54 |
long mTimestamp = 0;
|
|
|
55 |
|
|
|
56 |
/**set to "non generic", "generic" or "dummy" to indicate the nature of the package in the build file in daemon mode
|
|
|
57 |
* @attribute
|
|
|
58 |
*/
|
|
|
59 |
String mAddendum = new String("dummy");
|
|
|
60 |
|
| 866 |
mhunt |
61 |
/**collection of build exceptions associated with the baseline
|
|
|
62 |
/* used to determine (and report) what change in build exceptions happens as part of planRelease
|
|
|
63 |
* deamon centric
|
|
|
64 |
* @aggregation shared
|
|
|
65 |
* @attribute
|
|
|
66 |
*/
|
|
|
67 |
Vector<BuildExclusion> mBuildExclusionCollection = new Vector<BuildExclusion>();
|
|
|
68 |
|
| 814 |
mhunt |
69 |
/**Logger
|
|
|
70 |
* @attribute
|
|
|
71 |
*/
|
|
|
72 |
private static final Logger mLogger = Logger.getLogger(RippleEngine.class);
|
|
|
73 |
|
| 830 |
mhunt |
74 |
/**collection of escrow clearcase support file content in String form, set_up
|
| 814 |
mhunt |
75 |
* @attribute
|
|
|
76 |
*/
|
| 864 |
mhunt |
77 |
private Vector<String> mEscrowClearcaseSupportCollection = new Vector<String>();
|
| 814 |
mhunt |
78 |
|
|
|
79 |
/**package versions representing the baseline
|
| 866 |
mhunt |
80 |
* escrow centric
|
| 814 |
mhunt |
81 |
* @aggregation shared
|
|
|
82 |
* @attribute
|
|
|
83 |
*/
|
| 864 |
mhunt |
84 |
private Vector<Package> mPackageCollection = new Vector<Package>();
|
| 814 |
mhunt |
85 |
|
|
|
86 |
/**index to current String item
|
|
|
87 |
* @attribute
|
|
|
88 |
*/
|
|
|
89 |
private int mBuildIndex;
|
|
|
90 |
|
|
|
91 |
/**Database abstraction
|
|
|
92 |
* @attribute
|
|
|
93 |
*/
|
|
|
94 |
private ReleaseManager mReleaseManager;
|
|
|
95 |
|
|
|
96 |
/**Baseline identifier (rtag_id for a release manager baseline, bom_id for deployment manager baseline)
|
|
|
97 |
* @attribute
|
|
|
98 |
*/
|
|
|
99 |
private int mBaseline;
|
|
|
100 |
|
|
|
101 |
/**When true, mBuildCollection contains one item based on a release manager rtag_id and contains a daemon property
|
|
|
102 |
* When false, mBuildCollection contains at least one item based on a deployment manager bom_id
|
|
|
103 |
* Will be accessed by the Package class to calculate its mAlias
|
|
|
104 |
* @attribute
|
|
|
105 |
*/
|
|
|
106 |
boolean mDaemon;
|
|
|
107 |
|
|
|
108 |
/**collection of build file content in String form
|
|
|
109 |
* @attribute
|
|
|
110 |
*/
|
| 864 |
mhunt |
111 |
private Vector<String> mBuildCollection = new Vector<String>();
|
| 814 |
mhunt |
112 |
|
| 906 |
mhunt |
113 |
/**Warning message
|
|
|
114 |
* @attribute
|
|
|
115 |
*/
|
|
|
116 |
private static final String mAnyBuildPlatforms = new String("Warning. The following package versions are not reproducible on any build platform: ");
|
|
|
117 |
|
|
|
118 |
/**Flag to control output to standard out
|
|
|
119 |
* @attribute
|
|
|
120 |
*/
|
|
|
121 |
private boolean mAnyBuildPlatformsFlag = true;
|
|
|
122 |
|
|
|
123 |
/**Warning message
|
|
|
124 |
* @attribute
|
|
|
125 |
*/
|
|
|
126 |
private static final String mAssocBuildPlatforms = new String("Warning. The following package versions are not reproducible on the build platforms associated with this baseline: ");
|
|
|
127 |
|
|
|
128 |
/**Flag to control output to standard out
|
|
|
129 |
* @attribute
|
|
|
130 |
*/
|
|
|
131 |
private boolean mAssocBuildPlatformsFlag = true;
|
|
|
132 |
|
|
|
133 |
/**Warning message
|
|
|
134 |
* @attribute
|
|
|
135 |
*/
|
|
|
136 |
private static final String mNotInBaseline = new String("Warning. The following package versions are not reproducible as they are directly dependent upon package versions not in the baseline: ");
|
|
|
137 |
|
|
|
138 |
/**Flag to control output to standard out
|
|
|
139 |
* @attribute
|
|
|
140 |
*/
|
|
|
141 |
private boolean mNotInBaselineFlag = true;
|
|
|
142 |
|
|
|
143 |
/**Warning message
|
|
|
144 |
* @attribute
|
|
|
145 |
*/
|
|
|
146 |
private static final String mDependent = new String("Warning. The following package versions are not reproducible as they are directly/indirectly dependent upon not reproducible package versions: ");
|
|
|
147 |
|
|
|
148 |
/**Flag to control output to standard out
|
|
|
149 |
* @attribute
|
|
|
150 |
*/
|
|
|
151 |
private boolean mDependentFlag = true;
|
|
|
152 |
|
| 910 |
mhunt |
153 |
/**Warning message
|
|
|
154 |
* @attribute
|
|
|
155 |
*/
|
|
|
156 |
private static final String mCircularDependency = new String("Warning. The following package versions are not reproducible as they have circular dependencies: ");
|
|
|
157 |
|
|
|
158 |
/**Flag to control output to standard out
|
|
|
159 |
* @attribute
|
|
|
160 |
*/
|
|
|
161 |
private boolean mCircularDependencyFlag = true;
|
|
|
162 |
|
| 814 |
mhunt |
163 |
/**constructor
|
|
|
164 |
*/
|
|
|
165 |
public RippleEngine(ReleaseManager releaseManager, int rtag_id,
|
|
|
166 |
boolean isDaemon)
|
|
|
167 |
{
|
|
|
168 |
mLogger.debug("RippleEngine rtag_id " + rtag_id + " isDaemon " + isDaemon);
|
|
|
169 |
mReleaseManager = releaseManager;
|
|
|
170 |
mBaseline = rtag_id;
|
|
|
171 |
mDaemon = isDaemon;
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
/**discards all build file content
|
|
|
175 |
* plans new build file content
|
|
|
176 |
*/
|
|
|
177 |
public void planRelease() throws SQLException, Exception
|
|
|
178 |
{
|
|
|
179 |
mLogger.warn("planRelease mDaemon " + mDaemon);
|
| 918 |
mhunt |
180 |
boolean highProbabilityBuildRequirement = true;
|
|
|
181 |
|
|
|
182 |
if ( mAddendum.compareTo("dummy") == 0 )
|
|
|
183 |
{
|
|
|
184 |
// the last planning session had no build requirement
|
|
|
185 |
highProbabilityBuildRequirement = false;
|
|
|
186 |
}
|
|
|
187 |
|
| 814 |
mhunt |
188 |
mAddendum = "dummy";
|
|
|
189 |
mBuildCollection.removeAllElements();
|
|
|
190 |
mPackageCollection.removeAllElements();
|
|
|
191 |
mReleasedPvIDCollection.removeAllElements();
|
|
|
192 |
|
|
|
193 |
if ( !mDaemon )
|
|
|
194 |
{
|
|
|
195 |
mEscrowClearcaseSupportCollection.removeAllElements();
|
|
|
196 |
}
|
|
|
197 |
|
| 898 |
mhunt |
198 |
// use finally block in planRelease to ensure releaseMutex is called
|
|
|
199 |
try
|
|
|
200 |
{
|
| 918 |
mhunt |
201 |
mReleaseManager.connectForPlanning(highProbabilityBuildRequirement);
|
| 814 |
mhunt |
202 |
|
| 898 |
mhunt |
203 |
if ( mDaemon )
|
| 866 |
mhunt |
204 |
{
|
| 898 |
mhunt |
205 |
// claim the mutex
|
|
|
206 |
mReleaseManager.claimMutex();
|
|
|
207 |
mBuildExclusionCollection.removeAllElements();
|
|
|
208 |
Vector<BuildExclusion> tempBuildExclusionCollection = new Vector<BuildExclusion>();
|
| 866 |
mhunt |
209 |
|
| 898 |
mhunt |
210 |
mReleaseManager.queryBuildExclusions(tempBuildExclusionCollection, mBaseline);
|
|
|
211 |
|
|
|
212 |
// only populate mBuildExclusionCollection with tempBuildExclusionCollection entries which have a relevant root_pv_id
|
|
|
213 |
// ie the root_pv_id is ONLY relevant if it is null (-1) or it points to a pv_id in the collection
|
|
|
214 |
// the package with a pv_id which is a root_pv_id may be removed ie when fixing a build issue
|
|
|
215 |
for (Iterator<BuildExclusion> it = tempBuildExclusionCollection.iterator(); it.hasNext(); )
|
| 866 |
mhunt |
216 |
{
|
| 898 |
mhunt |
217 |
BuildExclusion buildExclusion = it.next();
|
|
|
218 |
|
|
|
219 |
if ( buildExclusion.isRelevant(tempBuildExclusionCollection) )
|
|
|
220 |
{
|
|
|
221 |
mBuildExclusionCollection.add(buildExclusion);
|
|
|
222 |
}
|
|
|
223 |
else
|
|
|
224 |
{
|
|
|
225 |
// this is just a cosmetic step
|
|
|
226 |
// it includes package versions which have been indirectly excluded
|
|
|
227 |
// the build daemon ignores this information, but it serves to clarify this point to users
|
|
|
228 |
buildExclusion.includeToBuild(mReleaseManager, mBaseline);
|
|
|
229 |
}
|
| 866 |
mhunt |
230 |
}
|
|
|
231 |
}
|
| 898 |
mhunt |
232 |
|
|
|
233 |
mReleaseManager.queryPackageVersions(this, mPackageCollection, mDaemon, mBaseline);
|
|
|
234 |
|
| 908 |
mhunt |
235 |
// must deal with test builds here as they may impact upon package attributes
|
|
|
236 |
// eg dependency collection and build standard differences
|
|
|
237 |
// this gives test builds preferential treatment
|
|
|
238 |
if ( mDaemon )
|
|
|
239 |
{
|
|
|
240 |
// process test builds
|
|
|
241 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
242 |
{
|
|
|
243 |
Package p = it.next();
|
|
|
244 |
|
|
|
245 |
if (p.mBuildFile == 0)
|
|
|
246 |
{
|
|
|
247 |
// package has yet to be processed
|
|
|
248 |
if ( p.mTestBuildInstruction > 0 )
|
|
|
249 |
{
|
|
|
250 |
mLogger.info("planRelease package test build " + p.mName);
|
|
|
251 |
|
|
|
252 |
// force patch for test build numbering
|
|
|
253 |
p.mDirectlyPlanned = true;
|
|
|
254 |
p.mChangeType.setPatch();
|
|
|
255 |
p.mRequiresSourceControlInteraction = false;
|
|
|
256 |
rippleIndirectlyPlanned(p);
|
|
|
257 |
|
|
|
258 |
// put the mTestBuildAttributes to work
|
|
|
259 |
p.mLabel = p.mTestBuildLabel;
|
|
|
260 |
p.mLocation = p.mTestBuildLocation;
|
|
|
261 |
p.setEmail();
|
|
|
262 |
p.setDependencyCollection();
|
|
|
263 |
p.setBuildStandardCollection();
|
|
|
264 |
}
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
|
| 898 |
mhunt |
269 |
// set up mPackageDependencyCollection
|
|
|
270 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
271 |
{
|
| 898 |
mhunt |
272 |
Package p = it.next();
|
|
|
273 |
|
|
|
274 |
for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
|
| 814 |
mhunt |
275 |
{
|
| 898 |
mhunt |
276 |
String alias = it2.next();
|
|
|
277 |
Package dependency = findPackage(alias);
|
|
|
278 |
|
| 902 |
mhunt |
279 |
p.mPackageDependencyCollection.add(dependency);
|
|
|
280 |
}
|
|
|
281 |
}
|
| 910 |
mhunt |
282 |
|
|
|
283 |
// DEVI 56479 detect and deal with circular dependencies
|
|
|
284 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
285 |
{
|
|
|
286 |
Package p = it.next();
|
|
|
287 |
|
|
|
288 |
if ( p.hasCircularDependency( this ) )
|
|
|
289 |
{
|
|
|
290 |
mLogger.info("planRelease circular dependency detected " + p.mAlias);
|
|
|
291 |
// exclude all dependent packages
|
|
|
292 |
// max 50 chars
|
|
|
293 |
rippleBuildExclude(p, p.mId, "Package has circular dependency", null, null);
|
|
|
294 |
|
|
|
295 |
// take the package out of the build
|
|
|
296 |
p.mBuildFile = -6;
|
|
|
297 |
mLogger.info("planRelease set mBuildFile to -6 for package " + p.mAlias );
|
|
|
298 |
standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
|
|
|
299 |
}
|
|
|
300 |
}
|
| 902 |
mhunt |
301 |
|
|
|
302 |
// DEVI 55483 now use the fully built mPackageDependencyCollection (in rippleBuildExclude)
|
|
|
303 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
304 |
{
|
|
|
305 |
Package p = it.next();
|
|
|
306 |
|
|
|
307 |
for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
|
|
|
308 |
{
|
|
|
309 |
String alias = it2.next();
|
|
|
310 |
Package dependency = findPackage(alias);
|
|
|
311 |
|
| 898 |
mhunt |
312 |
if (dependency == ReleaseManager.NULL_PACKAGE)
|
|
|
313 |
{
|
|
|
314 |
mLogger.info("planRelease dependency is not in the baseline " + alias);
|
|
|
315 |
// exclude all dependent packages
|
|
|
316 |
// max 50 chars
|
| 900 |
mhunt |
317 |
rippleBuildExclude(p, p.mId, "Package build dependency not in the release", null, null);
|
| 898 |
mhunt |
318 |
|
|
|
319 |
// take the package out of the build
|
|
|
320 |
p.mBuildFile = -4;
|
|
|
321 |
mLogger.info("planRelease set mBuildFile to -4 for package " + p.mAlias );
|
| 906 |
mhunt |
322 |
standardOut(mNotInBaseline, p.mAlias, mNotInBaselineFlag);
|
| 898 |
mhunt |
323 |
break;
|
|
|
324 |
}
|
| 814 |
mhunt |
325 |
}
|
|
|
326 |
}
|
| 902 |
mhunt |
327 |
|
| 898 |
mhunt |
328 |
// process packages which are not reproducible, and all packages dependent upon them
|
|
|
329 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
330 |
{
|
| 898 |
mhunt |
331 |
Package p = it.next();
|
|
|
332 |
|
|
|
333 |
if (p.mBuildFile == 0)
|
| 814 |
mhunt |
334 |
{
|
| 898 |
mhunt |
335 |
// package has yet to be processed
|
|
|
336 |
if (!p.isReproducible())
|
|
|
337 |
{
|
|
|
338 |
// for escrow build purposes, exclude all dependent package versions
|
|
|
339 |
mLogger.info("planRelease package not reproducible " + p.mName);
|
|
|
340 |
// max 50 chars
|
| 900 |
mhunt |
341 |
rippleBuildExclude(p, p.mId, "Package has no build environment", null, null);
|
| 898 |
mhunt |
342 |
|
|
|
343 |
// package is not reproducible, discard
|
|
|
344 |
p.mBuildFile = -1;
|
|
|
345 |
mLogger.info("planRelease set mBuildFile to -1 for package " + p.mAlias );
|
| 906 |
mhunt |
346 |
standardOut(mAnyBuildPlatforms, p.mAlias, mAnyBuildPlatformsFlag);
|
| 898 |
mhunt |
347 |
}
|
| 814 |
mhunt |
348 |
}
|
|
|
349 |
}
|
| 898 |
mhunt |
350 |
|
|
|
351 |
// process packages which are not reproducible on the build platforms configured for this baseline
|
|
|
352 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
353 |
{
|
| 898 |
mhunt |
354 |
Package p = it.next();
|
| 858 |
mhunt |
355 |
|
| 898 |
mhunt |
356 |
if (p.mBuildFile == 0)
|
| 814 |
mhunt |
357 |
{
|
| 898 |
mhunt |
358 |
// package has yet to be processed
|
|
|
359 |
// assume it does not need to be reproduced for this baseline
|
|
|
360 |
boolean reproduce = false;
|
|
|
361 |
|
|
|
362 |
for (Iterator<String> it2 = mGbeMachtypeCollection.iterator(); it2.hasNext(); )
|
| 814 |
mhunt |
363 |
{
|
| 898 |
mhunt |
364 |
String machtype = it2.next();
|
|
|
365 |
|
|
|
366 |
if ( machtype.compareTo("linux_i386") == 0 )
|
| 814 |
mhunt |
367 |
{
|
| 898 |
mhunt |
368 |
if ( p.isLinuxBuilt() )
|
|
|
369 |
{
|
|
|
370 |
reproduce = true;
|
|
|
371 |
mLogger.info("planRelease package built on linux " + p.mAlias );
|
|
|
372 |
break;
|
|
|
373 |
}
|
| 814 |
mhunt |
374 |
}
|
| 898 |
mhunt |
375 |
else if ( machtype.compareTo("win32") == 0 )
|
| 814 |
mhunt |
376 |
{
|
| 898 |
mhunt |
377 |
if ( p.isWin32Built() )
|
|
|
378 |
{
|
|
|
379 |
reproduce = true;
|
|
|
380 |
mLogger.info("planRelease package built on win32 " + p.mAlias );
|
|
|
381 |
break;
|
|
|
382 |
}
|
| 814 |
mhunt |
383 |
}
|
| 898 |
mhunt |
384 |
else if ( machtype.compareTo("sparc") == 0
|
|
|
385 |
|| machtype.compareTo("solaris10_x86") == 0
|
|
|
386 |
|| machtype.compareTo("solaris10_sparc32") == 0 )
|
| 814 |
mhunt |
387 |
{
|
| 898 |
mhunt |
388 |
if ( p.isSolarisBuilt() )
|
|
|
389 |
{
|
|
|
390 |
reproduce = true;
|
|
|
391 |
mLogger.info("planRelease package built on solaris " + p.mAlias );
|
|
|
392 |
break;
|
|
|
393 |
}
|
| 814 |
mhunt |
394 |
}
|
|
|
395 |
}
|
| 898 |
mhunt |
396 |
|
|
|
397 |
if ( !reproduce )
|
|
|
398 |
{
|
|
|
399 |
mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline " + p.mName);
|
|
|
400 |
|
| 906 |
mhunt |
401 |
if (mDaemon)
|
|
|
402 |
{
|
|
|
403 |
// DEVI 54816
|
|
|
404 |
// for escrow build purposes, do not exclude all dependent package versions
|
|
|
405 |
// max 50 chars
|
|
|
406 |
rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null, null);
|
|
|
407 |
}
|
|
|
408 |
|
| 898 |
mhunt |
409 |
// package is not reproducible on the build platforms configured for this baseline, discard
|
|
|
410 |
p.mBuildFile = -2;
|
|
|
411 |
mLogger.info("planRelease set mBuildFile to -2 for package " + p.mAlias );
|
| 906 |
mhunt |
412 |
standardOut(mAssocBuildPlatforms, p.mAlias, mAssocBuildPlatformsFlag);
|
| 898 |
mhunt |
413 |
}
|
| 858 |
mhunt |
414 |
}
|
| 898 |
mhunt |
415 |
}
|
|
|
416 |
|
|
|
417 |
if (mDaemon)
|
| 814 |
mhunt |
418 |
{
|
| 898 |
mhunt |
419 |
// process packages which are not ripple buildable, and all packages dependent upon them
|
|
|
420 |
for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
|
| 814 |
mhunt |
421 |
{
|
| 898 |
mhunt |
422 |
BuildExclusion be = it.next();
|
| 866 |
mhunt |
423 |
|
| 898 |
mhunt |
424 |
for (Iterator<Package> it1 = mPackageCollection.iterator(); it1.hasNext(); )
|
| 814 |
mhunt |
425 |
{
|
| 898 |
mhunt |
426 |
Package p = it1.next();
|
|
|
427 |
|
| 908 |
mhunt |
428 |
// ensure only root cause, non test build, build exclusions are excluded
|
| 900 |
mhunt |
429 |
// mBuildExclusionCollection is at this point based on
|
|
|
430 |
// relevant (direct and indirect) excluded pv's in the database
|
| 908 |
mhunt |
431 |
if ( be.compare(p.mId) && be.isARootCause() && p.mTestBuildInstruction == 0 )
|
| 866 |
mhunt |
432 |
{
|
| 900 |
mhunt |
433 |
// package is not reproducible, discard
|
|
|
434 |
rippleBuildExclude( p, p.mId, null, it, be );
|
|
|
435 |
p.mBuildFile = -3;
|
|
|
436 |
mLogger.info("planRelease set mBuildFile to -3 for package " + p.mAlias );
|
| 898 |
mhunt |
437 |
break;
|
| 866 |
mhunt |
438 |
}
|
| 814 |
mhunt |
439 |
}
|
|
|
440 |
}
|
| 898 |
mhunt |
441 |
|
|
|
442 |
// process packages which need to be ripple built
|
|
|
443 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
444 |
{
|
| 898 |
mhunt |
445 |
Package p = it.next();
|
|
|
446 |
|
|
|
447 |
if (p.mBuildFile == 0)
|
| 814 |
mhunt |
448 |
{
|
| 898 |
mhunt |
449 |
// package has yet to be processed
|
|
|
450 |
if (p.mDirectlyPlanned)
|
| 814 |
mhunt |
451 |
{
|
| 898 |
mhunt |
452 |
// a WIP exists on the package
|
|
|
453 |
// exclude all dependent package versions
|
|
|
454 |
mLogger.info("planRelease package has WIP " + p.mName);
|
|
|
455 |
rippleIndirectlyPlanned(p);
|
|
|
456 |
}
|
|
|
457 |
else
|
|
|
458 |
{
|
|
|
459 |
Iterator<Integer> it2 = p.mDependencyIDCollection.iterator();
|
|
|
460 |
Iterator<Package> it3 = p.mPackageDependencyCollection.iterator();
|
|
|
461 |
for ( ; it2.hasNext() && it3.hasNext(); )
|
| 814 |
mhunt |
462 |
{
|
| 898 |
mhunt |
463 |
Integer dpv_id = it2.next();
|
|
|
464 |
Package dependency = it3.next();
|
|
|
465 |
|
|
|
466 |
if ( !dependency.mAdvisoryRipple )
|
| 814 |
mhunt |
467 |
{
|
| 898 |
mhunt |
468 |
// not advisory, ie has ripple build impact
|
|
|
469 |
boolean found = false;
|
|
|
470 |
|
|
|
471 |
for ( Iterator<Integer> it4 = mReleasedPvIDCollection.iterator(); it4.hasNext(); )
|
| 814 |
mhunt |
472 |
{
|
| 898 |
mhunt |
473 |
Integer pv_id = it4.next();
|
|
|
474 |
|
|
|
475 |
if ( pv_id.compareTo(dpv_id) == 0 )
|
|
|
476 |
{
|
|
|
477 |
found = true;
|
|
|
478 |
break;
|
|
|
479 |
}
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
if ( !found )
|
|
|
483 |
{
|
|
|
484 |
// the package is out of date
|
|
|
485 |
// exclude all dependent package versions
|
|
|
486 |
mLogger.info("planRelease package out of date " + p.mName);
|
|
|
487 |
rippleIndirectlyPlanned(p);
|
| 814 |
mhunt |
488 |
break;
|
|
|
489 |
}
|
|
|
490 |
}
|
|
|
491 |
}
|
|
|
492 |
}
|
|
|
493 |
}
|
|
|
494 |
}
|
| 898 |
mhunt |
495 |
|
|
|
496 |
// process packages which do not exist in the archive
|
|
|
497 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
498 |
{
|
| 898 |
mhunt |
499 |
Package p = it.next();
|
|
|
500 |
|
|
|
501 |
if (p.mBuildFile == 0)
|
| 814 |
mhunt |
502 |
{
|
| 898 |
mhunt |
503 |
// package has yet to be processed
|
|
|
504 |
// for unit test purposes, assume all packages exist in the archive if released
|
|
|
505 |
if ( ReleaseManager.mUseDatabase )
|
| 814 |
mhunt |
506 |
{
|
| 898 |
mhunt |
507 |
// only check existence outside the unit test
|
|
|
508 |
if (!p.mDirectlyPlanned && !p.mIndirectlyPlanned)
|
| 814 |
mhunt |
509 |
{
|
| 898 |
mhunt |
510 |
// check package version archive existence
|
|
|
511 |
if (!p.exists())
|
|
|
512 |
{
|
|
|
513 |
mLogger.info("planRelease package not found in archive " + p.mName);
|
|
|
514 |
// DEVI 47395 the cause of this build is not WIP or ripple induced,
|
|
|
515 |
// it simply does not exist in the archive (has been removed)
|
|
|
516 |
// prevent source control interaction
|
|
|
517 |
p.mRequiresSourceControlInteraction = false;
|
|
|
518 |
rippleIndirectlyPlanned(p);
|
|
|
519 |
}
|
| 814 |
mhunt |
520 |
}
|
|
|
521 |
}
|
|
|
522 |
}
|
|
|
523 |
}
|
| 908 |
mhunt |
524 |
|
|
|
525 |
// process forced ripples
|
|
|
526 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
527 |
{
|
|
|
528 |
Package p = it.next();
|
|
|
529 |
|
|
|
530 |
if (p.mBuildFile == 0)
|
|
|
531 |
{
|
|
|
532 |
// package has yet to be processed
|
|
|
533 |
if ( p.mForcedRippleInstruction > 0 )
|
|
|
534 |
{
|
|
|
535 |
mLogger.info("planRelease package forced ripple " + p.mName);
|
|
|
536 |
rippleIndirectlyPlanned(p);
|
|
|
537 |
}
|
|
|
538 |
}
|
|
|
539 |
}
|
| 814 |
mhunt |
540 |
}
|
| 906 |
mhunt |
541 |
else
|
|
|
542 |
{
|
|
|
543 |
// escrow reporting only
|
|
|
544 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
545 |
{
|
|
|
546 |
Package p = it.next();
|
|
|
547 |
|
|
|
548 |
if (p.mBuildFile == -3)
|
|
|
549 |
{
|
|
|
550 |
standardOut(mDependent, p.mAlias, mDependentFlag);
|
|
|
551 |
}
|
|
|
552 |
}
|
|
|
553 |
}
|
| 826 |
mhunt |
554 |
|
| 898 |
mhunt |
555 |
// process remaining packages which need to be reproduced for this baseline
|
|
|
556 |
// determine the build file for each package
|
|
|
557 |
// for daemon builds, determine the first package that can be built now, this means the first package not dependent upon packages also to be built
|
|
|
558 |
// set its mBuildNumber to 1, all remaining reproducible packages to 2
|
|
|
559 |
// for escrow builds, determine the package versions that can be built in the build iteration
|
|
|
560 |
// set their mBuildNumber to the build iteration
|
|
|
561 |
// increment the build iteration and repeat until all package versions that need to be reproduced have been assigned a build iteration
|
|
|
562 |
boolean allProcessed = false;
|
|
|
563 |
int buildFile = 1;
|
|
|
564 |
|
|
|
565 |
// delete the file <rtagId>official
|
|
|
566 |
Integer rtag = new Integer(mBaseline);
|
|
|
567 |
File rtagIdOfficial = new File(rtag + "official");
|
|
|
568 |
|
|
|
569 |
if (rtagIdOfficial.exists())
|
| 826 |
mhunt |
570 |
{
|
| 898 |
mhunt |
571 |
boolean del = rtagIdOfficial.delete();
|
|
|
572 |
|
| 826 |
mhunt |
573 |
if ( !del )
|
|
|
574 |
{
|
| 898 |
mhunt |
575 |
// the delete failed
|
|
|
576 |
// some literature suggests a forced garbage collection may free up resources associated with file handles
|
|
|
577 |
// nothing to lose since the file "must" be deleted
|
|
|
578 |
System.gc();
|
|
|
579 |
del = rtagIdOfficial.delete();
|
|
|
580 |
|
|
|
581 |
if ( !del )
|
|
|
582 |
{
|
|
|
583 |
mLogger.fatal("rtagIdOfficial.delete() returned " + del);
|
|
|
584 |
}
|
| 826 |
mhunt |
585 |
}
|
|
|
586 |
}
|
| 814 |
mhunt |
587 |
|
| 898 |
mhunt |
588 |
String raw_data = new String("");
|
|
|
589 |
String lf = new String( System.getProperty("line.separator") );
|
|
|
590 |
|
| 814 |
mhunt |
591 |
do
|
|
|
592 |
{
|
| 898 |
mhunt |
593 |
boolean allDependenciesProcessed = true;
|
| 814 |
mhunt |
594 |
|
| 898 |
mhunt |
595 |
do
|
| 814 |
mhunt |
596 |
{
|
| 898 |
mhunt |
597 |
// assume all dependencies have been processed
|
|
|
598 |
allDependenciesProcessed = true;
|
| 814 |
mhunt |
599 |
|
| 898 |
mhunt |
600 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
601 |
{
|
| 898 |
mhunt |
602 |
Package p = it.next();
|
|
|
603 |
|
| 906 |
mhunt |
604 |
if ( ( mDaemon && ( ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) || p.mBuildFile < 0 ) ) ||
|
|
|
605 |
( !mDaemon && p.mBuildFile == -2 ) )
|
| 814 |
mhunt |
606 |
{
|
| 898 |
mhunt |
607 |
// flag packages with no build requirement as processed in daemon mode
|
| 906 |
mhunt |
608 |
// DEVI 54816 flag packages with a foreign build environment as processed in escrow mode
|
| 898 |
mhunt |
609 |
p.mProcessed = true;
|
|
|
610 |
mLogger.info("planRelease package has no build requirement " + p.mName);
|
|
|
611 |
}
|
| 906 |
mhunt |
612 |
else if ( ( p.mBuildFile == 0 ) && ( (mDaemon && ( p.mDirectlyPlanned || p.mIndirectlyPlanned ) ) || ( !mDaemon ) ) )
|
| 898 |
mhunt |
613 |
{
|
| 906 |
mhunt |
614 |
// package yet to be processed and
|
|
|
615 |
// in daemon mode has a build requirement or
|
|
|
616 |
// in escrow mode
|
|
|
617 |
boolean canBeBuiltNow = true;
|
|
|
618 |
boolean allDependenciesForThisPackageProcessed = true;
|
|
|
619 |
|
|
|
620 |
for ( Iterator<Package> it2 = p.mPackageDependencyCollection.iterator(); it2.hasNext(); )
|
| 814 |
mhunt |
621 |
{
|
| 906 |
mhunt |
622 |
Package dependency = it2.next();
|
| 814 |
mhunt |
623 |
|
| 906 |
mhunt |
624 |
if ( !dependency.mProcessed )
|
| 814 |
mhunt |
625 |
{
|
| 906 |
mhunt |
626 |
// cannot determine canBeBuiltNow until this dependency has been processed
|
|
|
627 |
allDependenciesForThisPackageProcessed = false;
|
|
|
628 |
allDependenciesProcessed = false;
|
|
|
629 |
}
|
|
|
630 |
else if ( ( mDaemon && ( dependency.mDirectlyPlanned ) || ( dependency.mIndirectlyPlanned ) ) ||
|
|
|
631 |
( !mDaemon &&
|
|
|
632 |
( ( dependency.mBuildFile == 0 ) ||
|
|
|
633 |
( dependency.mBuildFile == buildFile &&
|
|
|
634 |
( ( p.isLinuxBuilt() && !dependency.isLinuxBuilt() ) ||
|
|
|
635 |
( p.isWin32Built() && !dependency.isWin32Built() ) ||
|
|
|
636 |
( p.isSolarisBuilt() && !dependency.isSolarisBuilt() ) ||
|
|
|
637 |
( !p.isLinuxBuilt() && dependency.isLinuxBuilt() ) ||
|
|
|
638 |
( !p.isWin32Built() && dependency.isWin32Built() ) ||
|
|
|
639 |
( !p.isSolarisBuilt() && dependency.isSolarisBuilt() ) ) ) ) ) )
|
|
|
640 |
{
|
|
|
641 |
// in daemon mode this processed dependency has a build requirement or
|
|
|
642 |
// in escrow mode...
|
|
|
643 |
// this processed dependency has not been assigned to a build iteration or
|
|
|
644 |
// this processed dependency has been assigned to this build iteration and does not build on this platform
|
|
|
645 |
canBeBuiltNow = false;
|
|
|
646 |
mLogger.info("planRelease package cannot be built in this iteration " + p.mName);
|
|
|
647 |
break;
|
|
|
648 |
}
|
|
|
649 |
}
|
|
|
650 |
|
|
|
651 |
if (allDependenciesForThisPackageProcessed)
|
|
|
652 |
{
|
|
|
653 |
p.mProcessed = true;
|
|
|
654 |
|
|
|
655 |
if ( mDaemon )
|
|
|
656 |
{
|
|
|
657 |
if ( canBeBuiltNow )
|
| 814 |
mhunt |
658 |
{
|
| 906 |
mhunt |
659 |
// flag package with build requirement, may get downgraded to future build requirement
|
|
|
660 |
p.mBuildFile = 1;
|
|
|
661 |
mLogger.info("planRelease set mBuildFile to 1 for package " + p.mAlias );
|
| 814 |
mhunt |
662 |
}
|
| 906 |
mhunt |
663 |
else
|
| 814 |
mhunt |
664 |
{
|
| 906 |
mhunt |
665 |
// flag package with future build requirement
|
|
|
666 |
p.mBuildFile = 2;
|
|
|
667 |
mLogger.info("planRelease set mBuildFile to 2 for package " + p.mAlias );
|
| 814 |
mhunt |
668 |
}
|
|
|
669 |
}
|
| 906 |
mhunt |
670 |
else
|
| 814 |
mhunt |
671 |
{
|
| 906 |
mhunt |
672 |
if ( canBeBuiltNow )
|
| 814 |
mhunt |
673 |
{
|
| 906 |
mhunt |
674 |
String isWin32Built = new String("");
|
|
|
675 |
|
|
|
676 |
if ( p.isWin32Built() )
|
| 848 |
dpurdie |
677 |
{
|
| 906 |
mhunt |
678 |
isWin32Built = "W";
|
| 898 |
mhunt |
679 |
}
|
| 906 |
mhunt |
680 |
|
|
|
681 |
String isLinuxBuilt = new String("");
|
|
|
682 |
|
|
|
683 |
if ( p.isLinuxBuilt() )
|
| 898 |
mhunt |
684 |
{
|
| 906 |
mhunt |
685 |
isLinuxBuilt = "L";
|
| 898 |
mhunt |
686 |
}
|
| 906 |
mhunt |
687 |
|
|
|
688 |
String isSolarisBuilt = new String("");
|
|
|
689 |
|
|
|
690 |
if ( p.isSolarisBuilt() )
|
| 898 |
mhunt |
691 |
{
|
| 906 |
mhunt |
692 |
isSolarisBuilt = "S";
|
| 848 |
dpurdie |
693 |
}
|
| 906 |
mhunt |
694 |
|
|
|
695 |
String isGeneric = new String("");
|
|
|
696 |
|
|
|
697 |
if ( p.isGeneric() )
|
|
|
698 |
{
|
|
|
699 |
isGeneric = "G";
|
|
|
700 |
}
|
|
|
701 |
|
|
|
702 |
raw_data += p.mAlias + "," +
|
|
|
703 |
isWin32Built + "," +
|
|
|
704 |
isLinuxBuilt + "," +
|
|
|
705 |
isSolarisBuilt + "," +
|
|
|
706 |
isGeneric + "," +
|
|
|
707 |
buildFile +
|
|
|
708 |
lf;
|
|
|
709 |
|
|
|
710 |
// not daemon
|
|
|
711 |
p.mBuildFile = buildFile;
|
|
|
712 |
mLogger.info("planRelease set mBuildFile to " + buildFile + " for package " + p.mAlias );
|
| 814 |
mhunt |
713 |
}
|
|
|
714 |
}
|
|
|
715 |
}
|
|
|
716 |
}
|
|
|
717 |
}
|
| 898 |
mhunt |
718 |
} while( !allDependenciesProcessed );
|
|
|
719 |
|
|
|
720 |
if ( mDaemon )
|
| 814 |
mhunt |
721 |
{
|
| 898 |
mhunt |
722 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
723 |
{
|
| 898 |
mhunt |
724 |
Package p = it.next();
|
|
|
725 |
|
|
|
726 |
if ( p.mProcessed && p.mBuildFile == 1 )
|
| 814 |
mhunt |
727 |
{
|
| 898 |
mhunt |
728 |
p.mBuildFile = buildFile;
|
|
|
729 |
mLogger.info("planRelease 2 set mBuildFile to " + buildFile + " for package " + p.mAlias );
|
|
|
730 |
|
|
|
731 |
if ( buildFile == 1 )
|
| 874 |
mhunt |
732 |
{
|
| 898 |
mhunt |
733 |
int pvApplied = p.applyPV(mReleaseManager, mBaseline);
|
|
|
734 |
|
|
|
735 |
if ( pvApplied == 1 )
|
|
|
736 |
{
|
|
|
737 |
// max 50 chars
|
| 900 |
mhunt |
738 |
rippleBuildExclude(p, p.mId, "Package has non standard versioning", null, null);
|
| 898 |
mhunt |
739 |
}
|
|
|
740 |
else
|
|
|
741 |
if ( pvApplied == 2 )
|
|
|
742 |
{
|
|
|
743 |
// max 50 chars
|
| 900 |
mhunt |
744 |
rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null, null);
|
| 898 |
mhunt |
745 |
}
|
|
|
746 |
else
|
|
|
747 |
{
|
|
|
748 |
buildFile = 2;
|
| 908 |
mhunt |
749 |
|
|
|
750 |
if ( p.mForcedRippleInstruction > 0 )
|
|
|
751 |
{
|
|
|
752 |
mReleaseManager.markDaemonInstCompleted( p.mForcedRippleInstruction );
|
|
|
753 |
}
|
|
|
754 |
|
|
|
755 |
if ( p.mTestBuildInstruction > 0 )
|
|
|
756 |
{
|
|
|
757 |
mReleaseManager.markDaemonInstInProgress( p.mTestBuildInstruction );
|
|
|
758 |
}
|
| 898 |
mhunt |
759 |
}
|
| 874 |
mhunt |
760 |
}
|
|
|
761 |
else
|
|
|
762 |
{
|
| 898 |
mhunt |
763 |
mLogger.info("planRelease package has future (downgraded) build requirement " + p.mName + " " + buildFile);
|
| 874 |
mhunt |
764 |
}
|
| 814 |
mhunt |
765 |
}
|
| 898 |
mhunt |
766 |
}
|
|
|
767 |
}
|
|
|
768 |
|
|
|
769 |
// are more build files required
|
|
|
770 |
allProcessed = true;
|
|
|
771 |
|
|
|
772 |
if (mDaemon)
|
|
|
773 |
{
|
|
|
774 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
775 |
{
|
|
|
776 |
Package p = it.next();
|
|
|
777 |
|
|
|
778 |
if ( p.mBuildFile < 0 || ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) )
|
| 814 |
mhunt |
779 |
{
|
| 898 |
mhunt |
780 |
// at this point...
|
|
|
781 |
// only 1 package with a build requirement has a mBuildFile of 1,
|
|
|
782 |
// all other packages with a build requirement have an mBuildFile of 2
|
|
|
783 |
// give packages with no build requirement, reproducible or not, an mBuildFile of 3
|
|
|
784 |
p.mBuildFile = 3;
|
|
|
785 |
mLogger.info("planRelease 1 set mBuildFile to 3 for package " + p.mAlias );
|
| 814 |
mhunt |
786 |
}
|
|
|
787 |
}
|
|
|
788 |
}
|
| 898 |
mhunt |
789 |
else
|
|
|
790 |
{
|
|
|
791 |
// this is escrow mode centric
|
|
|
792 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
793 |
{
|
|
|
794 |
Package p = it.next();
|
|
|
795 |
|
|
|
796 |
if ( p.mBuildFile == 0 )
|
|
|
797 |
{
|
|
|
798 |
// more build files are required
|
|
|
799 |
allProcessed = false;
|
|
|
800 |
mLogger.info("planRelease more build files are required for " + p.mName);
|
|
|
801 |
break;
|
|
|
802 |
}
|
|
|
803 |
}
|
|
|
804 |
|
|
|
805 |
buildFile++;
|
|
|
806 |
}
|
|
|
807 |
} while( !allProcessed );
|
| 814 |
mhunt |
808 |
|
| 898 |
mhunt |
809 |
// persist the build files
|
|
|
810 |
allProcessed = false;
|
|
|
811 |
buildFile = 1;
|
| 814 |
mhunt |
812 |
|
| 898 |
mhunt |
813 |
if ( mDaemon )
|
| 814 |
mhunt |
814 |
{
|
| 898 |
mhunt |
815 |
// all interesting packages in daemon mode match the following filter
|
|
|
816 |
buildFile = 3;
|
|
|
817 |
}
|
|
|
818 |
|
|
|
819 |
mTimestamp = System.currentTimeMillis();
|
|
|
820 |
|
|
|
821 |
if ( !ReleaseManager.mUseDatabase )
|
|
|
822 |
{
|
|
|
823 |
mTimestamp = 123456789;
|
|
|
824 |
}
|
|
|
825 |
|
|
|
826 |
do
|
|
|
827 |
{
|
|
|
828 |
String buildFileContent = new String( generateBuildFileHeader() );
|
|
|
829 |
|
| 864 |
mhunt |
830 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
831 |
{
|
| 864 |
mhunt |
832 |
Package p = it.next();
|
| 906 |
mhunt |
833 |
|
|
|
834 |
// DEVI 54816
|
|
|
835 |
// now set a packages mBuildFile to -2 in escrow mode, but do not ripple this through
|
|
|
836 |
// its consumers need dependency package property info
|
|
|
837 |
if ( ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) ) || ( !mDaemon && p.mBuildFile == -2 ) )
|
| 814 |
mhunt |
838 |
{
|
| 898 |
mhunt |
839 |
buildFileContent += generatePackageProperty(p);
|
| 814 |
mhunt |
840 |
}
|
|
|
841 |
}
|
| 898 |
mhunt |
842 |
|
|
|
843 |
buildFileContent += generateTaskdef();
|
|
|
844 |
|
|
|
845 |
String set_up = new String("");
|
|
|
846 |
boolean daemonHasTarget = false;
|
|
|
847 |
|
| 864 |
mhunt |
848 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
849 |
{
|
| 864 |
mhunt |
850 |
Package p = it.next();
|
| 898 |
mhunt |
851 |
|
|
|
852 |
if ( p.mBuildFile > 0 && p.mBuildFile <= buildFile )
|
| 814 |
mhunt |
853 |
{
|
| 898 |
mhunt |
854 |
buildFileContent += generateTarget(p, buildFile);
|
|
|
855 |
|
|
|
856 |
if ( p.mBuildFile == 1 )
|
|
|
857 |
{
|
|
|
858 |
daemonHasTarget = true;
|
|
|
859 |
}
|
| 814 |
mhunt |
860 |
}
|
| 866 |
mhunt |
861 |
|
| 898 |
mhunt |
862 |
if ( !mDaemon && buildFile == 1 )
|
| 866 |
mhunt |
863 |
{
|
| 898 |
mhunt |
864 |
// for the purposes of the set up, use /
|
|
|
865 |
String loc = new String("");
|
|
|
866 |
try
|
|
|
867 |
{
|
|
|
868 |
// The regular expression "\\\\" matches an escape character "\\" and a single backslash "\\"
|
|
|
869 |
loc = p.mLocation.replaceAll("\\\\", "/");
|
|
|
870 |
}
|
|
|
871 |
catch( PatternSyntaxException e )
|
|
|
872 |
{
|
|
|
873 |
}
|
|
|
874 |
|
|
|
875 |
set_up += "jats release -extractfiles"
|
|
|
876 |
+ " \"-label=" + p.mLabel + "\""
|
|
|
877 |
+ " \"-path=" + loc + "\""
|
|
|
878 |
+ " \"-view=" + p.mAlias + "\""
|
|
|
879 |
+ " -root=. -noprefix"
|
|
|
880 |
+ lf;
|
| 866 |
mhunt |
881 |
}
|
| 814 |
mhunt |
882 |
}
|
| 898 |
mhunt |
883 |
|
|
|
884 |
if ( mDaemon && !daemonHasTarget )
|
|
|
885 |
{
|
|
|
886 |
// must have AbtSetUp, AbtTearDown, and AbtPublish targets
|
|
|
887 |
buildFileContent += "<target name=\"AbtSetUp\"/>" + lf +
|
|
|
888 |
"<target name=\"AbtTearDown\"/>" + lf +
|
|
|
889 |
"<target name=\"AbtPublish\"/>" + lf;
|
|
|
890 |
}
|
| 814 |
mhunt |
891 |
|
|
|
892 |
if ( !mDaemon && buildFile == 1 )
|
|
|
893 |
{
|
| 898 |
mhunt |
894 |
mEscrowClearcaseSupportCollection.add(set_up);
|
|
|
895 |
mEscrowClearcaseSupportCollection.add(raw_data);
|
|
|
896 |
}
|
|
|
897 |
|
|
|
898 |
buildFileContent += generateDefaultTarget( buildFile);
|
|
|
899 |
buildFileContent += generateBuildFileFooter();
|
|
|
900 |
|
|
|
901 |
mBuildCollection.add(buildFileContent);
|
|
|
902 |
|
|
|
903 |
// are more build files required
|
|
|
904 |
allProcessed = true;
|
|
|
905 |
|
|
|
906 |
if (!mDaemon)
|
|
|
907 |
{
|
|
|
908 |
// this is escrow mode centric
|
|
|
909 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 848 |
dpurdie |
910 |
{
|
| 898 |
mhunt |
911 |
Package p = it.next();
|
|
|
912 |
|
|
|
913 |
if ( p.mBuildFile > buildFile )
|
|
|
914 |
{
|
|
|
915 |
// more build files are required
|
|
|
916 |
allProcessed = false;
|
|
|
917 |
mLogger.info("planRelease reiterating package has no build requirement " + p.mName + " " + p.mBuildFile + " " + buildFile);
|
|
|
918 |
break;
|
|
|
919 |
}
|
|
|
920 |
}
|
|
|
921 |
|
|
|
922 |
buildFile++;
|
| 814 |
mhunt |
923 |
}
|
| 898 |
mhunt |
924 |
} while( !allProcessed );
|
|
|
925 |
}
|
|
|
926 |
finally
|
| 866 |
mhunt |
927 |
{
|
| 898 |
mhunt |
928 |
// this block is executed regardless of what happens in the try block
|
|
|
929 |
// even if an exception is thrown
|
|
|
930 |
// ensure the SELECT FOR UPDATE is released
|
|
|
931 |
if ( mDaemon )
|
| 866 |
mhunt |
932 |
{
|
| 898 |
mhunt |
933 |
// attempt to release the SELECT FOR UPDATE through a commit
|
|
|
934 |
// a commit must be done in the normal case
|
|
|
935 |
// a commit may as well be done in the Exception case
|
|
|
936 |
// in the case of a SQLException indicating database connectivity has been lost
|
|
|
937 |
// having a go at the commit is superfluous
|
|
|
938 |
// as the SELECT FOR UPDATE will have been released upon disconnection
|
|
|
939 |
mReleaseManager.releaseMutex();
|
| 866 |
mhunt |
940 |
}
|
| 898 |
mhunt |
941 |
|
|
|
942 |
// ensure disconnect
|
| 918 |
mhunt |
943 |
mReleaseManager.disconnectForPlanning(highProbabilityBuildRequirement);
|
| 866 |
mhunt |
944 |
}
|
|
|
945 |
|
| 814 |
mhunt |
946 |
mLogger.warn("planRelease mDaemon " + mDaemon + " returned");
|
|
|
947 |
}
|
|
|
948 |
|
| 908 |
mhunt |
949 |
/**reports what change in build exceptions happens as part of planRelease
|
|
|
950 |
*/
|
|
|
951 |
public void reportChange() throws SQLException, Exception
|
|
|
952 |
{
|
|
|
953 |
for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
|
|
|
954 |
{
|
|
|
955 |
BuildExclusion buildExclusion = it.next();
|
|
|
956 |
|
|
|
957 |
if ( !buildExclusion.isProcessed() )
|
|
|
958 |
{
|
|
|
959 |
// notify
|
|
|
960 |
buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
|
|
|
961 |
buildExclusion.email(mPackageCollection, mMailServer, mMailSender, mBaselineName, mReleaseManager);
|
|
|
962 |
}
|
|
|
963 |
}
|
|
|
964 |
}
|
|
|
965 |
|
| 814 |
mhunt |
966 |
/**returns first build file content
|
|
|
967 |
* returns false if no build file content exists
|
|
|
968 |
*/
|
|
|
969 |
public boolean getFirstBuildFileContent(MutableString content)
|
|
|
970 |
{
|
|
|
971 |
mLogger.debug("getFirstBuildFileContent");
|
|
|
972 |
boolean retVal = true;
|
|
|
973 |
|
|
|
974 |
try
|
|
|
975 |
{
|
|
|
976 |
mBuildIndex = 0;
|
|
|
977 |
content.value = (String)mBuildCollection.get( mBuildIndex );
|
|
|
978 |
}
|
|
|
979 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
980 |
{
|
|
|
981 |
retVal = false;
|
|
|
982 |
}
|
|
|
983 |
|
|
|
984 |
mLogger.info("getFirstBuildFileContent returned " + retVal);
|
|
|
985 |
return retVal;
|
|
|
986 |
}
|
|
|
987 |
|
|
|
988 |
/**returns next build file content
|
|
|
989 |
* returns false if no next build file content exists
|
|
|
990 |
*/
|
|
|
991 |
public boolean getNextBuildFileContent(MutableString content)
|
|
|
992 |
{
|
|
|
993 |
mLogger.debug("getNextBuildFileContent");
|
|
|
994 |
boolean retVal = true;
|
|
|
995 |
|
|
|
996 |
try
|
|
|
997 |
{
|
|
|
998 |
mBuildIndex++;
|
|
|
999 |
content.value = (String)mBuildCollection.get( mBuildIndex );
|
|
|
1000 |
}
|
|
|
1001 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
1002 |
{
|
|
|
1003 |
retVal = false;
|
|
|
1004 |
}
|
|
|
1005 |
|
|
|
1006 |
mLogger.debug("getNextBuildFileContent returned " + retVal);
|
|
|
1007 |
return retVal;
|
|
|
1008 |
}
|
|
|
1009 |
|
|
|
1010 |
/**collects meta data associated with the baseline
|
| 868 |
mhunt |
1011 |
* this is sufficient to send an indefinite pause email notification
|
| 814 |
mhunt |
1012 |
*/
|
| 868 |
mhunt |
1013 |
public void collectMetaData() throws SQLException, Exception
|
| 814 |
mhunt |
1014 |
{
|
|
|
1015 |
mLogger.debug("collectMetaData mDaemon " + mDaemon);
|
|
|
1016 |
mGbeMachtypeCollection.removeAllElements();
|
| 898 |
mhunt |
1017 |
|
|
|
1018 |
try
|
| 814 |
mhunt |
1019 |
{
|
| 898 |
mhunt |
1020 |
mReleaseManager.connect();
|
|
|
1021 |
mReleaseManager.queryMachtypes(mGbeMachtypeCollection, mDaemon, mBaseline);
|
|
|
1022 |
|
|
|
1023 |
if (mDaemon)
|
|
|
1024 |
{
|
|
|
1025 |
mMailServer = mReleaseManager.queryMailServer();
|
|
|
1026 |
mMailSender = mReleaseManager.queryMailSender();
|
|
|
1027 |
mGlobalTarget = mReleaseManager.queryGlobalAddresses();
|
|
|
1028 |
}
|
|
|
1029 |
mBaselineName = mReleaseManager.queryBaselineName(mDaemon, mBaseline);
|
| 814 |
mhunt |
1030 |
}
|
| 898 |
mhunt |
1031 |
finally
|
|
|
1032 |
{
|
|
|
1033 |
// this block is executed regardless of what happens in the try block
|
|
|
1034 |
// even if an exception is thrown
|
|
|
1035 |
// ensure disconnect
|
|
|
1036 |
mReleaseManager.disconnect();
|
|
|
1037 |
}
|
| 814 |
mhunt |
1038 |
}
|
|
|
1039 |
|
|
|
1040 |
/**returns the Package with the matching mAlias or NULL_PACKAGE if no package has the mID
|
|
|
1041 |
*/
|
| 908 |
mhunt |
1042 |
public Package findPackage(String alias)
|
| 814 |
mhunt |
1043 |
{
|
|
|
1044 |
mLogger.debug("findPackage");
|
|
|
1045 |
Package retVal = ReleaseManager.NULL_PACKAGE;
|
|
|
1046 |
|
| 864 |
mhunt |
1047 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1048 |
{
|
| 864 |
mhunt |
1049 |
Package p = it.next();
|
| 814 |
mhunt |
1050 |
|
|
|
1051 |
if ( p.mAlias.compareTo( alias ) == 0 )
|
|
|
1052 |
{
|
|
|
1053 |
retVal = p;
|
|
|
1054 |
break;
|
|
|
1055 |
}
|
|
|
1056 |
}
|
|
|
1057 |
|
|
|
1058 |
mLogger.info("findPackage returned " + retVal.mName);
|
|
|
1059 |
return retVal;
|
|
|
1060 |
}
|
|
|
1061 |
|
|
|
1062 |
/**sets the mBuildFile to -5 for the package and all dependent packages
|
|
|
1063 |
*/
|
| 900 |
mhunt |
1064 |
private void rippleBuildExclude(Package p, int root_pv_id, String root_cause, ListIterator<BuildExclusion> list, BuildExclusion be )
|
| 814 |
mhunt |
1065 |
{
|
|
|
1066 |
mLogger.debug("rippleBuildExclude");
|
| 874 |
mhunt |
1067 |
if ( p.mBuildFile == 0 || p.mBuildFile == 1 )
|
| 814 |
mhunt |
1068 |
{
|
|
|
1069 |
p.mBuildFile = -5;
|
| 894 |
mhunt |
1070 |
mLogger.info("rippleBuildExclude set mBuildFile to -5 for package " + p.mAlias );
|
| 866 |
mhunt |
1071 |
|
| 900 |
mhunt |
1072 |
if ( be != null )
|
| 866 |
mhunt |
1073 |
{
|
| 900 |
mhunt |
1074 |
be.process();
|
| 866 |
mhunt |
1075 |
}
|
| 900 |
mhunt |
1076 |
else
|
| 866 |
mhunt |
1077 |
{
|
| 900 |
mhunt |
1078 |
// if found, process it, else add it (unprocessed)
|
|
|
1079 |
boolean found = false;
|
| 866 |
mhunt |
1080 |
for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
|
|
|
1081 |
{
|
|
|
1082 |
BuildExclusion buildExclusion = it.next();
|
| 836 |
mhunt |
1083 |
|
| 900 |
mhunt |
1084 |
if ( buildExclusion.compare(p.mId, root_pv_id, root_cause))
|
| 866 |
mhunt |
1085 |
{
|
| 900 |
mhunt |
1086 |
found = true;
|
| 866 |
mhunt |
1087 |
buildExclusion.process();
|
| 900 |
mhunt |
1088 |
break;
|
| 866 |
mhunt |
1089 |
}
|
|
|
1090 |
}
|
|
|
1091 |
|
| 900 |
mhunt |
1092 |
if (!found)
|
| 866 |
mhunt |
1093 |
{
|
| 900 |
mhunt |
1094 |
// process all occurrences for this package
|
|
|
1095 |
// these will be superceded by a new build exclusion entry
|
|
|
1096 |
for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1097 |
{
|
| 900 |
mhunt |
1098 |
BuildExclusion buildExclusion = it.next();
|
| 814 |
mhunt |
1099 |
|
| 900 |
mhunt |
1100 |
if ( buildExclusion.compare(p.mId))
|
| 814 |
mhunt |
1101 |
{
|
| 900 |
mhunt |
1102 |
buildExclusion.process();
|
| 814 |
mhunt |
1103 |
}
|
|
|
1104 |
}
|
| 900 |
mhunt |
1105 |
|
| 908 |
mhunt |
1106 |
BuildExclusion buildExclusion = new BuildExclusion(p.mId, root_pv_id, root_cause, p.mTestBuildInstruction);
|
| 900 |
mhunt |
1107 |
|
|
|
1108 |
if ( list == null )
|
|
|
1109 |
{
|
|
|
1110 |
mBuildExclusionCollection.add(buildExclusion);
|
|
|
1111 |
}
|
|
|
1112 |
else
|
|
|
1113 |
{
|
|
|
1114 |
// must use the ListIterator interface to add to the collection whilst iterating through it
|
|
|
1115 |
list.add(buildExclusion);
|
|
|
1116 |
}
|
| 814 |
mhunt |
1117 |
}
|
|
|
1118 |
}
|
|
|
1119 |
|
| 908 |
mhunt |
1120 |
// only ripple a test build failure through for non test builds
|
|
|
1121 |
if ( p.mTestBuildInstruction == 0 )
|
| 866 |
mhunt |
1122 |
{
|
| 908 |
mhunt |
1123 |
// non test build
|
|
|
1124 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 866 |
mhunt |
1125 |
{
|
| 908 |
mhunt |
1126 |
Package pkg = it.next();
|
|
|
1127 |
|
|
|
1128 |
if ( pkg != p )
|
| 866 |
mhunt |
1129 |
{
|
| 908 |
mhunt |
1130 |
for (Iterator<Package> it2 = pkg.mPackageDependencyCollection.iterator(); it2.hasNext(); )
|
| 866 |
mhunt |
1131 |
{
|
| 908 |
mhunt |
1132 |
Package dependency = it2.next();
|
|
|
1133 |
|
|
|
1134 |
if ( dependency == p )
|
|
|
1135 |
{
|
|
|
1136 |
rippleBuildExclude( pkg, root_pv_id, null, list, null );
|
|
|
1137 |
break;
|
|
|
1138 |
}
|
| 866 |
mhunt |
1139 |
}
|
|
|
1140 |
}
|
|
|
1141 |
}
|
|
|
1142 |
}
|
|
|
1143 |
}
|
|
|
1144 |
mLogger.info("rippleBuildExclude set " + p.mName + " " + p.mBuildFile);
|
|
|
1145 |
}
|
|
|
1146 |
|
| 814 |
mhunt |
1147 |
/**returns a build file header for the mBaseline
|
|
|
1148 |
*/
|
|
|
1149 |
private String generateBuildFileHeader()
|
|
|
1150 |
{
|
|
|
1151 |
mLogger.debug("generateBuildFileHeader");
|
|
|
1152 |
String lf = new String( System.getProperty("line.separator") );
|
|
|
1153 |
String retVal = new String("");
|
|
|
1154 |
retVal +=
|
| 862 |
mhunt |
1155 |
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>" + lf +
|
| 814 |
mhunt |
1156 |
"<project name=\"mass\" default=\"full\" basedir=\".\">" + lf;
|
|
|
1157 |
|
|
|
1158 |
if ( mDaemon )
|
|
|
1159 |
{
|
|
|
1160 |
retVal +=
|
|
|
1161 |
"<property name=\"abt_mail_server\" value=\"" + mMailServer + "\"/>" + lf +
|
|
|
1162 |
"<property name=\"abt_mail_sender\" value=\"" + mMailSender + "\"/>" + lf +
|
|
|
1163 |
"<property name=\"abt_rtag_id\" value=\"" + mBaseline + "\"/>" + lf +
|
|
|
1164 |
"<property name=\"abt_daemon\" value=\"" + mTimestamp + "\"/>" + lf;
|
| 866 |
mhunt |
1165 |
|
|
|
1166 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
|
|
1167 |
{
|
|
|
1168 |
Package p = it.next();
|
|
|
1169 |
|
|
|
1170 |
if ( p.mBuildFile == 1 )
|
|
|
1171 |
{
|
|
|
1172 |
retVal +=
|
|
|
1173 |
"<property name=\"abt_package_name\" value=\"" + p.mName + "\"/>" + lf +
|
|
|
1174 |
"<property name=\"abt_package_version\" value=\"" + p.mVersion + p.mExtension + "\"/>" + lf +
|
|
|
1175 |
"<property name=\"abt_package_extension\" value=\"" + p.mExtension + "\"/>" + lf +
|
|
|
1176 |
loc(p, "abt_package_location", lf) +
|
|
|
1177 |
"<property name=\"abt_package_depends\" value=\"";
|
|
|
1178 |
|
|
|
1179 |
// depends in the form 'cs','25.1.0000.cr';'Dinkumware_STL','1.0.0.cots'
|
|
|
1180 |
String depends = new String();
|
|
|
1181 |
|
|
|
1182 |
for (Iterator<Package> it3 = p.mPackageDependencyCollection.iterator(); it3.hasNext(); )
|
|
|
1183 |
{
|
|
|
1184 |
Package depend = it3.next();
|
|
|
1185 |
|
|
|
1186 |
if ( depends.compareTo( "" ) != 0 )
|
|
|
1187 |
{
|
|
|
1188 |
depends += ";";
|
|
|
1189 |
}
|
|
|
1190 |
depends += "\'" + depend.mName + "\'";
|
|
|
1191 |
depends += ",";
|
|
|
1192 |
String dependsExtension = depend.mExtension;
|
|
|
1193 |
String dependsVersion = depend.mVersion;
|
|
|
1194 |
|
|
|
1195 |
if ( dependsExtension.length() > 0 )
|
|
|
1196 |
{
|
|
|
1197 |
dependsVersion += dependsExtension;
|
|
|
1198 |
}
|
|
|
1199 |
else
|
|
|
1200 |
{
|
|
|
1201 |
dependsExtension = ".";
|
|
|
1202 |
}
|
|
|
1203 |
depends += "\'" + dependsVersion + "\'";
|
|
|
1204 |
}
|
|
|
1205 |
|
|
|
1206 |
retVal += depends + "\"/>" + lf +
|
|
|
1207 |
"<property name=\"abt_is_ripple\" value=\"";
|
|
|
1208 |
|
|
|
1209 |
if ( p.mDirectlyPlanned )
|
|
|
1210 |
{
|
|
|
1211 |
retVal += "0";
|
|
|
1212 |
}
|
|
|
1213 |
else
|
|
|
1214 |
{
|
|
|
1215 |
retVal += "1";
|
|
|
1216 |
}
|
|
|
1217 |
|
|
|
1218 |
retVal += "\"/>" + lf +
|
|
|
1219 |
"<property name=\"abt_package_version_id\" value=\"" + p.mId + "\"/>" + lf +
|
|
|
1220 |
"<property name=\"abt_does_not_require_source_control_interaction\" value=\"";
|
|
|
1221 |
|
|
|
1222 |
if ( ! p.mRequiresSourceControlInteraction )
|
|
|
1223 |
{
|
|
|
1224 |
retVal += "true";
|
|
|
1225 |
}
|
|
|
1226 |
else
|
|
|
1227 |
{
|
|
|
1228 |
retVal += "false";
|
|
|
1229 |
}
|
|
|
1230 |
|
| 908 |
mhunt |
1231 |
retVal += "\"/>" + lf +
|
|
|
1232 |
"<property name=\"abt_test_build_instruction\" value=\"" + p.mTestBuildInstruction + "\"/>" + lf;
|
| 866 |
mhunt |
1233 |
}
|
|
|
1234 |
}
|
| 814 |
mhunt |
1235 |
}
|
|
|
1236 |
else
|
|
|
1237 |
{
|
|
|
1238 |
retVal +=
|
|
|
1239 |
"<property name=\"abt_rtag_id\" value=\"-1\"/>" + lf;
|
|
|
1240 |
}
|
|
|
1241 |
|
| 822 |
mhunt |
1242 |
String majorVersionNumber = this.getClass().getPackage().getSpecificationVersion();
|
|
|
1243 |
|
| 864 |
mhunt |
1244 |
if ( !ReleaseManager.mUseDatabase )
|
| 822 |
mhunt |
1245 |
{
|
|
|
1246 |
// hard code 11 for unit test purposes
|
|
|
1247 |
majorVersionNumber = "11";
|
|
|
1248 |
}
|
|
|
1249 |
|
| 814 |
mhunt |
1250 |
retVal +=
|
|
|
1251 |
"<property name=\"abt_release\" value=\"" + mBaselineName + "\"/>" + lf +
|
| 822 |
mhunt |
1252 |
"<property name=\"abt_buildtool_version\" value=\""+ majorVersionNumber + "\"/>" + lf +
|
| 814 |
mhunt |
1253 |
"<condition property=\"abt_family\" value=\"windows\">" + lf +
|
|
|
1254 |
" <os family=\"windows\"/>" + lf +
|
|
|
1255 |
"</condition>" + lf +
|
|
|
1256 |
"<property name=\"abt_family\" value=\"unix\"/>" + lf;
|
|
|
1257 |
mLogger.info("generateBuildFileHeader returned " + retVal);
|
|
|
1258 |
return retVal;
|
|
|
1259 |
}
|
|
|
1260 |
|
|
|
1261 |
/**returns an ant property for the passed Package
|
|
|
1262 |
*/
|
|
|
1263 |
private String generatePackageProperty(Package p)
|
|
|
1264 |
{
|
|
|
1265 |
mLogger.debug("generatePackageProperty");
|
|
|
1266 |
String lf = new String( System.getProperty("line.separator") );
|
|
|
1267 |
String retVal = new String("");
|
|
|
1268 |
retVal +=
|
|
|
1269 |
"<property name=\"" + p.mAlias + "\" value=\"" + p.mName + " " + p.mVersion + p.mExtension + "\"/>" + lf;
|
|
|
1270 |
mLogger.info("generatePackageProperty returned " + retVal);
|
|
|
1271 |
return retVal;
|
|
|
1272 |
}
|
|
|
1273 |
|
|
|
1274 |
/**returns an ant taskdef for the abt ant task
|
|
|
1275 |
*/
|
|
|
1276 |
private String generateTaskdef()
|
|
|
1277 |
{
|
|
|
1278 |
mLogger.debug("generateTaskdef");
|
|
|
1279 |
String lf = new String( System.getProperty("line.separator") );
|
|
|
1280 |
String retVal = new String("");
|
|
|
1281 |
retVal +=
|
| 866 |
mhunt |
1282 |
"<taskdef name=\"abt\" classname=\"com.erggroup.buildtool.abt.ABT\"/>" + lf;
|
| 814 |
mhunt |
1283 |
return retVal;
|
|
|
1284 |
}
|
|
|
1285 |
|
|
|
1286 |
/**returns an ant target for the passed Package
|
|
|
1287 |
* in daemon mode:
|
|
|
1288 |
* packages are categorised with one of three mBuildFile values:
|
|
|
1289 |
* 1 the package to be built by this buildfile
|
|
|
1290 |
* 2 the packages with a future build requirement
|
|
|
1291 |
* 3 the packages with no build requirement
|
|
|
1292 |
* the returned target depends on this categorisation and will have
|
|
|
1293 |
* 1 full abt info
|
|
|
1294 |
* 2 full dependency info to determine future build ordering but no abt info (will not build this package)
|
|
|
1295 |
* 3 only a name attribute (will not build this package)
|
|
|
1296 |
* in escrow mode:
|
|
|
1297 |
* if the passed Package's mBuildFile is different (less than) the passed build file,
|
|
|
1298 |
* the returned target have only a name attribute (will not build this package)
|
|
|
1299 |
*/
|
|
|
1300 |
private String generateTarget(Package p, int buildFile)
|
|
|
1301 |
{
|
|
|
1302 |
mLogger.debug("generateTarget");
|
|
|
1303 |
|
| 832 |
mhunt |
1304 |
if ( ( mDaemon && p.mBuildFile == 1 ) || ( !mDaemon && !p.isGeneric() ) )
|
| 814 |
mhunt |
1305 |
{
|
|
|
1306 |
// populate 'missing' BuildStandards
|
|
|
1307 |
boolean solaris = false;
|
|
|
1308 |
boolean linux = false;
|
|
|
1309 |
boolean win32 = false;
|
|
|
1310 |
boolean jats = false;
|
|
|
1311 |
boolean determinedBuildStandard = false;
|
|
|
1312 |
|
| 864 |
mhunt |
1313 |
for (Iterator<BuildStandard> it = p.mBuildStandardCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1314 |
{
|
| 864 |
mhunt |
1315 |
BuildStandard bs = it.next();
|
| 814 |
mhunt |
1316 |
|
|
|
1317 |
if ( bs.getSolaris() )
|
|
|
1318 |
{
|
|
|
1319 |
solaris = true;
|
|
|
1320 |
}
|
|
|
1321 |
else
|
|
|
1322 |
if ( bs.getLinux() )
|
|
|
1323 |
{
|
|
|
1324 |
linux = true;
|
|
|
1325 |
}
|
|
|
1326 |
else
|
|
|
1327 |
if ( bs.getWin32() )
|
|
|
1328 |
{
|
|
|
1329 |
win32 = true;
|
|
|
1330 |
}
|
|
|
1331 |
|
| 908 |
mhunt |
1332 |
if ( !determinedBuildStandard && bs.getBuildStandard(!ReleaseManager.mUseDatabase, true).contains("<jats") )
|
| 814 |
mhunt |
1333 |
{
|
|
|
1334 |
jats = true;
|
|
|
1335 |
determinedBuildStandard = true;
|
|
|
1336 |
}
|
|
|
1337 |
}
|
|
|
1338 |
|
|
|
1339 |
if ( !solaris )
|
|
|
1340 |
{
|
|
|
1341 |
BuildStandard bs = new BuildStandard(this);
|
|
|
1342 |
bs.setSolaris();
|
|
|
1343 |
|
|
|
1344 |
if ( jats )
|
|
|
1345 |
{
|
|
|
1346 |
bs.setJatsNone();
|
|
|
1347 |
}
|
|
|
1348 |
else
|
|
|
1349 |
{
|
|
|
1350 |
bs.setAntNone();
|
|
|
1351 |
}
|
|
|
1352 |
|
|
|
1353 |
p.mBuildStandardCollection.add(bs);
|
|
|
1354 |
}
|
|
|
1355 |
|
|
|
1356 |
if ( !linux )
|
|
|
1357 |
{
|
|
|
1358 |
BuildStandard bs = new BuildStandard(this);
|
|
|
1359 |
bs.setLinux();
|
|
|
1360 |
|
|
|
1361 |
if ( jats )
|
|
|
1362 |
{
|
|
|
1363 |
bs.setJatsNone();
|
|
|
1364 |
}
|
|
|
1365 |
else
|
|
|
1366 |
{
|
|
|
1367 |
bs.setAntNone();
|
|
|
1368 |
}
|
|
|
1369 |
|
|
|
1370 |
p.mBuildStandardCollection.add(bs);
|
|
|
1371 |
}
|
|
|
1372 |
|
|
|
1373 |
if ( !win32 )
|
|
|
1374 |
{
|
|
|
1375 |
BuildStandard bs = new BuildStandard(this);
|
|
|
1376 |
bs.setWin32();
|
|
|
1377 |
|
|
|
1378 |
if ( jats )
|
|
|
1379 |
{
|
|
|
1380 |
bs.setJatsNone();
|
|
|
1381 |
}
|
|
|
1382 |
else
|
|
|
1383 |
{
|
|
|
1384 |
bs.setAntNone();
|
|
|
1385 |
}
|
|
|
1386 |
|
|
|
1387 |
p.mBuildStandardCollection.add(bs);
|
|
|
1388 |
}
|
|
|
1389 |
}
|
|
|
1390 |
|
|
|
1391 |
String lf = new String( System.getProperty("line.separator") );
|
|
|
1392 |
String retVal = new String("");
|
|
|
1393 |
|
|
|
1394 |
if ( ( mDaemon && p.mBuildFile == 3 ) ||
|
|
|
1395 |
( !mDaemon && ( p.mBuildFile < buildFile ) ) )
|
|
|
1396 |
{
|
|
|
1397 |
retVal +=
|
|
|
1398 |
"<target name=\"" + p.mAlias + "\"/>" + lf;
|
|
|
1399 |
}
|
|
|
1400 |
else
|
|
|
1401 |
{
|
| 848 |
dpurdie |
1402 |
retVal +=
|
| 814 |
mhunt |
1403 |
"<target name=\"" + p.mAlias + ".wrap\"";
|
|
|
1404 |
|
|
|
1405 |
if ( p.mPackageDependencyCollection.size() > 0 )
|
|
|
1406 |
{
|
|
|
1407 |
retVal +=" depends=\"";
|
|
|
1408 |
boolean comma = false;
|
|
|
1409 |
|
| 864 |
mhunt |
1410 |
for (Iterator<Package> it = p.mPackageDependencyCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1411 |
{
|
| 906 |
mhunt |
1412 |
Package dependency = it.next();
|
|
|
1413 |
// DEVI 54816
|
|
|
1414 |
if ( !mDaemon && dependency.mBuildFile == -2 )
|
|
|
1415 |
{
|
|
|
1416 |
// ignore targets which build in foreign environments in escrow mode
|
|
|
1417 |
continue;
|
|
|
1418 |
}
|
| 814 |
mhunt |
1419 |
if (comma)
|
|
|
1420 |
{
|
|
|
1421 |
retVal += ",";
|
|
|
1422 |
}
|
|
|
1423 |
comma = true;
|
|
|
1424 |
|
|
|
1425 |
retVal += dependency.mAlias;
|
|
|
1426 |
}
|
|
|
1427 |
|
|
|
1428 |
retVal += "\"";
|
|
|
1429 |
}
|
|
|
1430 |
retVal += ">" + lf;
|
|
|
1431 |
|
|
|
1432 |
if ( !mDaemon )
|
|
|
1433 |
{
|
|
|
1434 |
boolean hasDependenciesBuiltInThisIteration = false;
|
|
|
1435 |
if ( ( p.mPackageDependencyCollection.size() > 0 ) )
|
|
|
1436 |
{
|
| 864 |
mhunt |
1437 |
for (Iterator<Package> it = p.mPackageDependencyCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1438 |
{
|
| 864 |
mhunt |
1439 |
Package dependency = it.next();
|
| 814 |
mhunt |
1440 |
|
|
|
1441 |
if ( dependency.mBuildFile == buildFile )
|
|
|
1442 |
{
|
|
|
1443 |
hasDependenciesBuiltInThisIteration = true;
|
|
|
1444 |
break;
|
|
|
1445 |
}
|
|
|
1446 |
}
|
|
|
1447 |
}
|
|
|
1448 |
|
|
|
1449 |
if ( hasDependenciesBuiltInThisIteration )
|
|
|
1450 |
{
|
|
|
1451 |
retVal +=
|
|
|
1452 |
" <condition property=\"" + p.mAlias + ".build\">" + lf +
|
|
|
1453 |
" <and>" + lf;
|
|
|
1454 |
|
| 864 |
mhunt |
1455 |
for (Iterator<Package> it = p.mPackageDependencyCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1456 |
{
|
| 864 |
mhunt |
1457 |
Package dependency = it.next();
|
| 814 |
mhunt |
1458 |
|
|
|
1459 |
if ( dependency.mBuildFile == buildFile )
|
|
|
1460 |
{
|
|
|
1461 |
retVal +=
|
|
|
1462 |
" <or>" + lf +
|
|
|
1463 |
" <equals arg1=\"${" + dependency.mAlias + ".res}\" arg2=\"0\"/>" + lf +
|
|
|
1464 |
" <equals arg1=\"${" + dependency.mAlias + ".res}\" arg2=\"257\"/>" + lf +
|
|
|
1465 |
" </or>" + lf;
|
|
|
1466 |
}
|
|
|
1467 |
}
|
|
|
1468 |
|
|
|
1469 |
retVal +=
|
|
|
1470 |
" </and>" + lf +
|
|
|
1471 |
" </condition>" + lf;
|
|
|
1472 |
}
|
|
|
1473 |
else
|
|
|
1474 |
{
|
|
|
1475 |
retVal += " <property name=\"" + p.mAlias + ".build\" value=\"\"/>" + lf;
|
|
|
1476 |
}
|
|
|
1477 |
}
|
|
|
1478 |
|
|
|
1479 |
retVal +=
|
|
|
1480 |
"</target>" + lf +
|
|
|
1481 |
"<target name=\"" + p.mAlias + "\" depends=\"" + p.mAlias + ".wrap\"";
|
|
|
1482 |
|
|
|
1483 |
if ( !mDaemon )
|
|
|
1484 |
{
|
|
|
1485 |
retVal += " if=\"" + p.mAlias + ".build\"";
|
|
|
1486 |
}
|
|
|
1487 |
|
|
|
1488 |
retVal += ">" + lf;
|
|
|
1489 |
|
|
|
1490 |
if ( mDaemon && p.mBuildFile == 1 )
|
|
|
1491 |
{
|
|
|
1492 |
retVal +=
|
|
|
1493 |
"<property name=\"" + p.mAlias + "pkg_id\" value=\"" + p.mPid + "\"/>" + lf +
|
|
|
1494 |
"<property name=\"" + p.mAlias + "pv_id\" value=\"" + p.mId + "\"/>" + lf;
|
|
|
1495 |
}
|
|
|
1496 |
|
|
|
1497 |
if ( ( mDaemon && p.mBuildFile == 1 ) || !mDaemon )
|
|
|
1498 |
{
|
|
|
1499 |
retVal +=
|
|
|
1500 |
"<property name=\"" + p.mAlias + "packagename\" value=\"" + p.mName + "\"/>" + lf +
|
|
|
1501 |
"<property name=\"" + p.mAlias + "packageversion\" value=\"" + p.mVersion + "\"/>" + lf +
|
|
|
1502 |
"<property name=\"" + p.mAlias + "packageextension\" value=\"";
|
|
|
1503 |
|
|
|
1504 |
if ( p.mExtension.length() > 0 )
|
|
|
1505 |
{
|
|
|
1506 |
// drop the .
|
|
|
1507 |
retVal += p.mExtension.substring(1);
|
|
|
1508 |
}
|
|
|
1509 |
else
|
|
|
1510 |
{
|
|
|
1511 |
retVal += p.mExtension;
|
|
|
1512 |
}
|
|
|
1513 |
|
|
|
1514 |
retVal += "\"/>" + lf +
|
|
|
1515 |
"<property name=\"" + p.mAlias + "packagelabel\" value=\"" + p.mLabel + "\"/>" + lf;
|
|
|
1516 |
|
|
|
1517 |
if ( p.mDirectlyPlanned )
|
|
|
1518 |
{
|
|
|
1519 |
retVal += "<property name=\"" + p.mAlias + "directchange\" value=\"\"/>" + lf;
|
|
|
1520 |
}
|
|
|
1521 |
|
| 852 |
mhunt |
1522 |
if ( ! p.mRequiresSourceControlInteraction )
|
|
|
1523 |
{
|
|
|
1524 |
retVal += "<property name=\"" + p.mAlias + "doesnotrequiresourcecontrolinteraction\" value=\"\"/>" + lf;
|
|
|
1525 |
}
|
|
|
1526 |
|
| 814 |
mhunt |
1527 |
mAddendum = "non generic";
|
|
|
1528 |
|
|
|
1529 |
if ( p.isGeneric() )
|
|
|
1530 |
{
|
|
|
1531 |
mAddendum = "generic";
|
|
|
1532 |
retVal += "<property name=\"" + p.mAlias + "generic\" value=\"\"/>" + lf;
|
|
|
1533 |
}
|
|
|
1534 |
|
|
|
1535 |
retVal += loc(p, p.mAlias + "loc", lf);
|
|
|
1536 |
|
| 830 |
mhunt |
1537 |
if ( p.mHasAutomatedUnitTests && mDaemon )
|
| 814 |
mhunt |
1538 |
{
|
|
|
1539 |
retVal +=
|
|
|
1540 |
"<property name=\"" + p.mAlias + "unittests\" value=\"\"/>" + lf;
|
|
|
1541 |
}
|
|
|
1542 |
}
|
|
|
1543 |
|
|
|
1544 |
retVal += "<abt>" + lf;
|
|
|
1545 |
|
|
|
1546 |
if ( ( mDaemon && p.mBuildFile == 1 ) || !mDaemon )
|
|
|
1547 |
{
|
| 864 |
mhunt |
1548 |
for (Iterator<Package> it = p.mPackageDependencyCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1549 |
{
|
| 864 |
mhunt |
1550 |
Package dependency = it.next();
|
| 814 |
mhunt |
1551 |
retVal +=
|
|
|
1552 |
" <depend package_alias=\"${" + dependency.mAlias + "}\"/>" + lf;
|
|
|
1553 |
}
|
|
|
1554 |
|
| 836 |
mhunt |
1555 |
retVal += buildInfo(p, lf, false);
|
| 814 |
mhunt |
1556 |
}
|
|
|
1557 |
|
|
|
1558 |
if ( mDaemon && p.mBuildFile == 1 )
|
|
|
1559 |
{
|
| 854 |
mhunt |
1560 |
retVal += p.emailInfo( lf );
|
| 814 |
mhunt |
1561 |
}
|
|
|
1562 |
|
|
|
1563 |
retVal += "</abt>" + lf +
|
|
|
1564 |
"</target>" + lf;
|
|
|
1565 |
|
|
|
1566 |
if ( mDaemon && p.mBuildFile == 1 )
|
|
|
1567 |
{
|
|
|
1568 |
retVal +=
|
|
|
1569 |
"<target name=\"AbtSetUp\">" + lf +
|
| 854 |
mhunt |
1570 |
"<property name=\"AbtSetUppackagelabel\" value=\"" + p.mLabel + "\"/>" + lf +
|
| 872 |
dpurdie |
1571 |
"<property name=\"AbtSetUppackagename\" value=\"" + p.mName + "\"/>" + lf +
|
|
|
1572 |
"<property name=\"AbtSetUppackageSrcPath\" value=\"" + p.mLocation.replace('\\', '/') + "\"/>" + lf;
|
| 814 |
mhunt |
1573 |
|
|
|
1574 |
retVal +=
|
|
|
1575 |
"<abt>" + lf +
|
| 854 |
mhunt |
1576 |
p.emailInfo( lf ) +
|
| 814 |
mhunt |
1577 |
"</abt>" + lf +
|
| 872 |
dpurdie |
1578 |
"</target>" + lf;
|
|
|
1579 |
|
|
|
1580 |
retVal +=
|
| 814 |
mhunt |
1581 |
"<target name=\"AbtTearDown\">" + lf +
|
|
|
1582 |
"<property name=\"AbtTearDownpackagelabel\" value=\"" + p.mLabel + "\"/>" + lf +
|
|
|
1583 |
"<property name=\"AbtTearDownpackagename\" value=\"" + p.mName + "\"/>" + lf +
|
|
|
1584 |
"<property name=\"AbtTearDownpackageversion\" value=\"" + p.mVersion + "\"/>" + lf +
|
|
|
1585 |
"<property name=\"AbtTearDownpackageextension\" value=\"";
|
|
|
1586 |
|
|
|
1587 |
if ( p.mExtension.length() > 0 )
|
|
|
1588 |
{
|
|
|
1589 |
// drop the .
|
|
|
1590 |
retVal += p.mExtension.substring(1);
|
|
|
1591 |
}
|
|
|
1592 |
else
|
|
|
1593 |
{
|
|
|
1594 |
retVal += p.mExtension;
|
|
|
1595 |
}
|
|
|
1596 |
|
|
|
1597 |
retVal += "\"/>" + lf;
|
|
|
1598 |
|
|
|
1599 |
if ( p.isGeneric() )
|
|
|
1600 |
{
|
|
|
1601 |
retVal += "<property name=\"" + p.mAlias + "generic\" value=\"\"/>" + lf;
|
|
|
1602 |
}
|
|
|
1603 |
|
|
|
1604 |
retVal +=
|
|
|
1605 |
"<abt>" + lf +
|
| 836 |
mhunt |
1606 |
buildInfo(p, lf, false) +
|
| 854 |
mhunt |
1607 |
p.emailInfo( lf ) +
|
| 814 |
mhunt |
1608 |
"</abt>" + lf +
|
|
|
1609 |
"</target>" + lf +
|
|
|
1610 |
"<target name=\"AbtPublish\">" + lf +
|
|
|
1611 |
"<property name=\"AbtPublishpackagelabel\" value=\"" + p.mLabel + "\"/>" + lf +
|
|
|
1612 |
"<property name=\"AbtPublishpackagename\" value=\"" + p.mName + "\"/>" + lf +
|
|
|
1613 |
"<property name=\"AbtPublishpackageversion\" value=\"" + p.mVersion + "\"/>" + lf +
|
|
|
1614 |
"<property name=\"AbtPublishpackageextension\" value=\"";
|
|
|
1615 |
|
|
|
1616 |
if ( p.mExtension.length() > 0 )
|
|
|
1617 |
{
|
|
|
1618 |
// drop the .
|
|
|
1619 |
retVal += p.mExtension.substring(1);
|
|
|
1620 |
}
|
|
|
1621 |
else
|
|
|
1622 |
{
|
|
|
1623 |
retVal += p.mExtension;
|
|
|
1624 |
}
|
|
|
1625 |
|
|
|
1626 |
retVal += "\"/>" + lf;
|
|
|
1627 |
|
|
|
1628 |
if ( p.mDirectlyPlanned )
|
|
|
1629 |
{
|
|
|
1630 |
retVal += "<property name=\"AbtPublishdirectchange\" value=\"\"/>" + lf;
|
|
|
1631 |
}
|
|
|
1632 |
|
| 852 |
mhunt |
1633 |
if ( ! p.mRequiresSourceControlInteraction )
|
|
|
1634 |
{
|
|
|
1635 |
retVal += "<property name=\"AbtPublishdoesnotrequiresourcecontrolinteraction\" value=\"\"/>" + lf;
|
|
|
1636 |
}
|
|
|
1637 |
|
| 814 |
mhunt |
1638 |
if ( p.isGeneric() )
|
|
|
1639 |
{
|
|
|
1640 |
retVal += "<property name=\"AbtPublishgeneric\" value=\"\"/>" + lf;
|
|
|
1641 |
}
|
|
|
1642 |
|
|
|
1643 |
retVal += loc(p, "AbtPublishloc", lf);
|
|
|
1644 |
retVal +=
|
| 816 |
mhunt |
1645 |
"<abt>" + lf +
|
| 854 |
mhunt |
1646 |
buildInfo(p, lf, true) +
|
|
|
1647 |
p.emailInfo( lf ) +
|
| 814 |
mhunt |
1648 |
"</abt>" + lf +
|
|
|
1649 |
"</target>" + lf;
|
|
|
1650 |
}
|
|
|
1651 |
}
|
|
|
1652 |
mLogger.info("generateTarget returned " + retVal);
|
|
|
1653 |
return retVal;
|
|
|
1654 |
}
|
|
|
1655 |
|
|
|
1656 |
/**returns an ant default target for the current build iteration
|
|
|
1657 |
*/
|
|
|
1658 |
private String generateDefaultTarget(int buildFile)
|
|
|
1659 |
{
|
|
|
1660 |
mLogger.debug("generateDefaultTarget");
|
|
|
1661 |
String lf = new String( System.getProperty("line.separator") );
|
|
|
1662 |
String retVal = new String("");
|
|
|
1663 |
retVal +=
|
|
|
1664 |
"<target name=\"fullstart\">" + lf;
|
|
|
1665 |
|
|
|
1666 |
if (buildFile == 1)
|
|
|
1667 |
{
|
|
|
1668 |
retVal +=
|
| 906 |
mhunt |
1669 |
"<echo message=\"${line.separator}" + mAnyBuildPlatforms + "${line.separator}${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
| 814 |
mhunt |
1670 |
|
| 864 |
mhunt |
1671 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1672 |
{
|
| 864 |
mhunt |
1673 |
Package p = it.next();
|
| 814 |
mhunt |
1674 |
|
|
|
1675 |
if ( p.mBuildFile == -1 )
|
|
|
1676 |
{
|
|
|
1677 |
retVal +=
|
|
|
1678 |
"<echo message=\"${line.separator}" + p.mAlias + "${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
|
|
1679 |
}
|
|
|
1680 |
}
|
|
|
1681 |
|
|
|
1682 |
retVal +=
|
| 906 |
mhunt |
1683 |
"<echo message=\"${line.separator}" + mAssocBuildPlatforms + "${line.separator}${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
| 814 |
mhunt |
1684 |
|
| 864 |
mhunt |
1685 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1686 |
{
|
| 864 |
mhunt |
1687 |
Package p = it.next();
|
| 814 |
mhunt |
1688 |
|
|
|
1689 |
if ( p.mBuildFile == -2 )
|
|
|
1690 |
{
|
|
|
1691 |
retVal +=
|
|
|
1692 |
"<echo message=\"${line.separator}" + p.mAlias + "${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
|
|
1693 |
}
|
|
|
1694 |
}
|
|
|
1695 |
|
|
|
1696 |
retVal +=
|
| 906 |
mhunt |
1697 |
"<echo message=\"${line.separator}" + mNotInBaseline + "${line.separator}${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
| 814 |
mhunt |
1698 |
|
| 864 |
mhunt |
1699 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1700 |
{
|
| 864 |
mhunt |
1701 |
Package p = it.next();
|
| 814 |
mhunt |
1702 |
|
|
|
1703 |
if ( p.mBuildFile == -4 )
|
|
|
1704 |
{
|
|
|
1705 |
retVal +=
|
|
|
1706 |
"<echo message=\"${line.separator}" + p.mAlias + "${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
|
|
1707 |
}
|
|
|
1708 |
}
|
|
|
1709 |
|
|
|
1710 |
retVal +=
|
| 906 |
mhunt |
1711 |
"<echo message=\"${line.separator}" + mDependent + "${line.separator}${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
| 814 |
mhunt |
1712 |
|
| 864 |
mhunt |
1713 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1714 |
{
|
| 864 |
mhunt |
1715 |
Package p = it.next();
|
| 814 |
mhunt |
1716 |
|
|
|
1717 |
if ( p.mBuildFile == -5 )
|
|
|
1718 |
{
|
|
|
1719 |
retVal +=
|
|
|
1720 |
"<echo message=\"${line.separator}" + p.mAlias + "${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
|
|
1721 |
}
|
|
|
1722 |
}
|
|
|
1723 |
}
|
|
|
1724 |
if ( !mDaemon )
|
|
|
1725 |
{
|
|
|
1726 |
retVal +=
|
|
|
1727 |
"<echo message=\"${line.separator}Build Started:${line.separator}${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
|
|
1728 |
}
|
|
|
1729 |
|
|
|
1730 |
retVal +=
|
|
|
1731 |
"</target>" + lf +
|
|
|
1732 |
"<target name=\"full\" depends=\"fullstart";
|
|
|
1733 |
|
| 864 |
mhunt |
1734 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1735 |
{
|
| 864 |
mhunt |
1736 |
Package p = it.next();
|
| 814 |
mhunt |
1737 |
|
|
|
1738 |
if ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) )
|
|
|
1739 |
{
|
|
|
1740 |
retVal += "," + p.mAlias;
|
|
|
1741 |
}
|
|
|
1742 |
}
|
|
|
1743 |
|
|
|
1744 |
retVal +=
|
|
|
1745 |
"\">" + lf;
|
|
|
1746 |
|
|
|
1747 |
if ( !mDaemon )
|
|
|
1748 |
{
|
|
|
1749 |
retVal +=
|
|
|
1750 |
"<echo message=\"${line.separator}Build Finished${line.separator}\" file=\"publish.log\" append=\"true\"/>" + lf;
|
|
|
1751 |
}
|
|
|
1752 |
|
|
|
1753 |
retVal +=
|
|
|
1754 |
"</target>" + lf;
|
|
|
1755 |
return retVal;
|
|
|
1756 |
}
|
|
|
1757 |
|
|
|
1758 |
/**returns a build file footer
|
|
|
1759 |
*/
|
|
|
1760 |
private String generateBuildFileFooter()
|
|
|
1761 |
{
|
|
|
1762 |
mLogger.debug("generateBuildFileFooter");
|
|
|
1763 |
String retVal = new String("</project>");
|
|
|
1764 |
return retVal;
|
|
|
1765 |
}
|
|
|
1766 |
|
|
|
1767 |
/**sets the mIndirectlyPlanned true for the package and all dependent packages
|
|
|
1768 |
*/
|
|
|
1769 |
private void rippleIndirectlyPlanned(Package p)
|
|
|
1770 |
{
|
|
|
1771 |
mLogger.debug("rippleIndirectlyPlanned");
|
|
|
1772 |
if ( !p.mIndirectlyPlanned && p.mBuildFile == 0 )
|
|
|
1773 |
{
|
|
|
1774 |
p.mIndirectlyPlanned = true;
|
|
|
1775 |
|
| 864 |
mhunt |
1776 |
for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
1777 |
{
|
| 864 |
mhunt |
1778 |
Package pkg = it.next();
|
| 814 |
mhunt |
1779 |
|
|
|
1780 |
if ( pkg != p )
|
|
|
1781 |
{
|
| 864 |
mhunt |
1782 |
for (Iterator<Package> it2 = pkg.mPackageDependencyCollection.iterator(); it2.hasNext(); )
|
| 814 |
mhunt |
1783 |
{
|
| 864 |
mhunt |
1784 |
Package dependency = it2.next();
|
| 814 |
mhunt |
1785 |
|
|
|
1786 |
if ( dependency == p )
|
|
|
1787 |
{
|
|
|
1788 |
rippleIndirectlyPlanned( pkg );
|
|
|
1789 |
break;
|
|
|
1790 |
}
|
|
|
1791 |
}
|
|
|
1792 |
}
|
|
|
1793 |
}
|
|
|
1794 |
}
|
|
|
1795 |
mLogger.info("rippleIndirectlyPlanned set " + p.mName + " " + p.mIndirectlyPlanned);
|
|
|
1796 |
}
|
|
|
1797 |
|
|
|
1798 |
/**accessor method
|
|
|
1799 |
*/
|
| 830 |
mhunt |
1800 |
public String getESCROWSetUp()
|
| 814 |
mhunt |
1801 |
{
|
| 830 |
mhunt |
1802 |
mLogger.debug("getESCROWSetUp");
|
| 814 |
mhunt |
1803 |
String retVal = new String("");
|
|
|
1804 |
|
|
|
1805 |
try
|
|
|
1806 |
{
|
| 830 |
mhunt |
1807 |
if ( mEscrowClearcaseSupportCollection.size() >= 1 )
|
| 814 |
mhunt |
1808 |
{
|
|
|
1809 |
retVal = (String)mEscrowClearcaseSupportCollection.get(0);
|
|
|
1810 |
}
|
|
|
1811 |
}
|
|
|
1812 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
1813 |
{
|
|
|
1814 |
}
|
|
|
1815 |
|
| 830 |
mhunt |
1816 |
mLogger.info("getESCROWSetUp returned " + retVal);
|
| 814 |
mhunt |
1817 |
return retVal;
|
|
|
1818 |
}
|
|
|
1819 |
|
|
|
1820 |
/**accessor method
|
|
|
1821 |
*/
|
| 830 |
mhunt |
1822 |
public String getRawData()
|
| 814 |
mhunt |
1823 |
{
|
| 830 |
mhunt |
1824 |
mLogger.debug("getRawData");
|
| 814 |
mhunt |
1825 |
String retVal = new String("");
|
|
|
1826 |
|
|
|
1827 |
try
|
|
|
1828 |
{
|
| 830 |
mhunt |
1829 |
if ( mEscrowClearcaseSupportCollection.size() >= 2 )
|
| 814 |
mhunt |
1830 |
{
|
|
|
1831 |
retVal = (String)mEscrowClearcaseSupportCollection.get(1);
|
|
|
1832 |
}
|
|
|
1833 |
}
|
|
|
1834 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
1835 |
{
|
|
|
1836 |
}
|
|
|
1837 |
|
| 830 |
mhunt |
1838 |
mLogger.info("getRawData returned " + retVal);
|
| 814 |
mhunt |
1839 |
return retVal;
|
|
|
1840 |
}
|
|
|
1841 |
|
|
|
1842 |
/**returns first build file content and addendum
|
|
|
1843 |
* the addendum value is one of "non generic", "generic" or "dummy"
|
|
|
1844 |
*/
|
|
|
1845 |
public void getFirstBuildFileContent(MutableString content,
|
|
|
1846 |
MutableString addendum)
|
|
|
1847 |
{
|
|
|
1848 |
mLogger.debug("getFirstBuildFileContent");
|
|
|
1849 |
try
|
|
|
1850 |
{
|
|
|
1851 |
mBuildIndex = 0;
|
|
|
1852 |
content.value = (String)mBuildCollection.get( mBuildIndex );
|
|
|
1853 |
addendum.value = mAddendum;
|
|
|
1854 |
}
|
|
|
1855 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
1856 |
{
|
|
|
1857 |
}
|
|
|
1858 |
mLogger.info("getFirstBuildFileContent passed " + content.value + addendum.value);
|
|
|
1859 |
}
|
|
|
1860 |
|
| 872 |
dpurdie |
1861 |
/**returns the build loc
|
| 814 |
mhunt |
1862 |
*/
|
|
|
1863 |
private String loc(Package p, String target, String lf)
|
|
|
1864 |
{
|
|
|
1865 |
mLogger.debug("loc");
|
|
|
1866 |
String retVal = new String();
|
| 872 |
dpurdie |
1867 |
String loc = new String("/");
|
|
|
1868 |
|
|
|
1869 |
if (mDaemon)
|
| 814 |
mhunt |
1870 |
{
|
| 872 |
dpurdie |
1871 |
// Daemon: Start in root of view/workspace
|
| 878 |
mhunt |
1872 |
loc += mBaseline + "/" + p.mLabel;
|
| 814 |
mhunt |
1873 |
}
|
| 872 |
dpurdie |
1874 |
else
|
| 814 |
mhunt |
1875 |
{
|
| 872 |
dpurdie |
1876 |
// mAlias used with jats -extractfiles -view
|
|
|
1877 |
loc += p.mAlias;
|
|
|
1878 |
}
|
| 814 |
mhunt |
1879 |
|
| 872 |
dpurdie |
1880 |
//
|
|
|
1881 |
// Always use '/' as a path seperator - even if user has specified '\'
|
|
|
1882 |
// Ant can handle it.
|
|
|
1883 |
//
|
| 814 |
mhunt |
1884 |
loc = loc.replace('\\', '/');
|
|
|
1885 |
retVal +=
|
|
|
1886 |
"<property name=\"" + target + "\" value=\"" + loc + "\"/>" + lf;
|
|
|
1887 |
|
|
|
1888 |
mLogger.info("loc returned " + retVal);
|
|
|
1889 |
return retVal;
|
|
|
1890 |
}
|
| 816 |
mhunt |
1891 |
|
|
|
1892 |
/**returns the buildInfo
|
|
|
1893 |
*/
|
| 836 |
mhunt |
1894 |
private String buildInfo(Package p, String lf, boolean filter)
|
| 816 |
mhunt |
1895 |
{
|
|
|
1896 |
mLogger.debug("buildInfo");
|
|
|
1897 |
|
|
|
1898 |
String platforms = new String();
|
|
|
1899 |
String standards = new String();
|
|
|
1900 |
|
| 864 |
mhunt |
1901 |
for (Iterator<BuildStandard> it = p.mBuildStandardCollection.iterator(); it.hasNext(); )
|
| 816 |
mhunt |
1902 |
{
|
| 864 |
mhunt |
1903 |
BuildStandard bs = it.next();
|
| 816 |
mhunt |
1904 |
|
| 836 |
mhunt |
1905 |
if ( !filter )
|
| 816 |
mhunt |
1906 |
{
|
| 908 |
mhunt |
1907 |
String platform = bs.getPlatform(!ReleaseManager.mUseDatabase, true);
|
| 816 |
mhunt |
1908 |
|
|
|
1909 |
if ( platform.length() > 0 )
|
|
|
1910 |
{
|
|
|
1911 |
platforms += platform + lf;
|
|
|
1912 |
}
|
|
|
1913 |
|
| 908 |
mhunt |
1914 |
String standard = bs.getBuildStandard(!ReleaseManager.mUseDatabase, true);
|
| 816 |
mhunt |
1915 |
|
|
|
1916 |
if ( standard.length() > 0 )
|
|
|
1917 |
{
|
|
|
1918 |
standards += standard + lf;
|
|
|
1919 |
}
|
|
|
1920 |
}
|
|
|
1921 |
else
|
|
|
1922 |
{
|
| 908 |
mhunt |
1923 |
if ( !bs.getBuildStandard(!ReleaseManager.mUseDatabase, true).contains("\"none\"") )
|
| 816 |
mhunt |
1924 |
{
|
| 908 |
mhunt |
1925 |
String platform = bs.getPlatform(!ReleaseManager.mUseDatabase, true);
|
| 816 |
mhunt |
1926 |
|
|
|
1927 |
if ( platform.length() > 0 )
|
|
|
1928 |
{
|
|
|
1929 |
platforms += platform + lf;
|
|
|
1930 |
}
|
| 836 |
mhunt |
1931 |
|
| 908 |
mhunt |
1932 |
String standard = bs.getBuildStandard(!ReleaseManager.mUseDatabase, true);
|
| 836 |
mhunt |
1933 |
|
|
|
1934 |
if ( standard.length() > 0 )
|
|
|
1935 |
{
|
|
|
1936 |
standards += standard + lf;
|
|
|
1937 |
}
|
| 816 |
mhunt |
1938 |
}
|
|
|
1939 |
}
|
|
|
1940 |
}
|
|
|
1941 |
|
|
|
1942 |
mLogger.info("buildInfo returned " + platforms + standards);
|
|
|
1943 |
return platforms + standards;
|
|
|
1944 |
}
|
| 866 |
mhunt |
1945 |
|
| 906 |
mhunt |
1946 |
/**prints to standard out in escrow mode only
|
|
|
1947 |
*/
|
|
|
1948 |
private void standardOut(final String message, final String alias, boolean printMessage)
|
|
|
1949 |
{
|
|
|
1950 |
mLogger.debug("standardOut");
|
|
|
1951 |
if (!mDaemon)
|
|
|
1952 |
{
|
|
|
1953 |
if ( printMessage )
|
|
|
1954 |
{
|
|
|
1955 |
System.out.println(message);
|
|
|
1956 |
// switch the message off
|
|
|
1957 |
printMessage = false;
|
|
|
1958 |
}
|
|
|
1959 |
|
|
|
1960 |
System.out.println(alias);
|
|
|
1961 |
}
|
|
|
1962 |
}
|
| 814 |
mhunt |
1963 |
}
|