Subversion Repositories DevTools

Rev

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

Rev 924 Rev 4123
Line 5... Line 5...
5
import java.sql.SQLException;
5
import java.sql.SQLException;
6
 
6
 
7
import java.util.Iterator;
7
import java.util.Iterator;
8
import java.util.ListIterator;
8
import java.util.ListIterator;
9
import java.util.Vector;
9
import java.util.Vector;
-
 
10
import java.lang.Exception;
10
 
11
 
11
import org.apache.log4j.Logger;
12
import org.apache.log4j.Logger;
12
 
13
 
13
/**Plans release impact by generating a set of Strings containing build file content.
14
/**Plans release impact by generating a set of Strings containing build file content.
14
 */
15
 */
Line 199... Line 200...
199
      mReleaseManager.connectForPlanning(highProbabilityBuildRequirement);
200
      mReleaseManager.connectForPlanning(highProbabilityBuildRequirement);
200
 
201
 
201
      if ( mDaemon )
202
      if ( mDaemon )
202
      {
203
      {
203
        // claim the mutex
204
        // claim the mutex
-
 
205
mLogger.warn("planRelease claimMutex");
-
 
206
        
204
        mReleaseManager.claimMutex();
207
        mReleaseManager.claimMutex();
205
        mBuildExclusionCollection.removeAllElements();
208
        mBuildExclusionCollection.removeAllElements();
206
        Vector<BuildExclusion> tempBuildExclusionCollection = new Vector<BuildExclusion>();
209
        Vector<BuildExclusion> tempBuildExclusionCollection = new Vector<BuildExclusion>();
207
        
210
        
-
 
211
mLogger.warn("planRelease queryBuildExclusions");
208
        mReleaseManager.queryBuildExclusions(tempBuildExclusionCollection, mBaseline);
212
        mReleaseManager.queryBuildExclusions(tempBuildExclusionCollection, mBaseline);
209
        
213
 
210
        // only populate mBuildExclusionCollection with tempBuildExclusionCollection entries which have a relevant root_pv_id
214
        // only populate mBuildExclusionCollection with tempBuildExclusionCollection entries which have a relevant root_pv_id
211
        // ie the root_pv_id is ONLY relevant if it is null (-1) or it points to a pv_id in the collection
215
        // ie the root_pv_id is ONLY relevant if it is null (-1) or it points to a pv_id in the collection
212
        // the package with a pv_id which is a root_pv_id may be removed ie when fixing a build issue
216
        // the package with a pv_id which is a root_pv_id may be removed ie when fixing a build issue
213
        for (Iterator<BuildExclusion> it = tempBuildExclusionCollection.iterator(); it.hasNext(); )
217
        for (Iterator<BuildExclusion> it = tempBuildExclusionCollection.iterator(); it.hasNext(); )
214
        {
218
        {
Line 226... Line 230...
226
            buildExclusion.includeToBuild(mReleaseManager, mBaseline);
230
            buildExclusion.includeToBuild(mReleaseManager, mBaseline);
227
          }
231
          }
228
        }
232
        }
229
      }
233
      }
230
      
234
      
-
 
235
mLogger.warn("planRelease queryPackageVersions");
231
      mReleaseManager.queryPackageVersions(this, mPackageCollection, mDaemon, mBaseline);
236
      mReleaseManager.queryPackageVersions(this, mPackageCollection, mDaemon, mBaseline);
232
      
237
      
233
      // must deal with test builds here as they may impact upon package attributes
238
      // must deal with test builds here as they may impact upon package attributes
234
      // eg dependency collection and build standard differences
239
      // eg dependency collection and build standard differences
235
      // this gives test builds preferential treatment
240
      // this gives test builds preferential treatment
Line 262... Line 267...
262
          }
267
          }
263
        }
268
        }
264
      }
269
      }
265
      
270
      
266
      // set up mPackageDependencyCollection
271
      // set up mPackageDependencyCollection
-
 
272
mLogger.warn("planRelease setup mPackageDependencyCollection");
267
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
273
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
268
      {
274
      {
269
        Package p = it.next();
275
        Package p = it.next();
270
         
276
         
271
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
277
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
Line 276... Line 282...
276
          p.mPackageDependencyCollection.add(dependency);
282
          p.mPackageDependencyCollection.add(dependency);
277
        }
283
        }
278
      }
284
      }
279
      
285
      
280
      // DEVI 56479 detect and deal with circular dependencies
286
      // DEVI 56479 detect and deal with circular dependencies
-
 
287
mLogger.warn("planRelease deal with circular dependencies");
281
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
288
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
282
      {
289
      {
283
        Package p = it.next();
290
        Package p = it.next();
284
         
291
         
285
        if ( p.hasCircularDependency( this ) )
292
        if ( p.hasCircularDependency( this ) )
Line 295... Line 302...
295
          standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
302
          standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
296
        }
303
        }
297
      }
304
      }
298
 
305
 
299
      // DEVI 55483 now use the fully built mPackageDependencyCollection (in rippleBuildExclude)
306
      // DEVI 55483 now use the fully built mPackageDependencyCollection (in rippleBuildExclude)
-
 
307
mLogger.warn("planRelease use the fully built mPackageDependencyCollection");
300
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
308
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
301
      {
309
      {
302
        Package p = it.next();
310
        Package p = it.next();
303
         
311
         
304
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
312
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
Line 321... Line 329...
321
          }
329
          }
322
        }
330
        }
323
      }
331
      }
324
 
332
 
325
      // process packages which are not reproducible, and all packages dependent upon them      
333
      // process packages which are not reproducible, and all packages dependent upon them      
-
 
334
mLogger.warn("planRelease process packages which are not reproducible");
326
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
335
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
327
      {
336
      {
328
        Package p = it.next();
337
        Package p = it.next();
329
  
338
  
330
        if (p.mBuildFile == 0)
339
        if (p.mBuildFile == 0)
Line 344... Line 353...
344
          }
353
          }
345
        }
354
        }
346
      }
355
      }
347
      
356
      
348
      // process packages which are not reproducible on the build platforms configured for this baseline
357
      // process packages which are not reproducible on the build platforms configured for this baseline
-
 
358
mLogger.warn("planRelease process packages which are not reproducible2");
349
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
359
      for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
350
      {
360
      {
351
        Package p = it.next();
361
        Package p = it.next();
352
         
362
         
353
        if (p.mBuildFile == 0)
363
        if (p.mBuildFile == 0)
Line 412... Line 422...
412
      }      
422
      }      
413
        
423
        
414
      if (mDaemon)
424
      if (mDaemon)
415
      {
425
      {
416
        // process packages which are not ripple buildable, and all packages dependent upon them
426
        // process packages which are not ripple buildable, and all packages dependent upon them
-
 
427
mLogger.warn("planRelease process packages which are not ripple buildable");
417
        for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
428
        for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
418
        {
429
        {
419
          BuildExclusion be = it.next();
430
          BuildExclusion be = it.next();
420
          
431
          
421
          for (Iterator<Package> it1 = mPackageCollection.iterator(); it1.hasNext(); )
432
          for (Iterator<Package> it1 = mPackageCollection.iterator(); it1.hasNext(); )
Line 435... Line 446...
435
            }
446
            }
436
          }
447
          }
437
        }
448
        }
438
        
449
        
439
        // process packages which need to be ripple built
450
        // process packages which need to be ripple built
-
 
451
mLogger.warn("planRelease process packages which need to be ripple built");
440
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
452
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
441
        {
453
        {
442
          Package p = it.next();
454
          Package p = it.next();
443
  
455
  
444
          if (p.mBuildFile == 0)
456
          if (p.mBuildFile == 0)
Line 489... Line 501...
489
            }
501
            }
490
          }
502
          }
491
        }
503
        }
492
        
504
        
493
        // process packages which do not exist in the archive
505
        // process packages which do not exist in the archive
-
 
506
mLogger.warn("planRelease process packages which do not exist in the archive");
494
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
507
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
495
        {
508
        {
496
          Package p = it.next();
509
          Package p = it.next();
497
  
510
  
498
          if (p.mBuildFile == 0)
511
          if (p.mBuildFile == 0)
Line 518... Line 531...
518
            }
531
            }
519
          }
532
          }
520
        }
533
        }
521
        
534
        
522
        // process forced ripples
535
        // process forced ripples
-
 
536
mLogger.warn("planRelease process forced ripples");
523
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
537
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
524
        {
538
        {
525
          Package p = it.next();
539
          Package p = it.next();
526
  
540
  
527
          if (p.mBuildFile == 0)
541
          if (p.mBuildFile == 0)
Line 561... Line 575...
561
  
575
  
562
      // delete the file <rtagId>official
576
      // delete the file <rtagId>official
563
      Integer rtag = new Integer(mBaseline);
577
      Integer rtag = new Integer(mBaseline);
564
      File rtagIdOfficial = new File(rtag + "official");
578
      File rtagIdOfficial = new File(rtag + "official");
565
      
579
      
-
 
580
mLogger.warn("planRelease process Remaining-1");
566
      if (rtagIdOfficial.exists())
581
      if (rtagIdOfficial.exists())
567
      {
582
      {
568
        boolean del = rtagIdOfficial.delete();
583
        boolean del = rtagIdOfficial.delete();
569
        
584
        
570
        if ( !del )
585
        if ( !del )
Line 583... Line 598...
583
      }
598
      }
584
      
599
      
585
      String raw_data = new String("");
600
      String raw_data = new String("");
586
      String lf = new String( System.getProperty("line.separator") );
601
      String lf = new String( System.getProperty("line.separator") );
587
  
602
  
-
 
603
mLogger.warn("planRelease process Remaining-2");
588
      do
604
      do
589
      {
605
      {
590
        boolean allDependenciesProcessed = true;
606
        boolean allDependenciesProcessed = true;
591
        
607
        
592
        do
608
        do
Line 804... Line 820...
804
      } while( !allProcessed );
820
      } while( !allProcessed );
805
      
821
      
806
      // persist the build files
822
      // persist the build files
807
      allProcessed = false;
823
      allProcessed = false;
808
      buildFile = 1;
824
      buildFile = 1;
-
 
825
mLogger.warn("planRelease process Remaining-3");
809
      
826
      
810
      if ( mDaemon )
827
      if ( mDaemon )
811
      {
828
      {
812
        // all interesting packages in daemon mode match the following filter
829
        // all interesting packages in daemon mode match the following filter
813
        buildFile = 3;
830
        buildFile = 3;
Line 908... Line 925...
908
        }
925
        }
909
      } while( !allProcessed );
926
      } while( !allProcessed );
910
    }
927
    }
911
    finally
928
    finally
912
    {
929
    {
-
 
930
mLogger.warn("planRelease finally");
913
      // this block is executed regardless of what happens in the try block
931
      // this block is executed regardless of what happens in the try block
914
      // even if an exception is thrown
932
      // even if an exception is thrown
915
      // ensure the SELECT FOR UPDATE is released
933
      // ensure the SELECT FOR UPDATE is released
916
      if ( mDaemon )
934
      if ( mDaemon )
917
      {
935
      {
Line 920... Line 938...
920
        // a commit may as well be done in the Exception case
938
        // a commit may as well be done in the Exception case
921
        // in the case of a SQLException indicating database connectivity has been lost
939
        // in the case of a SQLException indicating database connectivity has been lost
922
        // having a go at the commit is superfluous
940
        // having a go at the commit is superfluous
923
        // as the SELECT FOR UPDATE will have been released upon disconnection
941
        // as the SELECT FOR UPDATE will have been released upon disconnection
924
        mReleaseManager.releaseMutex();
942
        mReleaseManager.releaseMutex();
-
 
943
mLogger.warn("planRelease finally-1");
925
      }
944
      }
926
      
945
      
927
      // ensure disconnect
946
      // ensure disconnect
928
      mReleaseManager.disconnectForPlanning(highProbabilityBuildRequirement);
947
      mReleaseManager.disconnectForPlanning(highProbabilityBuildRequirement);
-
 
948
mLogger.warn("planRelease finally-2");
929
    }
949
    }
930
 
950
 
931
    mLogger.warn("planRelease mDaemon " + mDaemon + " returned");
951
    mLogger.warn("planRelease mDaemon " + mDaemon + " returned");
932
  }
952
  }
933
 
953