Subversion Repositories DevTools

Rev

Rev 894 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 894 Rev 898
Line 135... Line 135...
135
    if ( !mDaemon )
135
    if ( !mDaemon )
136
    {
136
    {
137
      mEscrowClearcaseSupportCollection.removeAllElements();  
137
      mEscrowClearcaseSupportCollection.removeAllElements();  
138
    }
138
    }
139
 
139
 
140
    mReleaseManager.connect();
140
    // use finally block in planRelease to ensure releaseMutex is called
141
 
-
 
142
    if ( mDaemon )
141
    try
143
    {
142
    {
144
      // claim the mutex
-
 
145
      mReleaseManager.claimMutex();
143
      mReleaseManager.connect();
146
      mBuildExclusionCollection.removeAllElements();
-
 
147
      Vector<BuildExclusion> tempBuildExclusionCollection = new Vector<BuildExclusion>();
-
 
148
      
144
 
149
      mReleaseManager.queryBuildExclusions(tempBuildExclusionCollection, mBaseline);
-
 
150
      
145
      if ( mDaemon )
151
      // only populate mBuildExclusionCollection with tempBuildExclusionCollection entries which have a relevant root_pv_id
-
 
152
      // ie the root_pv_id is ONLY relevant if it is null (-1) or it points to a pv_id in the collection
-
 
153
      // the package with a pv_id which is a root_pv_id may be removed ie when fixing a build issue
-
 
154
      for (Iterator<BuildExclusion> it = tempBuildExclusionCollection.iterator(); it.hasNext(); )
-
 
155
      {
146
      {
-
 
147
        // claim the mutex
-
 
148
        mReleaseManager.claimMutex();
156
        BuildExclusion buildExclusion = it.next();
149
        mBuildExclusionCollection.removeAllElements();
-
 
150
        Vector<BuildExclusion> tempBuildExclusionCollection = new Vector<BuildExclusion>();
157
        
151
        
158
        if ( buildExclusion.isRelevant(tempBuildExclusionCollection) )
152
        mReleaseManager.queryBuildExclusions(tempBuildExclusionCollection, mBaseline);
159
        {
153
        
-
 
154
        // only populate mBuildExclusionCollection with tempBuildExclusionCollection entries which have a relevant root_pv_id
-
 
155
        // ie the root_pv_id is ONLY relevant if it is null (-1) or it points to a pv_id in the collection
-
 
156
        // the package with a pv_id which is a root_pv_id may be removed ie when fixing a build issue
160
          mBuildExclusionCollection.add(buildExclusion);
157
        for (Iterator<BuildExclusion> it = tempBuildExclusionCollection.iterator(); it.hasNext(); )
161
        }
-
 
162
        else
-
 
163
        {
158
        {
-
 
159
          BuildExclusion buildExclusion = it.next();
-
 
160
          
-
 
161
          if ( buildExclusion.isRelevant(tempBuildExclusionCollection) )
-
 
162
          {
-
 
163
            mBuildExclusionCollection.add(buildExclusion);
-
 
164
          }
-
 
165
          else
-
 
166
          {
164
          // this is just a cosmetic step
167
            // this is just a cosmetic step
165
          // it includes package versions which have been indirectly excluded
168
            // it includes package versions which have been indirectly excluded
166
          // the build daemon ignores this information, but it serves to clarify this point to users
169
            // the build daemon ignores this information, but it serves to clarify this point to users
167
          buildExclusion.includeToBuild(mReleaseManager, mBaseline);
170
            buildExclusion.includeToBuild(mReleaseManager, mBaseline);
-
 
171
          }
168
        }
172
        }
169
      }
173
      }
170
    }
174
      
171
    
-
 
172
    mReleaseManager.queryPackageVersions(this, mPackageCollection, mDaemon, mBaseline);
175
      mReleaseManager.queryPackageVersions(this, mPackageCollection, mDaemon, mBaseline);
173
    
176
      
174
    // set up mPackageDependencyCollection
177
      // set up mPackageDependencyCollection
175
    for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
178
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
176
    {
179
      {
177
      Package p = it.next();
180
        Package p = it.next();
178
       
181
         
179
      for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
182
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
180
      {
183
        {
181
        String alias = it2.next();
184
          String alias = it2.next();
182
        Package dependency = findPackage(alias);
185
          Package dependency = findPackage(alias);
183
        
186
          
184
        if (dependency == ReleaseManager.NULL_PACKAGE)
187
          if (dependency == ReleaseManager.NULL_PACKAGE)
185
        {
188
          {
186
          mLogger.info("planRelease dependency is not in the baseline " + alias);
189
            mLogger.info("planRelease dependency is not in the baseline " + alias);
187
          // exclude all dependent packages
190
            // exclude all dependent packages
188
          // max 50 chars
191
            // max 50 chars
189
          rippleBuildExclude(p, p.mId, "Package build dependency not in the release", null);
192
            rippleBuildExclude(p, p.mId, "Package build dependency not in the release", null);
190
           
193
             
191
          // take the package out of the build
194
            // take the package out of the build
192
          p.mBuildFile = -4;
195
            p.mBuildFile = -4;
193
          mLogger.info("planRelease set mBuildFile to -4 for package " + p.mAlias );
196
            mLogger.info("planRelease set mBuildFile to -4 for package " + p.mAlias );
194
          break;
197
            break;
-
 
198
          }
-
 
199
          
-
 
200
          p.mPackageDependencyCollection.add(dependency);
195
        }
201
        }
196
        
-
 
197
        p.mPackageDependencyCollection.add(dependency);
-
 
198
      }
202
      }
199
    }
203
      
200
    
-
 
201
    // process packages which are not reproducible, and all packages dependent upon them      
204
      // process packages which are not reproducible, and all packages dependent upon them      
202
    for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
205
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
203
    {
-
 
204
      Package p = it.next();
-
 
205
 
-
 
206
      if (p.mBuildFile == 0)
-
 
207
      {
206
      {
208
        // package has yet to be processed
207
        Package p = it.next();
-
 
208
  
209
        if (!p.isReproducible())
209
        if (p.mBuildFile == 0)
210
        {
210
        {
-
 
211
          // package has yet to be processed
-
 
212
          if (!p.isReproducible())
-
 
213
          {
211
          // for escrow build purposes, exclude all dependent package versions
214
            // for escrow build purposes, exclude all dependent package versions
212
          mLogger.info("planRelease package not reproducible " + p.mName);
215
            mLogger.info("planRelease package not reproducible " + p.mName);
213
          // max 50 chars
216
            // max 50 chars
214
          rippleBuildExclude(p, p.mId, "Package has no build environment", null);
217
            rippleBuildExclude(p, p.mId, "Package has no build environment", null);
215
 
218
  
216
          // package is not reproducible, discard
219
            // package is not reproducible, discard
217
          p.mBuildFile = -1;
220
            p.mBuildFile = -1;
218
          mLogger.info("planRelease set mBuildFile to -1 for package " + p.mAlias );
221
            mLogger.info("planRelease set mBuildFile to -1 for package " + p.mAlias );
-
 
222
          }
219
        }
223
        }
220
      }
224
      }
221
    }
225
      
222
    
-
 
223
    // process packages which are not reproducible on the build platforms configured for this baseline
226
      // process packages which are not reproducible on the build platforms configured for this baseline
224
    for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
227
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
225
    {
228
      {
226
      Package p = it.next();
229
        Package p = it.next();
227
       
-
 
228
      if (p.mBuildFile == 0)
-
 
229
      {
-
 
230
        // package has yet to be processed
-
 
231
        // assume it does not need to be reproduced for this baseline
-
 
232
        boolean reproduce = false;
-
 
233
         
230
         
234
        for (Iterator<String> it2 = mGbeMachtypeCollection.iterator(); it2.hasNext(); )
231
        if (p.mBuildFile == 0)
235
        {
232
        {
-
 
233
          // package has yet to be processed
-
 
234
          // assume it does not need to be reproduced for this baseline
236
          String machtype = it2.next();
235
          boolean reproduce = false;
237
          
236
           
238
          if ( machtype.compareTo("linux_i386") == 0 )
237
          for (Iterator<String> it2 = mGbeMachtypeCollection.iterator(); it2.hasNext(); )
239
          {
238
          {
240
            if ( p.isLinuxBuilt() )
239
            String machtype = it2.next();
-
 
240
            
-
 
241
            if ( machtype.compareTo("linux_i386") == 0 )
241
            {
242
            {
-
 
243
              if ( p.isLinuxBuilt() )
-
 
244
              {
242
              reproduce = true;
245
                reproduce = true;
243
              mLogger.info("planRelease package built on linux " + p.mAlias );
246
                mLogger.info("planRelease package built on linux " + p.mAlias );
244
              break;
247
                break;
-
 
248
              }
245
            }
249
            }
246
          }
-
 
247
          else if ( machtype.compareTo("win32") == 0 )
250
            else if ( machtype.compareTo("win32") == 0 )
248
          {
-
 
249
            if ( p.isWin32Built() )
-
 
250
            {
251
            {
-
 
252
              if ( p.isWin32Built() )
-
 
253
              {
251
              reproduce = true;
254
                reproduce = true;
252
              mLogger.info("planRelease package built on win32 " + p.mAlias );
255
                mLogger.info("planRelease package built on win32 " + p.mAlias );
253
              break;
256
                break;
-
 
257
              }
254
            }
258
            }
255
          }
-
 
256
          else if ( machtype.compareTo("sparc") == 0
259
            else if ( machtype.compareTo("sparc") == 0
257
                 || machtype.compareTo("solaris10_x86") == 0
260
                   || machtype.compareTo("solaris10_x86") == 0
258
                 || machtype.compareTo("solaris10_sparc32") == 0 )
261
                   || machtype.compareTo("solaris10_sparc32") == 0 )
259
          {
-
 
260
            if ( p.isSolarisBuilt() )
-
 
261
            {
262
            {
-
 
263
              if ( p.isSolarisBuilt() )
-
 
264
              {
262
              reproduce = true;
265
                reproduce = true;
263
              mLogger.info("planRelease package built on solaris " + p.mAlias );
266
                mLogger.info("planRelease package built on solaris " + p.mAlias );
264
              break;
267
                break;
-
 
268
              }
265
            }
269
            }
266
          }
270
          }
-
 
271
  
-
 
272
          if ( !reproduce )
-
 
273
          {
-
 
274
            // for escrow build purposes, exclude all dependent package versions
-
 
275
            mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline " + p.mName);
-
 
276
            // max 50 chars
-
 
277
            rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null);
-
 
278
            
-
 
279
            // package is not reproducible on the build platforms configured for this baseline, discard
-
 
280
            p.mBuildFile = -2;
-
 
281
            mLogger.info("planRelease set mBuildFile to -2 for package " + p.mAlias );
-
 
282
          }
267
        }
283
        }
268
 
-
 
269
        if ( !reproduce )
-
 
270
        {
-
 
271
          // for escrow build purposes, exclude all dependent package versions
-
 
272
          mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline " + p.mName);
-
 
273
          // max 50 chars
-
 
274
          rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null);
-
 
275
          
-
 
276
          // package is not reproducible on the build platforms configured for this baseline, discard
-
 
277
          p.mBuildFile = -2;
-
 
278
          mLogger.info("planRelease set mBuildFile to -2 for package " + p.mAlias );
-
 
279
        }
-
 
280
      }
-
 
281
    }      
284
      }      
282
      
-
 
283
    if (mDaemon)
-
 
284
    {
-
 
285
      // process packages which are not ripple buildable, and all packages dependent upon them
-
 
286
      for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
-
 
287
      {
-
 
288
        BuildExclusion be = it.next();
-
 
289
        
285
        
-
 
286
      if (mDaemon)
-
 
287
      {
-
 
288
        // process packages which are not ripple buildable, and all packages dependent upon them
290
        for (Iterator<Package> it1 = mPackageCollection.iterator(); it1.hasNext(); )
289
        for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
291
        {
290
        {
292
          Package p = it1.next();
291
          BuildExclusion be = it.next();
293
          
292
          
294
          if ( be.compare(p.mId) )
293
          for (Iterator<Package> it1 = mPackageCollection.iterator(); it1.hasNext(); )
295
          {
294
          {
-
 
295
            Package p = it1.next();
-
 
296
            
296
            if ( p.mBuildFile == 0 )
297
            if ( be.compare(p.mId) )
297
            {
298
            {
-
 
299
              if ( p.mBuildFile == 0 )
-
 
300
              {
298
              // exclude all dependent package versions
301
                // exclude all dependent package versions
299
              mLogger.info("planRelease do not ripple " + p.mName);
302
                mLogger.info("planRelease do not ripple " + p.mName);
300
              // provide the root id and cause as recorded in the database
303
                // provide the root id and cause as recorded in the database
301
              rippleBuildExclude(p, be, it);
304
                rippleBuildExclude(p, be, it);
302
              
305
                
303
              // package is not reproducible, discard
306
                // package is not reproducible, discard
304
              p.mBuildFile = -3;
307
                p.mBuildFile = -3;
305
              mLogger.info("planRelease set mBuildFile to -3 for package " + p.mAlias );
308
                mLogger.info("planRelease set mBuildFile to -3 for package " + p.mAlias );
-
 
309
              }
-
 
310
              break;
306
            }
311
            }
307
            break;
-
 
308
          }
312
          }
309
        }
313
        }
310
      }
314
        
311
      
-
 
312
      // process packages which need to be ripple built
315
        // process packages which need to be ripple built
313
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
316
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
314
      {
-
 
315
        Package p = it.next();
-
 
316
 
-
 
317
        if (p.mBuildFile == 0)
-
 
318
        {
317
        {
319
          // package has yet to be processed
318
          Package p = it.next();
320
          if (p.mDirectlyPlanned)
-
 
321
          {
319
  
322
            // a WIP exists on the package
-
 
323
            // exclude all dependent package versions
-
 
324
            mLogger.info("planRelease package has WIP " + p.mName);
-
 
325
            rippleIndirectlyPlanned(p);
320
          if (p.mBuildFile == 0)
326
          }
-
 
327
          else
-
 
328
          {
321
          {
329
            Iterator<Integer> it2 = p.mDependencyIDCollection.iterator();
-
 
330
            Iterator<Package> it3 = p.mPackageDependencyCollection.iterator();
322
            // package has yet to be processed
331
            for ( ; it2.hasNext() && it3.hasNext(); )
323
            if (p.mDirectlyPlanned)
332
            {
324
            {
333
              Integer dpv_id = it2.next();
325
              // a WIP exists on the package
-
 
326
              // exclude all dependent package versions
-
 
327
              mLogger.info("planRelease package has WIP " + p.mName);
334
              Package dependency = it3.next();
328
              rippleIndirectlyPlanned(p);
-
 
329
            }
-
 
330
            else
335
 
331
            {
-
 
332
              Iterator<Integer> it2 = p.mDependencyIDCollection.iterator();
-
 
333
              Iterator<Package> it3 = p.mPackageDependencyCollection.iterator();
336
              if ( !dependency.mAdvisoryRipple )
334
              for ( ; it2.hasNext() && it3.hasNext(); )
337
              {
335
              {
338
                // not advisory, ie has ripple build impact
336
                Integer dpv_id = it2.next();
339
                boolean found = false;
337
                Package dependency = it3.next();
340
                 
338
  
341
                for ( Iterator<Integer> it4 = mReleasedPvIDCollection.iterator(); it4.hasNext(); )
339
                if ( !dependency.mAdvisoryRipple )
342
                {
340
                {
343
                  Integer pv_id = it4.next();
341
                  // not advisory, ie has ripple build impact
344
 
-
 
345
                  if ( pv_id.compareTo(dpv_id) == 0 )
342
                  boolean found = false;
-
 
343
                   
-
 
344
                  for ( Iterator<Integer> it4 = mReleasedPvIDCollection.iterator(); it4.hasNext(); )
346
                  {
345
                  {
-
 
346
                    Integer pv_id = it4.next();
-
 
347
  
-
 
348
                    if ( pv_id.compareTo(dpv_id) == 0 )
-
 
349
                    {
347
                    found = true;
350
                      found = true;
-
 
351
                      break;
-
 
352
                    }
-
 
353
                  }
-
 
354
                   
-
 
355
                  if ( !found )
-
 
356
                  {
-
 
357
                    // the package is out of date
-
 
358
                    // exclude all dependent package versions
-
 
359
                    mLogger.info("planRelease package out of date " + p.mName);
-
 
360
                    rippleIndirectlyPlanned(p);                 
348
                    break;
361
                    break;
349
                  }
362
                  }
350
                }
363
                }
351
                 
-
 
352
                if ( !found )
-
 
353
                {
-
 
354
                  // the package is out of date
-
 
355
                  // exclude all dependent package versions
-
 
356
                  mLogger.info("planRelease package out of date " + p.mName);
-
 
357
                  rippleIndirectlyPlanned(p);                 
-
 
358
                  break;
-
 
359
                }
-
 
360
              }
364
              }
361
            }
365
            }
362
          }
366
          }
363
        }
367
        }
364
      }
368
        
365
      
-
 
366
      // process packages which do not exist in the archive
369
        // process packages which do not exist in the archive
367
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
370
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
368
      {
-
 
369
        Package p = it.next();
-
 
370
 
-
 
371
        if (p.mBuildFile == 0)
-
 
372
        {
371
        {
373
          // package has yet to be processed
372
          Package p = it.next();
374
          // for unit test purposes, assume all packages exist in the archive if released
-
 
-
 
373
  
375
          if ( ReleaseManager.mUseDatabase )
374
          if (p.mBuildFile == 0)
376
          {
375
          {
377
            // only check existence outside the unit test
376
            // package has yet to be processed
-
 
377
            // for unit test purposes, assume all packages exist in the archive if released
378
            if (!p.mDirectlyPlanned && !p.mIndirectlyPlanned)
378
            if ( ReleaseManager.mUseDatabase )
379
            {
379
            {
380
              // check package version archive existence
380
              // only check existence outside the unit test
381
              if (!p.exists())
381
              if (!p.mDirectlyPlanned && !p.mIndirectlyPlanned)
382
              {
382
              {
-
 
383
                // check package version archive existence
-
 
384
                if (!p.exists())
-
 
385
                {
383
                mLogger.info("planRelease package not found in archive " + p.mName);
386
                  mLogger.info("planRelease package not found in archive " + p.mName);
384
                // DEVI 47395 the cause of this build is not WIP or ripple induced,
387
                  // DEVI 47395 the cause of this build is not WIP or ripple induced,
385
                // it simply does not exist in the archive (has been removed)
388
                  // it simply does not exist in the archive (has been removed)
386
                // prevent source control interaction
389
                  // prevent source control interaction
387
                p.mRequiresSourceControlInteraction = false;
390
                  p.mRequiresSourceControlInteraction = false;
388
                rippleIndirectlyPlanned(p);
391
                  rippleIndirectlyPlanned(p);
-
 
392
                }
389
              }
393
              }
390
            }
394
            }
391
          }
395
          }
392
        }
396
        }
393
      }
397
      }
394
    }
-
 
395
    
-
 
396
    // process remaining packages which need to be reproduced for this baseline
-
 
397
    // determine the build file for each package
-
 
398
    // 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
-
 
399
    // set its mBuildNumber to 1, all remaining reproducible packages to 2
-
 
400
    // for escrow builds, determine the package versions that can be built in the build iteration
-
 
401
    // set their mBuildNumber to the build iteration
-
 
402
    // increment the build iteration and repeat until all package versions that need to be reproduced have been assigned a build iteration
-
 
403
    boolean allProcessed = false;
-
 
404
    int buildFile = 1;
-
 
405
 
-
 
406
    // delete the file <rtagId>official
-
 
407
    Integer rtag = new Integer(mBaseline);
-
 
408
    File rtagIdOfficial = new File(rtag + "official");
-
 
409
    
-
 
410
    if (rtagIdOfficial.exists())
-
 
411
    {
-
 
412
      boolean del = rtagIdOfficial.delete();
-
 
413
      
398
      
-
 
399
      // process remaining packages which need to be reproduced for this baseline
-
 
400
      // determine the build file for each package
-
 
401
      // 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
-
 
402
      // set its mBuildNumber to 1, all remaining reproducible packages to 2
-
 
403
      // for escrow builds, determine the package versions that can be built in the build iteration
-
 
404
      // set their mBuildNumber to the build iteration
-
 
405
      // increment the build iteration and repeat until all package versions that need to be reproduced have been assigned a build iteration
-
 
406
      boolean allProcessed = false;
414
      if ( !del )
407
      int buildFile = 1;
-
 
408
  
-
 
409
      // delete the file <rtagId>official
-
 
410
      Integer rtag = new Integer(mBaseline);
-
 
411
      File rtagIdOfficial = new File(rtag + "official");
-
 
412
      
-
 
413
      if (rtagIdOfficial.exists())
415
      {
414
      {
416
        // the delete failed
-
 
417
        // some literature suggests a forced garbage collection may free up resources associated with file handles
-
 
418
        // nothing to lose since the file "must" be deleted
-
 
419
        System.gc();
-
 
420
        del = rtagIdOfficial.delete();
415
        boolean del = rtagIdOfficial.delete();
421
          
416
        
422
        if ( !del )
417
        if ( !del )
423
        {
418
        {
-
 
419
          // the delete failed
-
 
420
          // some literature suggests a forced garbage collection may free up resources associated with file handles
-
 
421
          // nothing to lose since the file "must" be deleted
-
 
422
          System.gc();
-
 
423
          del = rtagIdOfficial.delete();
-
 
424
            
-
 
425
          if ( !del )
-
 
426
          {
424
          mLogger.fatal("rtagIdOfficial.delete() returned " + del);
427
            mLogger.fatal("rtagIdOfficial.delete() returned " + del);
-
 
428
          }
425
        }
429
        }
426
      }
430
      }
427
    }
-
 
428
    
-
 
429
    String raw_data = new String("");
-
 
430
    String lf = new String( System.getProperty("line.separator") );
-
 
431
 
-
 
432
    do
-
 
433
    {
-
 
434
      boolean allDependenciesProcessed = true;
-
 
435
      
431
      
-
 
432
      String raw_data = new String("");
-
 
433
      String lf = new String( System.getProperty("line.separator") );
-
 
434
  
436
      do
435
      do
437
      {
436
      {
438
        // assume all dependencies have been processed
-
 
439
        allDependenciesProcessed = true;
437
        boolean allDependenciesProcessed = true;
440
        
438
        
441
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
439
        do
442
        {
440
        {
-
 
441
          // assume all dependencies have been processed
443
          Package p = it.next();
442
          allDependenciesProcessed = true;
444
          
443
          
445
          if ( mDaemon && ( ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) || p.mBuildFile < 0 ) )
444
          for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
446
          {
445
          {
447
            // flag packages with no build requirement as processed in daemon mode
-
 
448
            p.mProcessed = true;
446
            Package p = it.next();
449
            mLogger.info("planRelease package has no build requirement " + p.mName);            
-
 
450
          }
-
 
451
          else
-
 
452
          {
447
            
453
            if ( ( p.mBuildFile == 0 ) && ( (mDaemon && ( p.mDirectlyPlanned || p.mIndirectlyPlanned ) ) || ( !mDaemon ) ) )
448
            if ( mDaemon && ( ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) || p.mBuildFile < 0 ) )
454
            {
449
            {
455
              // package yet to be processed and
450
              // flag packages with no build requirement as processed in daemon mode
456
              // in daemon mode has a build requirement or
-
 
457
              // in escrow mode
451
              p.mProcessed = true;
458
              boolean canBeBuiltNow = true;
-
 
459
              boolean allDependenciesForThisPackageProcessed = true;
452
              mLogger.info("planRelease package has no build requirement " + p.mName);            
460
              
453
            }
461
              for ( Iterator<Package> it2 = p.mPackageDependencyCollection.iterator(); it2.hasNext(); )
-
 
462
              {
-
 
463
                Package dependency = it2.next();
-
 
464
                
454
            else
465
                if ( !dependency.mProcessed )
-
 
466
                {
455
            {
467
                  // cannot determine canBeBuiltNow until this dependency has been processed
-
 
468
                  allDependenciesForThisPackageProcessed = false;
-
 
469
                  allDependenciesProcessed = false;
-
 
470
                }
-
 
471
                else if ( ( mDaemon && ( dependency.mDirectlyPlanned ) || ( dependency.mIndirectlyPlanned ) ) || 
456
              if ( ( p.mBuildFile == 0 ) && ( (mDaemon && ( p.mDirectlyPlanned || p.mIndirectlyPlanned ) ) || ( !mDaemon ) ) )
472
                          ( !mDaemon &&
-
 
473
                            ( ( dependency.mBuildFile == 0 ) ||
-
 
474
                              ( dependency.mBuildFile == buildFile &&
-
 
475
                                ( ( p.isLinuxBuilt() && !dependency.isLinuxBuilt() ) ||
-
 
476
                                  ( p.isWin32Built() && !dependency.isWin32Built() ) ||
-
 
477
                                  ( p.isSolarisBuilt() && !dependency.isSolarisBuilt() ) ||
-
 
478
                                  ( !p.isLinuxBuilt() && dependency.isLinuxBuilt() ) ||
-
 
479
                                  ( !p.isWin32Built() && dependency.isWin32Built() ) ||
-
 
480
                                  ( !p.isSolarisBuilt() && dependency.isSolarisBuilt() ) ) ) ) ) )
-
 
481
                {
-
 
482
                  // in daemon mode this processed dependency has a build requirement or
-
 
483
                  // in escrow mode...
-
 
484
                  // this processed dependency has not been assigned to a build iteration or
-
 
485
                  // this processed dependency has been assigned to this build iteration and does not build on this platform
-
 
486
                  canBeBuiltNow = false;
-
 
487
                  mLogger.info("planRelease package cannot be built in this iteration " + p.mName);
-
 
488
                  break;
-
 
489
                }
-
 
490
              }
-
 
491
              
-
 
492
              if (allDependenciesForThisPackageProcessed)
-
 
493
              {
457
              {
-
 
458
                // package yet to be processed and
-
 
459
                // in daemon mode has a build requirement or
494
                p.mProcessed = true;
460
                // in escrow mode
-
 
461
                boolean canBeBuiltNow = true;
-
 
462
                boolean allDependenciesForThisPackageProcessed = true;
495
                
463
                
496
                if ( mDaemon )
464
                for ( Iterator<Package> it2 = p.mPackageDependencyCollection.iterator(); it2.hasNext(); )
497
                {
465
                {
-
 
466
                  Package dependency = it2.next();
-
 
467
                  
498
                  if ( canBeBuiltNow )
468
                  if ( !dependency.mProcessed )
499
                  {
469
                  {
500
                    // flag package with build requirement, may get downgraded to future build requirement
470
                    // cannot determine canBeBuiltNow until this dependency has been processed
501
                    p.mBuildFile = 1;
471
                    allDependenciesForThisPackageProcessed = false;
502
                    mLogger.info("planRelease set mBuildFile to 1 for package " + p.mAlias );
472
                    allDependenciesProcessed = false;
503
                  }
473
                  }
-
 
474
                  else if ( ( mDaemon && ( dependency.mDirectlyPlanned ) || ( dependency.mIndirectlyPlanned ) ) || 
504
                  else
475
                            ( !mDaemon &&
-
 
476
                              ( ( dependency.mBuildFile == 0 ) ||
-
 
477
                                ( dependency.mBuildFile == buildFile &&
-
 
478
                                  ( ( p.isLinuxBuilt() && !dependency.isLinuxBuilt() ) ||
-
 
479
                                    ( p.isWin32Built() && !dependency.isWin32Built() ) ||
-
 
480
                                    ( p.isSolarisBuilt() && !dependency.isSolarisBuilt() ) ||
-
 
481
                                    ( !p.isLinuxBuilt() && dependency.isLinuxBuilt() ) ||
-
 
482
                                    ( !p.isWin32Built() && dependency.isWin32Built() ) ||
-
 
483
                                    ( !p.isSolarisBuilt() && dependency.isSolarisBuilt() ) ) ) ) ) )
505
                  {
484
                  {
506
                    // flag package with future build requirement
485
                    // in daemon mode this processed dependency has a build requirement or
-
 
486
                    // in escrow mode...
-
 
487
                    // this processed dependency has not been assigned to a build iteration or
-
 
488
                    // this processed dependency has been assigned to this build iteration and does not build on this platform
507
                    p.mBuildFile = 2;
489
                    canBeBuiltNow = false;
508
                    mLogger.info("planRelease set mBuildFile to 2 for package " + p.mAlias );
490
                    mLogger.info("planRelease package cannot be built in this iteration " + p.mName);
-
 
491
                    break;
509
                  }
492
                  }
510
                }
493
                }
511
                else
494
                
-
 
495
                if (allDependenciesForThisPackageProcessed)
512
                {
496
                {
-
 
497
                  p.mProcessed = true;
-
 
498
                  
513
                  if ( canBeBuiltNow )
499
                  if ( mDaemon )
514
                  {
500
                  {
515
                    if ( !mDaemon )
501
                    if ( canBeBuiltNow )
516
                    {
502
                    {
517
                      String isWin32Built = new String("");
503
                      // flag package with build requirement, may get downgraded to future build requirement
518
                      
-
 
519
                      if ( p.isWin32Built() )
504
                      p.mBuildFile = 1;
520
                      {
-
 
521
                        isWin32Built = "W";
505
                      mLogger.info("planRelease set mBuildFile to 1 for package " + p.mAlias );
522
                      }
506
                    }
523
                      
507
                    else
524
                      String isLinuxBuilt = new String("");
-
 
525
                      
508
                    {
526
                      if ( p.isLinuxBuilt() )
509
                      // flag package with future build requirement
527
                      {
-
 
528
                        isLinuxBuilt = "L";
510
                      p.mBuildFile = 2;
529
                      }
-
 
530
                      
-
 
531
                      String isSolarisBuilt = new String("");
511
                      mLogger.info("planRelease set mBuildFile to 2 for package " + p.mAlias );
532
                      
512
                    }
533
                      if ( p.isSolarisBuilt() )
-
 
534
                      {
513
                  }
535
                        isSolarisBuilt = "S";
-
 
536
                      }
514
                  else
537
                      
515
                  {
538
                      String isGeneric = new String("");
516
                    if ( canBeBuiltNow )
539
                      
517
                    {
540
                      if ( p.isGeneric() )
518
                      if ( !mDaemon )
541
                      {
519
                      {
-
 
520
                        String isWin32Built = new String("");
-
 
521
                        
-
 
522
                        if ( p.isWin32Built() )
-
 
523
                        {
-
 
524
                          isWin32Built = "W";
-
 
525
                        }
-
 
526
                        
-
 
527
                        String isLinuxBuilt = new String("");
-
 
528
                        
-
 
529
                        if ( p.isLinuxBuilt() )
-
 
530
                        {
-
 
531
                          isLinuxBuilt = "L";
-
 
532
                        }
-
 
533
                        
-
 
534
                        String isSolarisBuilt = new String("");
-
 
535
                        
-
 
536
                        if ( p.isSolarisBuilt() )
-
 
537
                        {
-
 
538
                          isSolarisBuilt = "S";
-
 
539
                        }
-
 
540
                        
-
 
541
                        String isGeneric = new String("");
-
 
542
                        
-
 
543
                        if ( p.isGeneric() )
-
 
544
                        {
542
                        isGeneric = "G";
545
                          isGeneric = "G";
-
 
546
                        }
-
 
547
                        
-
 
548
                        raw_data += p.mAlias + "," +
-
 
549
                                    isWin32Built + "," +
-
 
550
                                    isLinuxBuilt + "," +
-
 
551
                                    isSolarisBuilt + "," +
-
 
552
                                    isGeneric + "," +
-
 
553
                                    buildFile +
-
 
554
                                    lf;
543
                      }
555
                      }
544
                      
556
                      
545
                      raw_data += p.mAlias + "," +
557
                      // not daemon
546
                                  isWin32Built + "," +
-
 
547
                                  isLinuxBuilt + "," +
-
 
548
                                  isSolarisBuilt + "," +
-
 
549
                                  isGeneric + "," +
-
 
550
                                  buildFile +
558
                      p.mBuildFile = buildFile;
551
                                  lf;
559
                      mLogger.info("planRelease set mBuildFile to " + buildFile + " for package " + p.mAlias );
552
                    }
560
                    }
553
                    
-
 
554
                    // not daemon
-
 
555
                    p.mBuildFile = buildFile;
-
 
556
                    mLogger.info("planRelease set mBuildFile to " + buildFile + " for package " + p.mAlias );
-
 
557
                  }
561
                  }
558
                }
562
                }
559
              }
563
              }
560
            }
564
            }
561
          }
565
          }
562
        }
-
 
563
      } while( !allDependenciesProcessed );
566
        } while( !allDependenciesProcessed );
564
 
567
  
565
      if ( mDaemon )
568
        if ( mDaemon )
566
      {
569
        {
567
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
570
          for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
568
        {
571
          {
569
          Package p = it.next();
572
            Package p = it.next();
570
          
573
            
571
          if ( p.mProcessed && p.mBuildFile == 1 )
574
            if ( p.mProcessed && p.mBuildFile == 1 )
572
          {
-
 
573
            p.mBuildFile = buildFile;
-
 
574
            mLogger.info("planRelease 2 set mBuildFile to " + buildFile + " for package " + p.mAlias );
-
 
575
                        
-
 
576
            if ( buildFile == 1 )
-
 
577
            {
575
            {
578
              int pvApplied = p.applyPV(mReleaseManager, mBaseline);
576
              p.mBuildFile = buildFile;
-
 
577
              mLogger.info("planRelease 2 set mBuildFile to " + buildFile + " for package " + p.mAlias );
579
              
578
                          
580
              if ( pvApplied == 1 )
579
              if ( buildFile == 1 )
581
              {
580
              {
-
 
581
                int pvApplied = p.applyPV(mReleaseManager, mBaseline);
-
 
582
                
-
 
583
                if ( pvApplied == 1 )
-
 
584
                {
582
                // max 50 chars
585
                  // max 50 chars
583
                rippleBuildExclude(p, p.mId, "Package has non standard versioning", null);
586
                  rippleBuildExclude(p, p.mId, "Package has non standard versioning", null);
584
              }
587
                }
585
              else
588
                else
586
              if ( pvApplied == 2 )
589
                if ( pvApplied == 2 )
587
              {
590
                {
588
                // max 50 chars
591
                  // max 50 chars
589
                rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null);
592
                  rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null);
-
 
593
                }
-
 
594
                else
-
 
595
                {
-
 
596
                  buildFile = 2;
-
 
597
                }
590
              }
598
              }
591
              else
599
              else
592
              {
600
              {
593
                buildFile = 2;
601
                mLogger.info("planRelease package has future (downgraded) build requirement " + p.mName + " " + buildFile);              
594
              }
602
              }
595
            }
603
            }
-
 
604
          }
-
 
605
        }
-
 
606
        
-
 
607
        // are more build files required
-
 
608
        allProcessed = true;
-
 
609
        
-
 
610
        if (mDaemon)
-
 
611
        {
-
 
612
          for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
-
 
613
          {
-
 
614
            Package p = it.next();
596
            else
615
           
-
 
616
            if ( p.mBuildFile < 0 || ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) )
597
            {
617
            {
-
 
618
              // at this point...
-
 
619
              // only 1 package with a build requirement has a mBuildFile of 1,
-
 
620
              // all other packages with a build requirement have an mBuildFile of 2
-
 
621
              // give packages with no build requirement, reproducible or not, an mBuildFile of 3
-
 
622
              p.mBuildFile = 3;
598
              mLogger.info("planRelease package has future (downgraded) build requirement " + p.mName + " " + buildFile);              
623
              mLogger.info("planRelease 1 set mBuildFile to 3 for package " + p.mAlias );
599
            }
624
            }
600
          }
625
          }
601
        }
626
        }
602
      }
627
        else
603
      
-
 
604
      // are more build files required
-
 
605
      allProcessed = true;
-
 
606
      
-
 
607
      if (mDaemon)
-
 
608
      {
-
 
609
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
-
 
610
        {
628
        {
611
          Package p = it.next();
629
          // this is escrow mode centric
612
         
-
 
613
          if ( p.mBuildFile < 0 || ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) )
630
          for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
614
          {
631
          {
615
            // at this point...
632
            Package p = it.next();
-
 
633
           
616
            // only 1 package with a build requirement has a mBuildFile of 1,
634
            if ( p.mBuildFile == 0 )
617
            // all other packages with a build requirement have an mBuildFile of 2
635
            {
618
            // give packages with no build requirement, reproducible or not, an mBuildFile of 3
636
              // more build files are required
619
            p.mBuildFile = 3;
637
              allProcessed = false;
620
            mLogger.info("planRelease 1 set mBuildFile to 3 for package " + p.mAlias );
638
              mLogger.info("planRelease more build files are required for " + p.mName);
-
 
639
              break;
-
 
640
            }
621
          }
641
          }
-
 
642
          
-
 
643
          buildFile++;
622
        }
644
        }
-
 
645
      } while( !allProcessed );
-
 
646
      
-
 
647
      // persist the build files
-
 
648
      allProcessed = false;
-
 
649
      buildFile = 1;
-
 
650
      
-
 
651
      if ( mDaemon )
-
 
652
      {
-
 
653
        // all interesting packages in daemon mode match the following filter
-
 
654
        buildFile = 3;
-
 
655
      }
-
 
656
  
-
 
657
      mTimestamp = System.currentTimeMillis();
-
 
658
  
-
 
659
      if ( !ReleaseManager.mUseDatabase )
-
 
660
      {
-
 
661
        mTimestamp = 123456789;
623
      }
662
      }
-
 
663
  
624
      else
664
      do
625
      {
665
      {
626
        // this is escrow mode centric
666
        String buildFileContent = new String( generateBuildFileHeader() );
-
 
667
        
627
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
668
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
628
        {
669
        {
629
          Package p = it.next();
670
          Package p = it.next();
630
         
671
        
631
          if ( p.mBuildFile == 0 )
672
          if ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) )
632
          {
673
          {
633
            // more build files are required
674
            buildFileContent += generatePackageProperty(p);
634
            allProcessed = false;
-
 
635
            mLogger.info("planRelease more build files are required for " + p.mName);
-
 
636
            break;
-
 
637
          }
675
          }
638
        }
676
        }
639
        
677
        
640
        buildFile++;
-
 
641
      }
-
 
642
    } while( !allProcessed );
-
 
643
    
-
 
644
    // persist the build files
-
 
645
    allProcessed = false;
-
 
646
    buildFile = 1;
-
 
647
    
-
 
648
    if ( mDaemon )
-
 
649
    {
-
 
650
      // all interesting packages in daemon mode match the following filter
-
 
651
      buildFile = 3;
-
 
652
    }
-
 
653
 
-
 
654
    mTimestamp = System.currentTimeMillis();
-
 
655
 
-
 
656
    if ( !ReleaseManager.mUseDatabase )
-
 
657
    {
-
 
658
      mTimestamp = 123456789;
-
 
659
    }
-
 
660
 
-
 
661
    do
-
 
662
    {
-
 
663
      String buildFileContent = new String( generateBuildFileHeader() );
-
 
664
      
-
 
665
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
-
 
666
      {
-
 
667
        Package p = it.next();
-
 
668
      
-
 
669
        if ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) )
-
 
670
        {
-
 
671
          buildFileContent += generatePackageProperty(p);
-
 
672
        }
-
 
673
      }
-
 
674
      
-
 
675
      buildFileContent += generateTaskdef();
678
        buildFileContent += generateTaskdef();
676
      
679
        
677
      String set_up = new String("");
680
        String set_up = new String("");
678
      boolean daemonHasTarget = false;
681
        boolean daemonHasTarget = false;
679
      
682
        
680
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
683
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
681
      {
-
 
682
        Package p = it.next();
-
 
683
      
-
 
684
        if ( p.mBuildFile > 0 && p.mBuildFile <= buildFile )
-
 
685
        {
684
        {
686
          buildFileContent += generateTarget(p, buildFile);
685
          Package p = it.next();
687
          
686
        
688
          if ( p.mBuildFile == 1 )
687
          if ( p.mBuildFile > 0 && p.mBuildFile <= buildFile )
689
          {
688
          {
-
 
689
            buildFileContent += generateTarget(p, buildFile);
-
 
690
            
-
 
691
            if ( p.mBuildFile == 1 )
-
 
692
            {
690
            daemonHasTarget = true;
693
              daemonHasTarget = true;
-
 
694
            }
691
          }
695
          }
-
 
696
          
-
 
697
          if ( !mDaemon && buildFile == 1 )
-
 
698
          {
-
 
699
            // for the purposes of the set up, use /
-
 
700
            String loc = new String("");
-
 
701
            try
-
 
702
            {
-
 
703
              // The regular expression "\\\\" matches an escape character "\\" and a single backslash "\\"
-
 
704
              loc = p.mLocation.replaceAll("\\\\", "/");
-
 
705
            }
-
 
706
            catch( PatternSyntaxException e )
-
 
707
            {
-
 
708
            }
-
 
709
  
-
 
710
            set_up += "jats release -extractfiles"
-
 
711
                      + " \"-label=" + p.mLabel + "\""
-
 
712
                      + " \"-path=" + loc + "\""
-
 
713
                      + " \"-view=" + p.mAlias + "\""
-
 
714
                      + " -root=. -noprefix"
-
 
715
                      + lf;
-
 
716
          }
-
 
717
        }
-
 
718
  
-
 
719
        if ( mDaemon && !daemonHasTarget )
-
 
720
        {
-
 
721
          // must have AbtSetUp, AbtTearDown, and AbtPublish targets
-
 
722
          buildFileContent += "<target name=\"AbtSetUp\"/>" + lf +
-
 
723
                              "<target name=\"AbtTearDown\"/>" + lf +
-
 
724
                              "<target name=\"AbtPublish\"/>" + lf;
692
        }
725
        }
693
        
726
        
694
        if ( !mDaemon && buildFile == 1 )
727
        if ( !mDaemon && buildFile == 1 )
695
        {
728
        {
696
          // for the purposes of the set up, use /
729
          mEscrowClearcaseSupportCollection.add(set_up);
697
          String loc = new String("");
730
          mEscrowClearcaseSupportCollection.add(raw_data);
698
          try
731
        }
699
          {
732
        
700
            // The regular expression "\\\\" matches an escape character "\\" and a single backslash "\\"
733
        buildFileContent += generateDefaultTarget( buildFile);
-
 
734
        buildFileContent += generateBuildFileFooter();
-
 
735
  
701
            loc = p.mLocation.replaceAll("\\\\", "/");
736
        mBuildCollection.add(buildFileContent);
-
 
737
        
-
 
738
        // are more build files required
-
 
739
        allProcessed = true;
-
 
740
        
-
 
741
        if (!mDaemon)
702
          }
742
        {
703
          catch( PatternSyntaxException e )
743
          // this is escrow mode centric
-
 
744
          for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
704
          {
745
          {
-
 
746
            Package p = it.next();
705
          }
747
           
706
 
-
 
707
          set_up += "jats release -extractfiles"
748
            if ( p.mBuildFile > buildFile )
-
 
749
            {
708
                    + " \"-label=" + p.mLabel + "\""
750
              // more build files are required
709
                    + " \"-path=" + loc + "\""
751
              allProcessed = false;
710
                    + " \"-view=" + p.mAlias + "\""
752
              mLogger.info("planRelease reiterating package has no build requirement " + p.mName + " " + p.mBuildFile + " " + buildFile);
711
                    + " -root=. -noprefix"
753
              break;
-
 
754
            }
-
 
755
          } 
-
 
756
          
712
                    + lf;
757
          buildFile++;
713
        }
758
        }
714
      }
-
 
715
 
-
 
716
      if ( mDaemon && !daemonHasTarget )
-
 
717
      {
-
 
718
        // must have AbtSetUp, AbtTearDown, and AbtPublish targets
-
 
719
        buildFileContent += "<target name=\"AbtSetUp\"/>" + lf +
-
 
720
                            "<target name=\"AbtTearDown\"/>" + lf +
-
 
721
                            "<target name=\"AbtPublish\"/>" + lf;
-
 
722
      }
-
 
723
      
-
 
724
      if ( !mDaemon && buildFile == 1 )
-
 
725
      {
-
 
726
        mEscrowClearcaseSupportCollection.add(set_up);
-
 
727
        mEscrowClearcaseSupportCollection.add(raw_data);
-
 
728
      }
-
 
729
      
-
 
730
      buildFileContent += generateDefaultTarget( buildFile);
-
 
731
      buildFileContent += generateBuildFileFooter();
-
 
732
 
-
 
733
      mBuildCollection.add(buildFileContent);
-
 
734
      
-
 
735
      // are more build files required
-
 
736
      allProcessed = true;
759
      } while( !allProcessed );
737
      
760
        
738
      if (!mDaemon)
761
      if ( mDaemon )
739
      {
762
      {
740
        // this is escrow mode centric
763
        // report what change in build exceptions happens as part of planRelease
741
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
764
        for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
742
        {
765
        {
743
          Package p = it.next();
766
          BuildExclusion buildExclusion = it.next();
744
         
767
          
745
          if ( p.mBuildFile > buildFile )
768
          if ( !buildExclusion.isProcessed() )
746
          {
769
          {
747
            // more build files are required
770
            // notify
748
            allProcessed = false;
771
            buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
749
            mLogger.info("planRelease reiterating package has no build requirement " + p.mName + " " + p.mBuildFile + " " + buildFile);
772
            buildExclusion.email(mPackageCollection, mMailServer, mMailSender, mBaselineName);
750
            break;
-
 
751
          }
773
          }
752
        } 
774
        }
753
        
-
 
754
        buildFile++;
-
 
755
      }
775
      }
756
    } while( !allProcessed );
-
 
757
      
776
    }
758
    if ( mDaemon )
777
    finally
759
    {
778
    {
760
      // report what change in build exceptions happens as part of planRelease
779
      // this block is executed regardless of what happens in the try block
-
 
780
      // even if an exception is thrown
761
      for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
781
      // ensure the SELECT FOR UPDATE is released
-
 
782
      if ( mDaemon )
762
      {
783
      {
763
        BuildExclusion buildExclusion = it.next();
784
        // attempt to release the SELECT FOR UPDATE through a commit
764
        
-
 
765
        if ( !buildExclusion.isProcessed() )
785
        // a commit must be done in the normal case
766
        {
-
 
767
          // notify
786
        // a commit may as well be done in the Exception case
768
          buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
787
        // in the case of a SQLException indicating database connectivity has been lost
-
 
788
        // having a go at the commit is superfluous
769
          buildExclusion.email(mPackageCollection, mMailServer, mMailSender, mBaselineName);
789
        // as the SELECT FOR UPDATE will have been released upon disconnection
770
        }
790
        mReleaseManager.releaseMutex();
771
      }
791
      }
-
 
792
      
-
 
793
      // ensure disconnect
-
 
794
      mReleaseManager.disconnect();
772
    }
795
    }
773
 
796
 
774
    mReleaseManager.disconnect();
-
 
775
    mLogger.warn("planRelease mDaemon " + mDaemon + " returned");
797
    mLogger.warn("planRelease mDaemon " + mDaemon + " returned");
776
  }
798
  }
777
 
799
 
778
  /**returns first build file content
800
  /**returns first build file content
779
   * returns false if no build file content exists
801
   * returns false if no build file content exists
Line 824... Line 846...
824
   */
846
   */
825
  public void collectMetaData() throws SQLException, Exception
847
  public void collectMetaData() throws SQLException, Exception
826
  {
848
  {
827
    mLogger.debug("collectMetaData mDaemon " + mDaemon);
849
    mLogger.debug("collectMetaData mDaemon " + mDaemon);
828
    mGbeMachtypeCollection.removeAllElements();
850
    mGbeMachtypeCollection.removeAllElements();
829
    mReleaseManager.connect();
-
 
830
    mReleaseManager.queryMachtypes(mGbeMachtypeCollection, mDaemon, mBaseline);
-
 
831
 
851
    
832
    if (mDaemon)
852
    try
833
    {
853
    {
-
 
854
      mReleaseManager.connect();
-
 
855
      mReleaseManager.queryMachtypes(mGbeMachtypeCollection, mDaemon, mBaseline);
-
 
856
  
-
 
857
      if (mDaemon)
-
 
858
      {
834
      mMailServer = mReleaseManager.queryMailServer();
859
        mMailServer = mReleaseManager.queryMailServer();
835
      mMailSender = mReleaseManager.queryMailSender();
860
        mMailSender = mReleaseManager.queryMailSender();
836
      mGlobalTarget = mReleaseManager.queryGlobalAddresses();
861
        mGlobalTarget = mReleaseManager.queryGlobalAddresses();
-
 
862
      }
-
 
863
      mBaselineName = mReleaseManager.queryBaselineName(mDaemon, mBaseline);
-
 
864
    }
-
 
865
    finally
-
 
866
    {
-
 
867
      // this block is executed regardless of what happens in the try block
-
 
868
      // even if an exception is thrown
-
 
869
      // ensure disconnect
-
 
870
      mReleaseManager.disconnect();
837
    }
871
    }
838
    mBaselineName = mReleaseManager.queryBaselineName(mDaemon, mBaseline);
-
 
839
    mReleaseManager.disconnect();
-
 
840
  }
872
  }
841
 
873
 
842
  /**returns the Package with the matching mAlias or NULL_PACKAGE if no package has the mID
874
  /**returns the Package with the matching mAlias or NULL_PACKAGE if no package has the mID
843
   */
875
   */
844
  private Package findPackage(String alias)
876
  private Package findPackage(String alias)