Subversion Repositories DevTools

Rev

Rev 7047 | Rev 7050 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7047 Rev 7048
Line 45... Line 45...
45
    /**name associated with the baseline
45
    /**name associated with the baseline
46
     * @attribute
46
     * @attribute
47
     */
47
     */
48
    public String mBaselineName = "";
48
    public String mBaselineName = "";
49
 
49
 
50
    /**collection of released pv_ids associated with the release
-
 
51
     * @attribute
-
 
52
     */
-
 
53
    public List<Integer> mReleasedPvIDCollection = new ArrayList<Integer>();
-
 
54
 
-
 
55
    /**Collection of build exceptions associated with the baseline
50
    /**Collection of build exceptions associated with the baseline
56
     * Used to determine (and report) what change in build exceptions happens as part of planRelease
51
     * Used to determine (and report) what change in build exceptions happens as part of planRelease
57
     * Daemon centric
52
     * Daemon centric
58
     * @aggregation shared
53
     * @aggregation shared
59
     * @attribute
54
     * @attribute
Line 73... Line 68...
73
    /** Escrow information - Raw data (May not be used)
68
    /** Escrow information - Raw data (May not be used)
74
     * @attribute
69
     * @attribute
75
     */
70
     */
76
    private String mEscrowRawData;
71
    private String mEscrowRawData;
77
 
72
 
78
    /**package versions representing the baseline
-
 
79
     * escrow centric
-
 
80
     * @aggregation shared
73
    /** Collections of packages
81
     * @attribute
-
 
82
     */
74
     */
83
    private ArrayList<Package> mPackageCollection = new ArrayList<Package>();
75
    private ArrayList<Package> mPackageCollection = new ArrayList<Package>();
-
 
76
    private ArrayList<Package> mPackageCollectionWip = new ArrayList<Package>();
-
 
77
    private ArrayList<Package> mPackageCollectionTest = new ArrayList<Package>();
-
 
78
    private ArrayList<Package> mPackageCollectionRipple = new ArrayList<Package>();
-
 
79
    private ArrayList<Package> mPackageCollectionAll = new ArrayList<Package>();
-
 
80
    
84
 
81
 
85
    /**index to current String item
82
    /**index to current String item
86
     * @attribute
83
     * @attribute
87
     */
84
     */
88
    private int mBuildIndex;
85
    private int mBuildIndex;
Line 187... Line 184...
187
     * @param rtagId         - Release Identifier
184
     * @param rtagId         - Release Identifier
188
     * @param isDaemon        - Mode of operation. False: Escrow, True: Daemon
185
     * @param isDaemon        - Mode of operation. False: Escrow, True: Daemon
189
     */
186
     */
190
    public RippleEngine(ReleaseManager releaseManager, int rtagId, boolean isDaemon)
187
    public RippleEngine(ReleaseManager releaseManager, int rtagId, boolean isDaemon)
191
    {
188
    {
192
        mLogger.debug("RippleEngine rtag_id " + rtagId + " isDaemon " + isDaemon);
189
        mLogger.debug("RippleEngine rtag_id {} isDaemon {}", rtagId, isDaemon);
193
        mReleaseManager = releaseManager;
190
        mReleaseManager = releaseManager;
194
        mBaseline = rtagId;
191
        mBaseline = rtagId;
195
        mRtagId = rtagId;
192
        mRtagId = rtagId;
196
        mDaemon = isDaemon;
193
        mDaemon = isDaemon;
197
        mReleaseManager.setDaemonMode(mDaemon);
194
        mReleaseManager.setDaemonMode(mDaemon);
198
    }
195
    }
199
 
196
 
200
    /**
197
    /**
201
     * getRtagId
198
     * getRtagId
-
 
199
     * @return The rtagId of the Release attached to this instance of the RippleEngine
202
     */
200
     */
203
    public int getRtagId()
201
    public int getRtagId()
204
    {
202
    {
205
        return mRtagId;
203
        return mRtagId;
206
    }
204
    }
Line 216... Line 214...
216
     *                                will result in a build, so it is given priority to connect 
214
     *                                will result in a build, so it is given priority to connect 
217
     *                                to the database.	
215
     *                                to the database.	
218
     */
216
     */
219
    public void planRelease(final boolean lastBuildActive) throws SQLException, Exception
217
    public void planRelease(final boolean lastBuildActive) throws SQLException, Exception
220
    {
218
    {
221
        mLogger.warn("planRelease mDaemon " + mDaemon);
219
        mLogger.warn("planRelease mDaemon {}", mDaemon);
222
 
220
 
223
        mBuildCollection.clear();
221
        mBuildCollection.clear();
224
        mPackageCollection.clear();
222
        mPackageCollection.clear();
-
 
223
        mPackageCollectionRipple.clear();
-
 
224
        mPackageCollectionTest.clear();
225
        mReleasedPvIDCollection.clear();
225
        mPackageCollectionWip.clear();
226
        mBuildOrder.clear();
226
        mBuildOrder.clear();
227
        mEscrowRawData = "";
227
        mEscrowRawData = "";
228
        mEscrowSetup = "";
228
        mEscrowSetup = "";
229
        Phase phase = new Phase("Plan");
229
        Phase phase = new Phase("Plan");
230
 
230
 
Line 289... Line 289...
289
            //	Query package versions
289
            //	Query package versions
290
            //
290
            //
291
            phase.setPhase("queryPackageVersions");
291
            phase.setPhase("queryPackageVersions");
292
            mLogger.debug("planRelease queryPackageVersions");
292
            mLogger.debug("planRelease queryPackageVersions");
293
            mReleaseManager.queryPackageVersions(this, mPackageCollection, mBaseline);
293
            mReleaseManager.queryPackageVersions(this, mPackageCollection, mBaseline);
-
 
294
            mReleaseManager.queryWips(this, mPackageCollectionWip, mBaseline);
-
 
295
            mReleaseManager.queryTest(this, mPackageCollectionTest, mBaseline);
-
 
296
            mReleaseManager.queryRipples(this, mPackageCollectionRipple, mBaseline);
-
 
297
            mPackageCollectionAll.addAll(mPackageCollection);
-
 
298
            mPackageCollectionAll.addAll(mPackageCollectionWip);
-
 
299
            mPackageCollectionAll.addAll(mPackageCollectionTest);
-
 
300
            mPackageCollectionAll.addAll(mPackageCollectionRipple);
-
 
301
            
-
 
302
            // Sort the collection by PVID
-
 
303
            //      Unit Test output order is known
-
 
304
            //      May assist in creating repeatable build orders
-
 
305
            //
-
 
306
            Collections.sort(mPackageCollectionAll, Package.SeqComparator);
294
 
307
 
295
            //------------------------------------------------------------------------
308
            //------------------------------------------------------------------------
296
            //    Process packages collected
309
            //    Process packages collected
297
            //    Determine and tag those we can't build
310
            //    Determine and tag those we can't build
298
            phase.setPhase("processPackages");
311
            phase.setPhase("processPackages");
Line 349... Line 362...
349
                phase.setPhase("disconnectForPlanning");
362
                phase.setPhase("disconnectForPlanning");
350
                mReleaseManager.disconnectForPlanning(lastBuildActive);
363
                mReleaseManager.disconnectForPlanning(lastBuildActive);
351
            }
364
            }
352
        }
365
        }
353
 
366
 
354
        mLogger.warn("planRelease mDaemon " + mDaemon + " returned");
367
        mLogger.warn("planRelease mDaemon {} returned", mDaemon);
355
        phase.setPhase("EndPlan");
368
        phase.setPhase("EndPlan");
356
    }
369
    }
357
    
370
    
358
    /** Process packages that have been collected as a part of the plan
371
    /** Process packages that have been collected as a part of the plan
359
     * @param phase
372
     * @param phase
Line 361... Line 374...
361
     * @throws Exception
374
     * @throws Exception
362
     */
375
     */
363
    private void processPackages() throws SQLException, Exception {
376
    private void processPackages() throws SQLException, Exception {
364
 
377
 
365
        // Deal with test builds here as they may impact upon package attributes
378
        // Deal with test builds here as they may impact upon package attributes
366
        //    eg dependency collection and build standard differences
379
        //    eg: dependency collection and build standard differences
367
        //    This gives test builds preferential treatment
-
 
368
        //    Note: Done before mPackageDependencyCollection is setup
380
        //    Note: Done before mPackageDependencyCollection is setup
369
        //
381
        //
370
        if ( mDaemon )
382
        if ( mDaemon )
371
        {
383
        {
372
            // process test builds
384
            // Process test builds - they are in their own collection
373
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
385
            for (Iterator<Package> it = mPackageCollectionTest.iterator(); it.hasNext(); )
374
            {
386
            {
375
                Package p = it.next();
387
                Package p = it.next();
-
 
388
                mLogger.info("planRelease package test build {}", p.mAlias);
376
 
389
 
-
 
390
                //
-
 
391
                //    Cannot test build an SDK based package or a Pegged Package
-
 
392
                //        Remove the test build request from the database
-
 
393
                //        Send a warning email
-
 
394
                //
377
                if (p.mBuildFile == 0)
395
                if(p.mIsPegged || p.mIsSdk)
378
                {
396
                {
379
                    // package has yet to be processed
-
 
380
                    if (  p.mTestBuildInstruction > 0 )
-
 
381
                    {
-
 
382
                        mLogger.info("planRelease package test build " + p.mName);
-
 
383
 
-
 
384
                        //
-
 
385
                        //    Cannot test build an SDK based package or a Pegged Package
-
 
386
                        //        Remove the test build request from the database
-
 
387
                        //        Send a warning email
-
 
388
                        //
-
 
389
                        if(p.mIsPegged || p.mIsSdk)
-
 
390
                        {
-
 
391
                            String reason;
397
                    String reason;
392
                            reason = (p.mIsPegged) ? "Pegged" : "SDK Based";
398
                    reason = (p.mIsPegged) ? "Pegged" : "SDK Based";
393
 
399
 
394
                            mLogger.error("planRelease Daemon Instruction of " + reason + " package deleted: " + p.mName);
400
                    mLogger.error("planRelease Daemon Instruction (testBuild) of {} package deleted: {}", reason, p.mAlias);
395
                            mReleaseManager.markDaemonInstCompleted( p.mTestBuildInstruction );
401
                    mReleaseManager.markDaemonInstCompleted( p.mTestBuildInstruction );
396
                            emailRejectedDaemonInstruction("Cannot 'Test Build' a " + reason + " package",p);
402
                    emailRejectedDaemonInstruction("Cannot 'Test Build' a " + reason + " package",p);
397
                        }
403
                }
398
 
404
 
399
                        // force patch for test build numbering
405
                // force patch for test build numbering
400
                        p.mDirectlyPlanned = true;
406
                p.mDirectlyPlanned = true;
401
                        p.mChangeType.setPatch();
407
                p.mChangeType.setPatch();
402
                        p.mRequiresSourceControlInteraction = false;
408
                p.mRequiresSourceControlInteraction = false;
403
                        p.mBuildReason = BuildReason.Test;
409
                p.mBuildReason = BuildReason.Test;
404
                        rippleIndirectlyPlanned(p);
410
                p.mIndirectlyPlanned = true;
405
 
-
 
406
                        // put the mTestBuildAttributes to work
-
 
407
                        p.mVcsTag = p.mTestBuildVcsTag;
-
 
408
                        p.mId = p.mTestBuildPvId;
-
 
409
                        p.setTestEmail();
-
 
410
                        p.setTestDependencyCollection();
-
 
411
                        p.setTestBuildStandardCollection();
-
 
412
                        p.mHasAutomatedUnitTests = p.mTestBuildHasAutomatedUnitTests;
-
 
413
                    }
-
 
414
                }
-
 
415
            }
411
            }
416
        }
412
        }
417
 
413
 
418
        // Set up mPackageDependencyCollection on each package
414
        // Set up mPackageDependencyCollection on each package
419
        //    Examine the dependencies by alias and convert this to a 'package' selected from the released package set
415
        //    Examine the dependencies by alias and convert this to a 'package' selected from the released package set
420
        mLogger.debug("planRelease setup mPackageDependencyCollection");
416
        mLogger.debug("planRelease setup setPackageDependencyCollection");
421
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
417
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
422
        {
418
        {
423
            Package p = it.next();
419
            Package p = it.next();
424
 
420
 
425
            for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
421
            for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
426
            {
422
            {
427
                String alias = it2.next();
423
                String alias = it2.next();
428
                Package dependency = findPackage(alias);
424
                Package dependency = findPackage(alias);
429
 
-
 
430
                p.mPackageDependencyCollection.add(dependency);
425
                p.mPackageDependencyCollection.add(dependency);
431
            }
426
            }
432
        }
427
        }    
433
 
428
 
434
        // DEVI 56479 detect and deal with circular dependencies
429
        // Detect and deal with circular dependencies
-
 
430
        // Examine all packages under consideration
-
 
431
        //
435
        mLogger.debug("planRelease deal with circular dependencies");
432
        mLogger.debug("planRelease deal with circular dependencies");
436
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
433
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
437
        {
434
        {
438
            Package p = it.next();
435
            Package p = it.next();
439
 
436
 
440
            if ( p.hasCircularDependency( this ) )
437
            if ( p.hasCircularDependency( this ) )
441
            {
438
            {
442
                mLogger.info("planRelease circular dependency detected " + p.mAlias);
439
                mLogger.info("planRelease circular dependency detected {}", p.mAlias);
443
                
440
                
444
                //  Force this package to be marked as having a circular dependency - even if its been excluded
441
                //  Force this package to be marked as having a circular dependency - even if its been excluded
445
                p.mBuildFile = 0;
442
                p.mBuildFile = 0;
446
                
443
                
447
                // exclude all dependent packages
444
                // exclude all dependent packages
448
                // max 50 chars
445
                // max 50 chars
449
                rippleBuildExclude(p, p.mId, "Package has circular dependency", null, null, true);
446
                rippleBuildExclude(p, p.mId, "Package has circular dependency", null, null, true);
450
 
447
 
451
                // take the package out of the build
448
                // take the package out of the build
452
                p.mBuildFile = -6;
449
                p.mBuildFile = -6;
453
                mLogger.info("planRelease set mBuildFile to -6 for package " + p.mAlias );
450
                mLogger.info("planRelease set mBuildFile to -6 for package {}", p.mAlias );
454
                standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
451
                standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
455
                mCircularDependencyFlag = false;
452
                mCircularDependencyFlag = false;
456
            }
453
            }
457
        }
454
        }
458
 
455
 
459
        // Scan for packages with missing dependencies
456
        // Scan for packages with missing dependencies
460
        //    ie: The dependent package is not in the package Collection
457
        //    ie: The dependent package is not in the package Collection
461
        //        DEVI 55483 now use the fully built mPackageDependencyCollection (in rippleBuildExclude)
458
        //        DEVI 55483 now use the fully built mPackageDependencyCollection (in rippleBuildExclude)
462
        mLogger.debug("planRelease use the fully built mPackageDependencyCollection");
459
        mLogger.debug("planRelease use the fully built mPackageDependencyCollection");
463
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
460
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
464
        {
461
        {
465
            Package p = it.next();
462
            Package p = it.next();
466
 
463
 
467
            if ( mDaemon )
464
            if ( mDaemon )
468
            {
465
            {
Line 480... Line 477...
480
                String alias = it2.next();
477
                String alias = it2.next();
481
                Package dependency = findPackage(alias);
478
                Package dependency = findPackage(alias);
482
 
479
 
483
                if (dependency == ReleaseManager.NULL_PACKAGE)
480
                if (dependency == ReleaseManager.NULL_PACKAGE)
484
                {
481
                {
485
                    mLogger.info("planRelease dependency is not in the baseline " + alias);
482
                    mLogger.info("planRelease dependency is not in the baseline {}", alias);
486
                    // exclude all dependent packages
483
                    // exclude all dependent packages
487
                    // max 50 chars
484
                    // max 50 chars
488
                    rippleBuildExclude(p, p.mId, "Package build dependency not in the release", null, null, true);
485
                    rippleBuildExclude(p, p.mId, "Package build dependency not in the release", null, null, true);
489
 
486
 
490
                    // take the package out of the build
487
                    // take the package out of the build
491
                    p.mBuildFile = -4;
488
                    p.mBuildFile = -4;
492
                    mLogger.info("planRelease set mBuildFile to -4 for package " + p.mAlias );
489
                    mLogger.info("planRelease set mBuildFile to -4 for package {}", p.mAlias );
493
                    standardOut(mNotInBaseline, p.mAlias, mNotInBaselineFlag);
490
                    standardOut(mNotInBaseline, p.mAlias, mNotInBaselineFlag);
494
                    mNotInBaselineFlag = false;
491
                    mNotInBaselineFlag = false;
495
                    break;
492
                    break;
496
                }
493
                }
497
            }
494
            }
498
        }
495
        }
499
 
496
 
500
        // Process packages which are not reproducible, and all packages dependent upon them
497
        // Detect packages with no build standard and exclude them from the build
501
        //    ie: Have no build standard      
-
 
502
        mLogger.debug("planRelease process packages which are not reproducible");
498
        mLogger.debug("planRelease process packages which are not reproducible");
503
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
499
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
504
        {
500
        {
505
            Package p = it.next();
501
            Package p = it.next();
506
 
502
 
507
            if (p.mBuildFile == 0)
503
            if (p.mBuildFile == 0)
508
            {
504
            {
Line 515... Line 511...
515
                    {
511
                    {
516
                        continue;
512
                        continue;
517
                    }
513
                    }
518
                }
514
                }
519
 
515
 
-
 
516
                // Does the package have a build standard. If not then we can't reproduce it.
520
                // package has yet to be processed
517
                // Escrow - Assume the package is provided
-
 
518
                // Daemon - Exclude this package, but not its consumers. If the package is available then we can use it.
521
                if (!p.isReproducible())
519
                if (!p.isReproducible())
522
                {
520
                {
523
                    // for escrow build purposes, exclude all dependent package versions
-
 
524
                    mLogger.info("planRelease package not reproducible " + p.mName);
521
                    mLogger.info("planRelease package not reproducible {}" ,p.mName);
525
                    // max 50 chars
522
                    // max 50 chars
526
                    rippleBuildExclude(p, p.mId, "Package has no build environment", null, null, true);
523
                    rippleBuildExclude(p, p.mId, "Package has no build environment", null, null, false);
527
 
524
 
528
                    // package is not reproducible, discard
525
                    // package is not reproducible, discard
529
                    p.mBuildFile = -1;
526
                    p.mBuildFile = -1;
530
                    mLogger.info("planRelease set mBuildFile to -1 for package " + p.mAlias );
527
                    mLogger.info("planRelease set mBuildFile to -1 for package {}", p.mAlias );
531
                    standardOut(mAnyBuildPlatforms, p.mAlias, mAnyBuildPlatformsFlag);
528
                    standardOut(mAnyBuildPlatforms, p.mAlias, mAnyBuildPlatformsFlag);
532
                    mAnyBuildPlatformsFlag = false;
529
                    mAnyBuildPlatformsFlag = false;
533
                }
530
                }
534
            }
531
            }
535
        }
532
        }
536
 
533
 
537
        //    Process packages which are not reproducible on the configured set of  build machines.
534
        //    Process packages which are not reproducible on the configured set of build machines.
538
        //
535
        //
539
        //    Test each package and determine if the package contains a buildStandard that
536
        //    Test each package and determine if the package contains a buildStandard that
540
        //    can be processed by one of the machines in the build set
537
        //    can be processed by one of the machines in the build set
541
        //
538
        //
542
        //    ie: Package: Win32:Production and we have a BM with a class of 'Win32'
539
        //    ie: Package: Win32:Production and we have a BM with a class of 'Win32'
543
        //
540
        //
544
        //    July-2014 
-
 
545
        //    Only exclude the failing package and not its dependents
541
        //    Only exclude the failing package and not its dependents
546
        //    May be legitimate in the release
542
        //    May be legitimate in the release
547
        //
543
        //
-
 
544
//TODO - verify this code. I'm not sure it can be reached. I think that the "Package has no build environment" test above is detecting all these packages
548
        mLogger.debug("planRelease process packages which are not reproducible2");
545
        mLogger.debug("planRelease process packages which are not reproducible2");
549
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
546
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
550
        {
547
        {
551
            Package p = it.next();
548
            Package p = it.next();
552
 
549
 
553
            if (p.mBuildFile == 0)
550
            if (p.mBuildFile == 0)
554
            {
551
            {
Line 574... Line 571...
574
                    String machineClass = it2.next();
571
                    String machineClass = it2.next();
575
 
572
 
576
                    if ( p.canBeBuildby(machineClass))
573
                    if ( p.canBeBuildby(machineClass))
577
                    {
574
                    {
578
                        reproduce = true;
575
                        reproduce = true;
579
                        mLogger.info("planRelease package built on " + machineClass + " " + p.mAlias );
576
                        mLogger.info("planRelease package built on {} {}", machineClass, p.mAlias );
580
                        break;
577
                        break;
581
                    }
578
                    }
582
                }
579
                }
583
 
580
 
584
                if ( !reproduce )
581
                if ( !reproduce )
585
                {
582
                {
586
                    mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline " + p.mName);
583
                    mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline {}", p.mName);
587
 
584
 
588
                    if (mDaemon)
-
 
589
                    {
-
 
590
                        // DEVI 54816
-
 
591
                        // for escrow build purposes, do not exclude all dependent package versions
-
 
592
                        // max 50 chars
585
                    // max 50 chars
593
                        rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null, null, false);
586
                    rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null, null, false);
594
                    }
-
 
595
 
587
 
596
                    // package is not reproducible on the build platforms configured for this baseline, discard
588
                    // package is not reproducible on the build platforms configured for this baseline, discard
597
                    p.mBuildFile = -2;
589
                    p.mBuildFile = -2;
598
                    mLogger.info("planRelease set mBuildFile to -2 for package " + p.mAlias );
590
                    mLogger.info("planRelease set mBuildFile to -2 for package {}", p.mAlias );
599
                    standardOut(mAssocBuildPlatforms, p.mAlias, mAssocBuildPlatformsFlag);
591
                    standardOut(mAssocBuildPlatforms, p.mAlias, mAssocBuildPlatformsFlag);
600
                    mAssocBuildPlatformsFlag = false;
592
                    mAssocBuildPlatformsFlag = false;
601
                }
593
                }
602
            }
594
            }
603
        }      
595
        }      
Line 619... Line 611...
619
                    // mBuildExclusionCollection is at this point based on
611
                    // mBuildExclusionCollection is at this point based on
620
                    // relevant (direct and indirect) excluded pv's in the database
612
                    // relevant (direct and indirect) excluded pv's in the database
621
                    if ( be.compare(p.mId) && be.isARootCause() && p.mTestBuildInstruction == 0 && p.mForcedRippleInstruction == 0 )
613
                    if ( be.compare(p.mId) && be.isARootCause() && p.mTestBuildInstruction == 0 && p.mForcedRippleInstruction == 0 )
622
                    {
614
                    {
623
                        // package is not reproducible, discard
615
                        // package is not reproducible, discard
-
 
616
 
-
 
617
 
624
                        rippleBuildExclude( p, p.mId, null, it, be, true );
618
                        rippleBuildExclude( p, p.mId, null, it, be, true );
625
                        p.mBuildFile = -3;
619
                        p.mBuildFile = -3;
626
                        mLogger.info("planRelease set mBuildFile to -3 for package " + p.mAlias );
620
                        mLogger.info("planRelease set mBuildFile to -3 for package {}", p.mAlias );
627
                        break;
621
                        break;
628
                    }
622
                    }
629
                }
623
                }
630
            }
624
            }
631
 
625
 
Line 643... Line 637...
643
                    if (p.mIsPegged || p.mIsSdk)
637
                    if (p.mIsPegged || p.mIsSdk)
644
                    {
638
                    {
645
                        continue;
639
                        continue;
646
                    }
640
                    }
647
 
641
 
648
                    // package has yet to be processed
642
                    //    Examine this packages dependencies
649
                    if (p.mDirectlyPlanned)
-
 
650
                    {
-
 
651
                        // a WIP exists on the package, or it is a Test Build
643
                    //    If one of them does not exist in the 'official release' set then
652
                        // exclude all dependent package versions
644
                    //    the package needs to be built against the official release set
653
                        mLogger.info("planRelease package has WIP " + p.mName);
645
                    //    and we can't build any of its dependent packages
654
                        if ( p.mBuildReason == null)
646
                    Iterator<Integer> it2 = p.mDependencyIDCollection.iterator();
655
                            p.mBuildReason = BuildReason.NewVersion;
647
                    Iterator<Package> it3 = p.mPackageDependencyCollection.iterator();
656
                        rippleIndirectlyPlanned(p);
648
                    while ( it2.hasNext() && it3.hasNext() )
657
                    }
-
 
658
                    else
-
 
659
                    {
649
                    {
660
                        //    Examine this packages dependencies
-
 
661
                        //    If one of them does not exist in the 'official release' set then
-
 
662
                        //    the package needs to be built against the official release set
-
 
663
                        //    and we can't build any of its dependent packages
-
 
664
                        Iterator<Integer> it2 = p.mDependencyIDCollection.iterator();
-
 
665
                        Iterator<Package> it3 = p.mPackageDependencyCollection.iterator();
-
 
666
                        while ( it2.hasNext() && it3.hasNext() )
-
 
667
                        {
-
 
668
                            Integer dpvId = it2.next();
650
                        Integer dpvId = it2.next();
669
                            Package dependency = it3.next();
651
                        Package dependency = it3.next();
670
 
652
 
671
                            if ( !dependency.mAdvisoryRipple )
653
                        if ( !dependency.mAdvisoryRipple )
-
 
654
                        {
-
 
655
                            // not advisory, ie: has ripple build impact
-
 
656
                            if ( !isInRelease(dpvId) )
672
                            {
657
                            {
673
                                // not advisory, ie: has ripple build impact
658
                                // the package is out of date
-
 
659
                                // exclude all dependent package versions
-
 
660
                                mLogger.info("planRelease package out of date {}", p.mName);
-
 
661
                                p.mBuildReason = BuildReason.Ripple;
674
                                if ( !isInRelease(dpvId) )
662
                                rippleIndirectlyPlanned(p);
-
 
663
                                
-
 
664
                                //  This package needs to be rippled
-
 
665
                                //  If this package has a rippleStop marker of 's', then we cannot
-
 
666
                                //  build this package at the moment.
-
 
667
                                //  Packages that depend on this package have been excluded
-
 
668
                                //  We need to exclude this one too
-
 
669
                                //
-
 
670
                                if (p.mRippleStop == 's' || p.mRippleStop == 'w') 
675
                                {
671
                                {
676
                                    // the package is out of date
672
                                    // Package marked as a rippleStop
677
                                    // exclude all dependent package versions
673
                                    // max 50 chars
678
                                    mLogger.info("planRelease package out of date " + p.mName);
674
                                    rippleBuildExclude(p, -2, "Ripple Required." + " Waiting for user", null, null, false);
-
 
675
 
679
                                    p.mBuildReason = BuildReason.Ripple;
676
                                    // package is unBuildable, mark reason and discard
680
                                    rippleIndirectlyPlanned(p);
677
                                    p.mBuildFile = -11;
681
                                    
678
                                    
682
                                    //  This package needs to be rippled
-
 
683
                                    //  If this package has a rippleStop marker of 's', then we cannot
-
 
684
                                    //  build this package at the moment.
-
 
685
                                    //  Packages that depend on this package have been excluded
-
 
686
                                    //  We need to exclude this one too
-
 
687
                                    //
-
 
688
                                    if (p.mRippleStop == 's' || p.mRippleStop == 'w') 
-
 
689
                                    {
-
 
690
                                        // Package marked as a rippleStop
-
 
691
                                        // max 50 chars
-
 
692
                                        rippleBuildExclude(p, -2, "Ripple Required." + " Waiting for user", null, null, false);
-
 
693
 
-
 
694
                                        // package is unBuildable, mark reason and discard
-
 
695
                                        p.mBuildFile = -11;
-
 
696
                                        
-
 
697
                                        if (p.mRippleStop == 's' ) {
679
                                    if (p.mRippleStop == 's' ) {
698
                                            // Need to flag to users that the package build is waiting user action
680
                                        // Need to flag to users that the package build is waiting user action
699
                                            mLogger.info("planRelease " + "Ripple Required." + " Stopped by flag" + p.mName);
681
                                        mLogger.info("planRelease Ripple Required. Stopped by flag {}", p.mName);
700
                                            mReleaseManager.setRippleStopWait(mRtagId,p);
682
                                        mReleaseManager.setRippleStopWait(mRtagId,p);
701
                                        }
-
 
702
                                    }
683
                                    }
703
                                    
-
 
704
                                    
-
 
705
                                    break;
-
 
706
                                }
684
                                }
-
 
685
                                
-
 
686
                                break;
707
                            }
687
                            }
708
                        }
688
                        }
709
                    }
689
                    }
710
                }
690
                }
711
            }
691
            }
712
 
692
 
713
            //  Daemon Mode Only
693
            //  Daemon Mode Only
714
            //  Process packages which do not exist in the archive
694
            //  Process packages which do not exist in the archive
715
            //  For unit test purposes, assume all packages exist in the archive if released
695
            //  For unit test purposes, assume all packages exist in the archive if released
716
            mLogger.debug("planRelease process packages which do not exist in the archive");
696
            mLogger.debug("planRelease process packages which do not exist in the archive");
717
            if ( ReleaseManager.mUseDatabase )
697
            if ( mReleaseManager.mUseDatabase )
718
            {
698
            {
719
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
699
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
720
                {
700
                {
721
                    Package p = it.next();
701
                    Package p = it.next();
722
 
702
 
Line 730... Line 710...
730
                            {
710
                            {
731
                                if (! p.mIsBuildable)
711
                                if (! p.mIsBuildable)
732
                                {
712
                                {
733
                                    //  Package does not exist in dpkg_archive and it has been flagged as unbuildable
713
                                    //  Package does not exist in dpkg_archive and it has been flagged as unbuildable
734
                                    //  This may be because is Unbuildable or Manually built
714
                                    //  This may be because is Unbuildable or Manually built
735
                                    mLogger.info("planRelease " + "Unbuildable" + " package not found in archive " + p.mName);
715
                                    mLogger.info("planRelease Unbuildable package not found in archive {}", p.mName);
736
                                    // max 50 chars
716
                                    // max 50 chars
737
                                    rippleBuildExclude(p, p.mId, "Unbuildable" + " package not found in archive", null, null, true);
717
                                    rippleBuildExclude(p, p.mId, "Unbuildable" + " package not found in archive", null, null, true);
738
 
718
 
739
                                    // package is unBuildable, mark reason and discard
719
                                    // package is unBuildable, mark reason and discard
740
                                    p.mBuildFile = -10;
720
                                    p.mBuildFile = -10;
Line 748... Line 728...
748
                                    reason = (p.mIsPegged) ? "Pegged" : "SDK";
728
                                    reason = (p.mIsPegged) ? "Pegged" : "SDK";
749
 
729
 
750
                                    //  Pegged packages or packages provided from an SDK MUST exist in dpkg_archive
730
                                    //  Pegged packages or packages provided from an SDK MUST exist in dpkg_archive
751
                                    //  They will not be built within the context of this release. It is the responsibility
731
                                    //  They will not be built within the context of this release. It is the responsibility
752
                                    //  of another release to build them.
732
                                    //  of another release to build them.
753
                                    mLogger.info("planRelease " + reason + " package not found in archive " + p.mName);
733
                                    mLogger.info("planRelease {} package not found in archive {}", reason, p.mName);
754
                                    // max 50 chars
734
                                    // max 50 chars
755
                                    rippleBuildExclude(p, p.mId, reason + " package not found in archive", null, null, true);
735
                                    rippleBuildExclude(p, p.mId, reason + " package not found in archive", null, null, true);
756
 
736
 
757
                                    // package is not reproducible, mark reason and discard
737
                                    // package is not reproducible, mark reason and discard
758
                                    p.mBuildFile = -7;
738
                                    p.mBuildFile = -7;
Line 770... Line 750...
770
                                        if ( !isInRelease(dpvId) )
750
                                        if ( !isInRelease(dpvId) )
771
                                        {
751
                                        {
772
                                            // This package cannot be rebuilt as one of its dependents is NOT in this release
752
                                            // This package cannot be rebuilt as one of its dependents is NOT in this release
773
                                            // exclude all dependent package versions
753
                                            // exclude all dependent package versions
774
                                            
754
                                            
775
                                            mLogger.info("planRelease package not found in archive. Cannot be rebuilt du to  " + p.mName);
755
                                            mLogger.info("planRelease package not found in archive. Cannot be rebuilt due to {}", p.mName);
776
                                            // max 50 chars
756
                                            // max 50 chars
777
                                            rippleBuildExclude(p, p.mId, "Package cannot be rebuilt in this release", null, null, true);
757
                                            rippleBuildExclude(p, p.mId, "Package cannot be rebuilt in this release", null, null, true);
778
 
758
 
779
                                            // package is not reproducible, mark reason and discard
759
                                            // package is not reproducible, mark reason and discard
780
                                            p.mBuildFile = -4;
760
                                            p.mBuildFile = -4;
Line 783... Line 763...
783
                                    }
763
                                    }
784
                                    
764
                                    
785
                                    //  The package has not been excluded from the build
765
                                    //  The package has not been excluded from the build
786
                                    if (p.mBuildFile == 0)
766
                                    if (p.mBuildFile == 0)
787
                                    {
767
                                    {
788
                                        mLogger.info("planRelease package not found in archive " + p.mName);
768
                                        mLogger.info("planRelease package not found in archive {}", p.mName);
789
                                        // DEVI 47395 the cause of this build is not WIP or ripple induced,
769
                                        // DEVI 47395 the cause of this build is not WIP or ripple induced,
790
                                        // it simply does not exist in the archive (has been removed)
770
                                        // it simply does not exist in the archive (has been removed)
791
                                        // prevent source control interaction
771
                                        // prevent source control interaction
792
                                        p.mRequiresSourceControlInteraction = false;
772
                                        p.mRequiresSourceControlInteraction = false;
793
                                        p.mBuildReason = BuildReason.Restore;
773
                                        p.mBuildReason = BuildReason.Restore;
Line 799... Line 779...
799
                    }
779
                    }
800
                }
780
                }
801
            }
781
            }
802
 
782
 
803
            //  Daemon Mode Only
783
            //  Daemon Mode Only
804
            //  Process forced ripples
784
            //  Detect bad forced ripples requests and reject them
805
            mLogger.debug("planRelease process forced ripples");
785
            mLogger.debug("planRelease process forced ripples");
806
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
786
            for (Iterator<Package> it = mPackageCollectionRipple.iterator(); it.hasNext(); )
807
            {
787
            {
808
                Package p = it.next();
788
                Package p = it.next();
809
 
789
 
810
                if (p.mBuildFile == 0)
790
                if (p.mBuildFile == 0)
811
                {
791
                {
-
 
792
                    //
-
 
793
                    //    Cannot force a ripple on an SDK based package or a Pegged Package
-
 
794
                    //        Remove the daemon instruction from the database
812
                    // package has yet to be processed
795
                    //        Send a warning email
-
 
796
                    //
813
                    if ( p.mForcedRippleInstruction > 0 )
797
                    if(p.mIsPegged || p.mIsSdk)
814
                    {
798
                    {
815
                        //
-
 
816
                        //    Cannot force a ripple on an SDK based package or a Pegged Package
-
 
817
                        //        Remove the daemon instruction from the database
-
 
818
                        //        Send a warning email
-
 
819
                        //
-
 
820
                        if(p.mIsPegged || p.mIsSdk)
-
 
821
                        {
-
 
822
                            String reason;
799
                        String reason;
823
                            reason = (p.mIsPegged) ? "Pegged" : "SDK Based";
800
                        reason = (p.mIsPegged) ? "Pegged" : "SDK Based";
824
 
801
 
825
                            mLogger.error("planRelease Daemon Instruction of " + reason + " package deleted: " + p.mName);
802
                        mLogger.error("planRelease Daemon Instruction of {} package deleted: {}", reason, p.mName);
826
                            mReleaseManager.markDaemonInstCompleted( p.mForcedRippleInstruction );
803
                        mReleaseManager.markDaemonInstCompleted( p.mForcedRippleInstruction );
827
                            emailRejectedDaemonInstruction("Cannot 'Ripple' a " + reason + " package",p);
804
                        emailRejectedDaemonInstruction("Cannot 'Ripple' a " + reason + " package",p);
828
 
805
 
829
                            p.mBuildFile = -8; 
806
                        p.mBuildFile = -8; 
830
                        }
-
 
831
                        else
-
 
832
                        {
-
 
833
                            mLogger.info("planRelease package forced ripple " + p.mName);
-
 
834
                            p.mBuildReason = BuildReason.Ripple;
-
 
835
                            rippleIndirectlyPlanned(p);
-
 
836
                        }
-
 
837
                    }
807
                    }
838
                }
808
                }
839
            }
809
            }
840
 
810
 
841
            //  Daemon Mode Only
811
            //  Daemon Mode Only
Line 854... Line 824...
854
                    if (p.mIsPegged || p.mIsSdk)
824
                    if (p.mIsPegged || p.mIsSdk)
855
                    {
825
                    {
856
                        String reason;
826
                        String reason;
857
                        reason = (p.mIsPegged) ? "Pegged" : "SDK";
827
                        reason = (p.mIsPegged) ? "Pegged" : "SDK";
858
 
828
 
859
                        mLogger.info("planRelease " + reason + " not built in this release " + p.mName);
829
                        mLogger.info("planRelease {} not built in this release {}", reason, p.mName);
860
                        p.mBuildFile = -8;
830
                        p.mBuildFile = -8;
861
                    }
831
                    }
862
                }
832
                }
863
            }
833
            }
864
 
834
 
865
            //  Daemon Mode Only
835
            //  Daemon Mode Only
866
            //  Locate Test Build Requests that cannot be satisfied - will not be built due to
836
            //  Locate Test Build Requests that cannot be satisfied - will not be built due to
867
            //  errors in dependent packages. Report the error to the user and remove the request
837
            //  errors in dependent packages. Report the error to the user and remove the request
868
            //
838
            //
869
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
839
            for (Iterator<Package> it = mPackageCollectionTest.iterator(); it.hasNext(); )
870
            {
840
            {
871
                Package p = it.next();
841
                Package p = it.next();
872
 
842
 
873
                if (p.mTestBuildInstruction > 0)
843
                if (p.mBuildFile < 0)
874
                {
844
                {
-
 
845
                    String reason;
875
                    if (p.mBuildFile < 0)
846
                    switch (p.mBuildFile)
876
                    {
847
                    {
877
                        String reason;
-
 
878
                        switch (p.mBuildFile)
-
 
879
                        {
-
 
880
                        case -1: reason = "Not reproducible"; break;
848
                    case -1:  reason = "Not reproducible"; break;
881
                        case -2: reason = "Not reproducible on configured build platforms"; break;
849
                    case -2:  reason = "Not reproducible on configured build platforms"; break;
882
                        case -3: reason = "Marked as 'Do not ripple'"; break;
850
                    case -3:  reason = "Marked as 'Do not ripple'"; break;
883
                        case -4: reason = "Dependent on a package not in the release"; break;
851
                    case -4:  reason = "Dependent on a package not in the release"; break;
884
                        case -5: reason = "Indirectly dependent on a package not reproducible in the release"; break;
852
                    case -5:  reason = "Indirectly dependent on a package not reproducible in the release"; break;
885
                        case -6: reason = "Has a circular dependency"; break;
853
                    case -6:  reason = "Has a circular dependency"; break;
886
                        case -7: reason = "Pegged or SDK package not in dpkg_archive"; break;
854
                    case -7:  reason = "Pegged or SDK package not in dpkg_archive"; break;
887
                        case -8: reason = "Is a Pegged or SDK package"; break;
855
                    case -8:  reason = "Is a Pegged or SDK package"; break;
888
                        case -9: reason = "Rejected Daemon Instruction"; break;
856
                    case -9:  reason = "Rejected Daemon Instruction"; break;
889
                        case -10: reason = "Unbuildable package not in dpkg_archive"; break;
857
                    case -10: reason = "Unbuildable package not in dpkg_archive"; break;
890
                        case -11: reason = "Marked as 'RippleStop'"; break;
858
                    case -11: reason = "Marked as 'RippleStop'"; break;
891
                        default: reason = "Unknown reason. Code:" + p.mBuildFile; break;
859
                    default:  reason = "Unknown reason. Code:" + p.mBuildFile; break;
892
                        }
860
                    }
893
                        mLogger.error("planRelease Test Build of an unbuildable of package deleted: " + p.mName);
861
                    mLogger.error("planRelease Test Build of an unbuildable of package deleted: {}", p.mName);
894
                        mReleaseManager.markDaemonInstCompleted( p.mTestBuildInstruction );
862
                    mReleaseManager.markDaemonInstCompleted( p.mTestBuildInstruction );
895
                        emailRejectedDaemonInstruction(reason,p);
863
                    emailRejectedDaemonInstruction(reason,p);
896
                    }
-
 
897
                }
864
                }
898
            }
865
            }
-
 
866
            
899
        }
867
        }
900
        else
868
        else
901
        {
869
        {
902
            // escrow reporting only
870
            // escrow reporting only
903
            // Report packages that are not reproducible
871
            // Report packages that are not reproducible
Line 927... Line 895...
927
    private void planBuildOrder() throws Exception, SQLException {
895
    private void planBuildOrder() throws Exception, SQLException {
928
 
896
 
929
        // Process remaining packages which are need to be reproduced for this baseline.
897
        // Process remaining packages which are need to be reproduced for this baseline.
930
        //    Determine the build file for each package
898
        //    Determine the build file for each package
931
        //    For daemon builds:
899
        //    For daemon builds:
932
        //      Determine the first package that can be built now, this means the first package 
900
        //      Determine the next package that can be built now
933
        //      not dependent upon packages also to be built.
901
        //          Sounds simple - doesn't it
934
        //      Set its mBuildNumber to 1, all remaining reproducible packages to 2
902
        //      Set its mBuildNumber to 1, all remaining reproducible packages to 2
935
        //      Add buildable packages to mBuildableCollection
-
 
936
        //    For escrow builds:
903
        //    For escrow builds:
937
        //      Determine the package versions that can be built in the build iteration
904
        //      Determine the package versions that can be built in the build iteration
938
        //      Set their mBuildNumber to the build iteration
905
        //      Set their mBuildNumber to the build iteration
939
        //      Increment the build iteration and repeat until all package versions 
906
        //      Increment the build iteration and repeat until all package versions 
940
        //      that need to be reproduced have been assigned a build iteration        
907
        //      that need to be reproduced have been assigned a build iteration        
941
        
908
        
942
        if ( mDaemon )
-
 
943
        {
-
 
944
            // Sort the build order such that the unit tests are sorted by instruction id 
-
 
945
            //  and placed at the head of the list. This is an attempt to have the oldest 
-
 
946
            //  unit tests at the head of the list.
-
 
947
            //
-
 
948
            //  The order of all other elements is preserved
-
 
949
            //  The order of the other elements is basically
-
 
950
            //      planned - ordered by modified date-time
-
 
951
            //      others  - order by pv_id
-
 
952
            //
-
 
953
            Package.setSequence(mPackageCollection);
-
 
954
            Collections.sort(mPackageCollection, Package.UnitTestComparator);
-
 
955
        }
-
 
956
        
-
 
957
        boolean allProcessed = false;
909
        boolean allProcessed = false;
958
        int buildFile = 1;
910
        int buildFile = 1;
959
 
911
 
960
        do
912
        do
961
        {
913
        {
-
 
914
            //
-
 
915
            //  Create the mBuildOrder collection
-
 
916
            //      Same for both Daemon and Escrow modes
-
 
917
            //      Will have package build order and build level
962
            boolean allDependenciesProcessed = true;
918
            boolean allDependenciesProcessed = true;
963
            do
919
            do
964
            {
920
            {
965
                // assume all dependencies have been processed
-
 
966
                allDependenciesProcessed = true;
921
                allDependenciesProcessed = true;
967
 
-
 
968
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
922
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
969
                {
923
                {
970
                    Package p = it.next();
924
                    Package p = it.next();
971
 
925
 
972
                    if ( (  mDaemon && ( ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) || p.mBuildFile < 0 ) ) ||
-
 
973
                         ( !mDaemon && p.mBuildFile == -2 ) )
926
                    if ( p.mBuildFile < 0  ) 
974
                    {
927
                    {
975
                        // Daemon: Flag packages with no build requirement as processed
928
                        // Daemon: Flag packages that cannot be built
976
                        // Escrow: Flag packages with a foreign build environment as processed
929
                        // Escrow: Flag packages with a foreign build environment as processed
977
                        p.mProcessed = true;
930
                        p.mProcessed = true;
978
                        mLogger.info("planRelease package has no build requirement " + p.mName);            
931
                        mLogger.info("planRelease package not buildable {}", p.mName);            
979
                    }
932
                    }
980
                    else if ( ( p.mBuildFile == 0 ) && ( (mDaemon && ( p.mDirectlyPlanned || p.mIndirectlyPlanned ) ) || ( !mDaemon ) ) )
933
                    else if ( p.mBuildFile == 0 )
981
                    {
934
                    {
982
                        // package yet to be processed and
935
                        // package yet to be processed and
983
                        //  Daemon mode: Has a build requirement
936
                        //  Daemon mode: Could be built
984
                        //  Escrow mode: Can be reproduced
937
                        //  Escrow mode: Can be reproduced
985
                        boolean canBeBuiltNow = true;
938
                        boolean canBeBuiltNow = true;
986
                        boolean allDependenciesForThisPackageProcessed = true;
939
                        boolean allDependenciesForThisPackageProcessed = true;
987
 
940
 
988
                        //  Scan the packages dependencies
941
                        //  Scan the packages dependencies
Line 996... Line 949...
996
                                //  If any of them have not been processed, then cannot calculate canBeBuiltNow until this 
949
                                //  If any of them have not been processed, then cannot calculate canBeBuiltNow until this 
997
                                //  dependency has been processed
950
                                //  dependency has been processed
998
                                allDependenciesForThisPackageProcessed = false;
951
                                allDependenciesForThisPackageProcessed = false;
999
                                allDependenciesProcessed = false;
952
                                allDependenciesProcessed = false;
1000
                            }
953
                            }
1001
                            else if (  (  mDaemon && ( dependency.mDirectlyPlanned ) || ( dependency.mIndirectlyPlanned ) ) 
954
                            else if (  (  mDaemon && (   dependency.mBuildFile == 0 ) ) 
1002
                                    || ( !mDaemon && ( ( dependency.mBuildFile == 0 ) ||
955
                                    || ( !mDaemon && ( ( dependency.mBuildFile == 0 ) ||
1003
                                                           ( dependency.mBuildFile == buildFile &&
956
                                                           ( dependency.mBuildFile == buildFile &&
1004
                                                           ( !p.haveSameBuildStandards(dependency)  ) ) ) ) )
957
                                                           ( !p.haveSameBuildStandards(dependency)  ) ) ) ) )
1005
                            {
958
                            {
1006
                                // Daemon mode:
959
                                // Daemon mode:
1007
                                //    This processed dependency has a build requirement - so can't build
960
                                //    This processed dependency has not been assigned to a build iteration - so can't built yet
1008
                                // Escrow mode: This package cannot be built now if
961
                                // Escrow mode: This package cannot be built now if
1009
                                //    This processed dependency has not been assigned to a build iteration or
962
                                //    This processed dependency has not been assigned to a build iteration or
1010
                                //    This processed dependency has been assigned to this build iteration, but the 
963
                                //    This processed dependency has been assigned to this build iteration, but the 
1011
                                //    build standards of the package and this dependency prevent the package being
964
                                //    build standards of the package and this dependency prevent the package being
1012
                                //    built in this iteration.   
965
                                //    built in this iteration.   
1013
                                canBeBuiltNow = false;
966
                                canBeBuiltNow = false;
1014
                                mLogger.info("planRelease package cannot be built in this iteration " + p.mName);
967
                                mLogger.info("planRelease package cannot be built in this iteration {}", p.mName);
1015
                                break;
968
                                break;
1016
                            }
969
                            }
1017
                        }
970
                        }
1018
 
971
 
-
 
972
                        //  All dependencies have been processed. May be able to build this package
-
 
973
                        //      Add the package to the build order list
-
 
974
                        //
1019
                        if (allDependenciesForThisPackageProcessed)
975
                        if (allDependenciesForThisPackageProcessed)
1020
                        {
976
                        {
1021
                            p.mProcessed = true;
977
                            p.mProcessed = true;
1022
 
-
 
1023
                            if ( mDaemon )
978
                            if ( canBeBuiltNow )
1024
                            {
979
                            {
1025
                                mBuildOrder.add(p);
980
                                mBuildOrder.add(p);
1026
                                if ( canBeBuiltNow )
-
 
1027
                                {
-
 
1028
                                    // flag package with build requirement, may get down graded to future build requirement
-
 
1029
                                    p.mBuildFile = 1;
-
 
1030
                                    mLogger.info("planRelease set mBuildFile to 1 for package " + p.mAlias );
-
 
1031
                                }
-
 
1032
                                else
-
 
1033
                                {
-
 
1034
                                    // flag package with future build requirement
-
 
1035
                                    p.mBuildFile = 2;
-
 
1036
                                    mLogger.info("planRelease set mBuildFile to 2 for package " + p.mAlias );
-
 
1037
                                }
-
 
1038
                            }
-
 
1039
                            else
-
 
1040
                            {
-
 
1041
                                // Escrow Mode
-
 
1042
                                if ( canBeBuiltNow )
-
 
1043
                                {
-
 
1044
                                    mBuildOrder.add(p);
-
 
1045
                                    p.mBuildFile = buildFile;
981
                                p.mBuildFile = buildFile;
1046
                                    mLogger.info("planRelease set mBuildFile to " + buildFile + " for package " + p.mAlias );
982
                                mLogger.info("planRelease set mBuildFile to {} for package {}",buildFile, p.mAlias );
1047
                                }
-
 
1048
                            }
983
                            }
1049
                        }
984
                        }
1050
                    }
985
                    }
1051
                }
986
                }
1052
            } while( !allDependenciesProcessed );
987
            } while( !allDependenciesProcessed );
-
 
988
            
-
 
989
            //  Have process all the packages that we can at the moment
-
 
990
            //      Examine all the packages in the collection to see if there are more that need to be extracted
-
 
991
            //      These will be done at a different build-level
-
 
992
            //  
-
 
993
            allProcessed = true;
-
 
994
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
-
 
995
            {
-
 
996
                Package p = it.next();
-
 
997
                if ( p.mBuildFile == 0 )
-
 
998
                {
-
 
999
                    // more build files are required
-
 
1000
                    allProcessed = false;
-
 
1001
                    mLogger.info("planRelease more build files are required for {}", p.mName);
-
 
1002
                    break;
-
 
1003
                }
-
 
1004
            }
-
 
1005
 
-
 
1006
            buildFile++;
-
 
1007
            if (buildFile % 500 == 0 ) {
-
 
1008
                mLogger.error("planRelease. Too many build levels {}", buildFile);
-
 
1009
            }
-
 
1010
        } while( !allProcessed );
-
 
1011
            
-
 
1012
 
-
 
1013
        if ( mDaemon )
-
 
1014
        {
1053
 
1015
 
1054
            //
1016
            //
1055
            //  Daemon Mode:
1017
            //  Daemon Mode:
1056
            //  Locate all packages that we would like to build and
1018
            //  Locate all packages that we can build now
1057
            //      Calculate new version - report errors
-
 
1058
            //      Determine a package we would like to build
1019
            //      Packages that have a build requirement and have no reason we cannot build them
1059
            //
1020
            //
-
 
1021
            ArrayList<Package> buildCandidates = new ArrayList<Package>();
-
 
1022
 
1060
            if ( mDaemon )
1023
            
-
 
1024
            for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
1061
            {
1025
            {
-
 
1026
                Package p = it.next();
1062
                for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
1027
                if ( p.mProcessed && p.mBuildFile > 0 )
1063
                {
1028
                {
1064
                    Package p = it.next();
-
 
1065
 
-
 
1066
                    if ( p.mProcessed && p.mBuildFile == 1 )
1029
                    if (p.mBuildReason != null)
1067
                    {
1030
                    {
1068
                        p.mBuildFile = buildFile;
1031
                        // Have a reason to build this package
1069
                        mLogger.info("planRelease 2 set mBuildFile to " + buildFile + " for package " + p.mAlias );
-
 
1070
 
-
 
1071
                        if ( buildFile == 1 )
1032
                        buildCandidates.add(p);
1072
                        {
-
 
1073
                            int pvApplied = p.applyPV(mReleaseManager, mBaseline);
1033
                        mLogger.info("planRelease Candidate {}",p.mAlias);
1074
 
-
 
1075
                            if ( pvApplied == 1 )
-
 
1076
                            {
1034
                    }
1077
                                // max 50 chars
1035
                }
1078
                                rippleBuildExclude(p, p.mId, "Package has non standard versioning", null, null, true);
-
 
1079
                            }
1036
            }
1080
                            else if ( pvApplied == 2 )
-
 
1081
                            {
1037
            
1082
                                // max 50 chars
1038
            //  Add in the WIPs, Tests and Ripple Requests so that we can process them as one collections
1083
                                rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null, null, true);
1039
            //  Now have a collection of packages that we would like to build right now
1084
                            }
1040
            //  See if any of them can be excluded due to issues with creating a new package version
1085
                            else if ( pvApplied == 3 )
1041
            buildCandidates.addAll(mPackageCollectionWip);
1086
                            {
-
 
1087
                                // max 50 chars
1042
            buildCandidates.addAll(mPackageCollectionTest);
1088
                                rippleBuildExclude(p, p.mId, "Package has invalid change type", null, null, true);
1043
            buildCandidates.addAll(mPackageCollectionRipple);
1089
                            }
1044
            
1090
                            else
1045
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1091
                            {
1046
            {
1092
                                //    Have found a package to build
-
 
1093
                                //        Prevent finding others
-
 
1094
                                buildFile = 2;
1047
                Package p = it.next();
1095
 
1048
 
1096
                                if ( p.mForcedRippleInstruction > 0 )
1049
                if ( p.mBuildFile >= 0 )
1097
                                {
1050
                {
1098
                                    mReleaseManager.markDaemonInstCompleted( p.mForcedRippleInstruction );
1051
                    int pvApplied = p.applyPV(mReleaseManager, mBaseline);
1099
                                }
-
 
1100
 
1052
 
1101
                                if ( p.mTestBuildInstruction > 0 )
1053
                    if ( pvApplied == 1 )
-
 
1054
                    {
1102
                                {
1055
                        // max 50 chars
1103
                                    mReleaseManager.markDaemonInstInProgress( p.mTestBuildInstruction );
1056
                        rippleBuildExclude(p, p.mId, "Package has non standard versioning", null, null, true);
-
 
1057
                    }
-
 
1058
                    else if ( pvApplied == 2 )
-
 
1059
                    {
-
 
1060
                        // max 50 chars
-
 
1061
                        rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null, null, true);
-
 
1062
                    }
-
 
1063
                    else if ( pvApplied == 3 )
-
 
1064
                    {
1104
                                }
1065
                        // max 50 chars
-
 
1066
                        rippleBuildExclude(p, p.mId, "Package has invalid change type", null, null, true);
-
 
1067
                    }
-
 
1068
                    
-
 
1069
                    if ( pvApplied != 0) 
-
 
1070
                    {
-
 
1071
                        // If this package is not a WIP/TEST/RIPPLE, then remove it from this collection
-
 
1072
                        // Want to keep all WIP/TEST/RIPPLE items to simplify deporting
-
 
1073
                        if (! p.mIsNotReleased )
1105
                            }
1074
                        {
-
 
1075
                            it.remove();
1106
                        }
1076
                        }
-
 
1077
                    }
-
 
1078
                    
-
 
1079
                    //
-
 
1080
                    //  Ensure that the mRippleTime is known for each package
-
 
1081
                    //  Collection includes: naturalRipples, ForcedRipples, TestBuilds and NewVersions
-
 
1082
                    if ( pvApplied == 0)
-
 
1083
                    {
-
 
1084
                        if (p.mTestBuildInstruction != 0)
-
 
1085
                        {
-
 
1086
                            // Test Build - there is no ripple effect
-
 
1087
                            // The time impact will be the estimated build time of this one package
-
 
1088
                            p.mRippleTime = p.mBuildTime;
-
 
1089
                            
-
 
1090
                        }
1107
                        else
1091
                        else 
1108
                        {
1092
                        {
1109
                            mLogger.info("planRelease package has future (downgraded) build requirement " + p.mName + " " + buildFile);              
1093
                            //  Calculate the time to build the package AND all of the packages that depend on it
-
 
1094
                            //  Calculate the build plan for the package
-
 
1095
                            //
-
 
1096
                            calcBuildPlan(p);
1110
                        }
1097
                        }
1111
                    }
1098
                    }
1112
                }
1099
                }
1113
            }
1100
            }
1114
 
1101
            
-
 
1102
            //
1115
            // are more build files required
1103
            //  Determine the NON-test package the we will build next
1116
            allProcessed = true;
1104
            //
1117
 
-
 
-
 
1105
            Package build = ReleaseManager.NULL_PACKAGE; 
1118
            if (mDaemon)
1106
            
-
 
1107
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1119
            {
1108
            {
1120
                //  Recalculate mBuildOrder
-
 
1121
                //  Remove any packages that cannot be built due to errors encountered during
-
 
1122
                //  the use of applyPV()
-
 
1123
                //
1109
                
1124
                ArrayList<Package> mTempBuildOrder = new ArrayList<Package>();
1110
                Package p = it.next();
1125
 
-
 
1126
                //  Seed mBuildOrder with packages that were prime buildable candidates
-
 
1127
                //  This includes test builds
1111
                if ( p.mBuildFile >= 0 )
1128
                //      Insert the active build at the head of the list - should only be one
-
 
1129
                //
-
 
1130
                for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
-
 
1131
                {
1112
                {
1132
                    Package p = it.next();
-
 
1133
                    if(p.mBuildFile > 0)
1113
                    if (p.mTestBuildInstruction == 0)
1134
                    {
1114
                    {
-
 
1115
                        //  Not a Test Build
-
 
1116
                        if (build == ReleaseManager.NULL_PACKAGE || p.mRippleTime < build.mRippleTime)
-
 
1117
                        {
1135
                        mTempBuildOrder.add(p);
1118
                            build = p;
-
 
1119
                        }
1136
                    }
1120
                    }
1137
                }
1121
                }
1138
                mBuildOrder = mTempBuildOrder;
1122
            }
1139
 
1123
 
-
 
1124
            //  Determine the first test build package
-
 
1125
            //  Assume the collection is in build instruction id order, 
-
 
1126
            //      So that the first request will be built first
-
 
1127
            //  Add all buildable test-builds to the mBuildOrder collection 
-
 
1128
            Package testBuild = ReleaseManager.NULL_PACKAGE;
-
 
1129
            mBuildOrder.clear();
1140
 
1130
 
1141
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1131
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
-
 
1132
            {
-
 
1133
                
-
 
1134
                Package p = it.next();
-
 
1135
                if ( p.mBuildFile >= 0 )
1142
                {
1136
                {
1143
                    Package p = it.next();
1137
                    if (p.mTestBuildInstruction != 0)
1144
 
-
 
1145
                    if ( p.mBuildFile < 0 || ( !p.mDirectlyPlanned && !p.mIndirectlyPlanned ) )
-
 
1146
                    {
1138
                    {
1147
                        // at this point...
1139
                        //  Not a Test Build
1148
                        // only 1 package with a build requirement has a mBuildFile of 1,
1140
                        if (testBuild == ReleaseManager.NULL_PACKAGE)
1149
                        // all other packages with a build requirement have an mBuildFile of 2
1141
                        {
1150
                        // give packages with no build requirement, reproducible or not, an mBuildFile of 3
-
 
1151
                        p.mNoBuildReason = p.mBuildFile;
1142
                            build = p;
1152
                        p.mBuildFile = 3;
1143
                        }
1153
                        mLogger.info("planRelease 1 set mBuildFile to 3 for package " + p.mAlias );
1144
                        mBuildOrder.add(p);
1154
                    }
1145
                    }
1155
                }
1146
                }
1156
            }
1147
            }
-
 
1148
            
1157
            else
1149
            //
-
 
1150
            //  Extend mBuildOrder with the selected non-test build package and its build plan
-
 
1151
            //  Really only for display purposes
-
 
1152
            //
-
 
1153
            if (build != ReleaseManager.NULL_PACKAGE)
1158
            {
1154
            {
1159
                // this is escrow mode centric
1155
                mBuildOrder.add(build);
-
 
1156
                mBuildOrder.addAll(build.mRipplePlan);
-
 
1157
            }
-
 
1158
            
-
 
1159
            //
1160
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1160
            //  Mark the first package in the build order as the one to be built
-
 
1161
            //  This will give test builds priority
-
 
1162
            //
-
 
1163
            
-
 
1164
            if (!mBuildOrder.isEmpty()) {
-
 
1165
                build = mBuildOrder.get(0);
-
 
1166
                build.mBuildFile = 1;
-
 
1167
                
-
 
1168
                if ( build.mForcedRippleInstruction > 0 )
1161
                {
1169
                {
-
 
1170
                    mReleaseManager.markDaemonInstCompleted( build.mForcedRippleInstruction );
1162
                    Package p = it.next();
1171
                }
1163
 
1172
 
1164
                    if ( p.mBuildFile == 0 )
1173
                if ( build.mTestBuildInstruction > 0 )
1165
                    {
1174
                {
-
 
1175
                    mReleaseManager.markDaemonInstInProgress( build.mTestBuildInstruction );
-
 
1176
                }
-
 
1177
                
1166
                        // more build files are required
1178
                //  Now that we know which package we are building
1167
                        allProcessed = false;
1179
                //      Set the previously calculated nextVersion as the packages version number
1168
                        mLogger.info("planRelease more build files are required for " + p.mName);
1180
                //      Claim the version number to prevent other builds from using it. Unless doing a test build
1169
                        break;
1181
                //
-
 
1182
                if (build.mTestBuildInstruction == 0 && build.mNextVersion != null)
1170
                    }
1183
                {
-
 
1184
                    mReleaseManager.claimVersion(build.mPid, build.mNextVersion + build.mExtension, mBaseline);
-
 
1185
                    build.mVersion = build.mNextVersion;
1171
                }
1186
                }
-
 
1187
            }
-
 
1188
            
-
 
1189
            //
-
 
1190
            //  To fit in with the old algorithm ( ie: could be improved )
-
 
1191
            //  Insert marks into all packages
-
 
1192
            //  Not sure exactly why - Its used in the generation of the ant build file
-
 
1193
            //  Want to set mNoBuildReason, mBuildFile
-
 
1194
            //
-
 
1195
            //      Package we have selected to build: 0     , 1
-
 
1196
            //      Package we could have built      : 2     , 3
-
 
1197
            //      Packages we can't build          : reason, 3
-
 
1198
            //      Packages that are OK             : 3     , 3
-
 
1199
            
-
 
1200
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
-
 
1201
            {
-
 
1202
                Package p = it.next();
-
 
1203
                if (p == build ) {
-
 
1204
                    p.mNoBuildReason = 0;
-
 
1205
                    p.mBuildFile = 1;
-
 
1206
                } 
-
 
1207
                else if ( p.mBuildFile < 0 )
-
 
1208
                {
-
 
1209
                    p.mNoBuildReason = p.mBuildFile;
-
 
1210
                    p.mBuildFile = 3;
-
 
1211
                }
-
 
1212
                else if (p.mBuildReason != null)
-
 
1213
                {
-
 
1214
                    p.mNoBuildReason = 2;
-
 
1215
                    p.mBuildFile = 3;
-
 
1216
                }
-
 
1217
                else
-
 
1218
                {
-
 
1219
                    p.mNoBuildReason = 0;
-
 
1220
                    p.mBuildFile = 3;
-
 
1221
                }
-
 
1222
            }
-
 
1223
        }
1172
 
1224
 
-
 
1225
    }
-
 
1226
 
-
 
1227
    /**
-
 
1228
     * Calculate a build plan for the specified package
-
 
1229
     * Calculates : mRippleTime - time to build the package and the ripple effect
-
 
1230
     * Calculates : mBuildPlan - collection of packages in the plan that can be built at the moment
-
 
1231
     * 
-
 
1232
     * Needs to determine all packages that consume the package - and all packages that consume them
-
 
1233
     *  Note: The package may not be in the mPackageCollection ( it may be a WIP/TEST/RIPPLE )
-
 
1234
     *  
-
 
1235
     * Need to:
-
 
1236
     *      Only include a package once.
-
 
1237
     *      Only include packages that can/need to be built at the moment
-
 
1238
     * 
-
 
1239
     * @param p     - Package to process
-
 
1240
     */
-
 
1241
 
-
 
1242
    private void calcBuildPlan(Package p) {
-
 
1243
        
-
 
1244
        p.mRipplePlan = usedByPackages(p);
-
 
1245
        
-
 
1246
        //  Use a ListIterator so that we can add elements to the end of the list while processing
-
 
1247
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
-
 
1248
        {
-
 
1249
            Package pkg = it.next();
-
 
1250
            ArrayList<Package> usedBy = usedByPackages(pkg);
-
 
1251
            for (Iterator<Package> it1 = usedBy.iterator(); it1.hasNext(); )
-
 
1252
            {
-
 
1253
                Package uPkg = it1.next();
-
 
1254
                if ( ! p.mRipplePlan.contains( uPkg ))
-
 
1255
                {
1173
                buildFile++;
1256
                    it.add(uPkg);
-
 
1257
                }
1174
            }
1258
            }
-
 
1259
        }
-
 
1260
        
-
 
1261
        //
-
 
1262
        //  Now have a plan on what will be affected when we build the package
-
 
1263
        //  Calculate the time it will take - include my time
-
 
1264
        //
1175
        } while( !allProcessed );
1265
        p.mRippleTime = p.mBuildTime;
-
 
1266
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
-
 
1267
        {
-
 
1268
            Package pkg = it.next();
-
 
1269
            p.mRippleTime += pkg.mBuildTime;
-
 
1270
        }
1176
    }
1271
    }
1177
 
1272
 
-
 
1273
    /** 
-
 
1274
     *  Calculate a collection of packages that actively use the named package
-
 
1275
     *  A consumer package does NOT use the named package,
-
 
1276
     *      If the consumer is an SDK or is Pegged
-
 
1277
     *      If the consumer is marked as advisoryRipple
-
 
1278
     *      If the consumer cannot be built
-
 
1279
     *   
-
 
1280
     * @param pkg - Package to process
-
 
1281
     * @return A collection of packages that actively 'use' the specified package
-
 
1282
 
-
 
1283
     */
-
 
1284
    private ArrayList<Package> usedByPackages(Package pkg) {
-
 
1285
        
-
 
1286
        ArrayList<Package> usedBy = new ArrayList<Package>();
-
 
1287
        
-
 
1288
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
-
 
1289
        {
-
 
1290
            Package p = it.next();
-
 
1291
            
-
 
1292
            //  Is this package 'actively used' in the current build
-
 
1293
            if (p.mBuildFile >= 0)
-
 
1294
            {
-
 
1295
                for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
-
 
1296
                {
-
 
1297
                    String alias = it2.next();
-
 
1298
                    if ( alias == pkg.mAlias) {
-
 
1299
                        //  Have found a consumer of 'pkg'
-
 
1300
                        usedBy.add(p);
-
 
1301
                        break;
-
 
1302
                    }
-
 
1303
                }
-
 
1304
            }
-
 
1305
        }
-
 
1306
        
-
 
1307
        return usedBy;
-
 
1308
    }
1178
 
1309
 
1179
    /** Determine if a given PVID is a member of the current release.
1310
    /** Determine if a given PVID is a member of the current release.
1180
     *  Used to determine if a package dependency is out of date
1311
     *  Used to determine if a package dependency is out of date
1181
     * 
1312
     * 
1182
     * @param dpvId
1313
     * @param dpvId
1183
     * @return true - specified pvid is a full member of the Release
1314
     * @return true - specified pvid is a full member of the Release
1184
     */
1315
     */
1185
    private boolean isInRelease(Integer dpvId) {
1316
    private boolean isInRelease(Integer dpvId) {
1186
        
1317
        
1187
        boolean found = false;
1318
        boolean inRelease = false;
1188
 
1319
 
1189
        for ( Iterator<Integer> it4 = mReleasedPvIDCollection.iterator(); it4.hasNext(); )
1320
        for ( Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1190
        {
1321
        {
1191
            Integer pvId = it4.next();
1322
            Package p = it.next();
1192
 
1323
 
1193
            if ( pvId.compareTo(dpvId) == 0 )
1324
            if ( p.mId == dpvId )
1194
            {
1325
            {
1195
                found = true;
1326
                inRelease = ! p.mIsNotReleased;
1196
                break;
1327
                break;
1197
            }
1328
            }
1198
        }
1329
        }
1199
        return found;
1330
        return inRelease;
1200
    }
1331
    }
1201
 
1332
 
1202
 
1333
 
1203
    /**reports what change in build exceptions happens as part of planRelease
1334
    /**reports what change in build exceptions happens as part of planRelease
1204
     */
1335
     */
Line 1212... Line 1343...
1212
            if ( !buildExclusion.isProcessed() )
1343
            if ( !buildExclusion.isProcessed() )
1213
            {
1344
            {
1214
                if (buildExclusion.isImported() && ! buildExclusion.isARootCause() ) {
1345
                if (buildExclusion.isImported() && ! buildExclusion.isARootCause() ) {
1215
                    // Remove from the exclusion list
1346
                    // Remove from the exclusion list
1216
                    buildExclusion.includeToBuild(mReleaseManager, mBaseline);
1347
                    buildExclusion.includeToBuild(mReleaseManager, mBaseline);
1217
                    mLogger.error("reportChange remove unused exclusion: " + buildExclusion.info());
1348
                    mLogger.error("reportChange remove unused exclusion: {}", buildExclusion.info());
1218
                } else {
1349
                } else {
1219
                    // Exclude and notify
1350
                    // Exclude and notify
1220
                    buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
1351
                    buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
1221
                    buildExclusion.email(this, mPackageCollection);
1352
                    buildExclusion.email(this, mPackageCollection);
1222
                    counter++;
1353
                    counter++;
1223
                }
1354
                }
1224
            }
1355
            }
1225
        }
1356
        }
1226
        mLogger.error("reportChange exclusion count: " + counter);
1357
        mLogger.error("reportChange exclusion count: {}", counter);
1227
    }
1358
    }
1228
 
1359
 
1229
    /**reports the build plan
1360
    /**reports the build plan
1230
     */
1361
     */
1231
    public void reportPlan() throws SQLException, Exception
1362
    public void reportPlan() throws SQLException, Exception
Line 1265... Line 1396...
1265
        if (retVal == null)
1396
        if (retVal == null)
1266
        {
1397
        {
1267
            retVal = new BuildFile();
1398
            retVal = new BuildFile();
1268
        }
1399
        }
1269
 
1400
 
1270
        mLogger.debug("getNextBuildFileContent returned " + retVal.state.name() );
1401
        mLogger.debug("getNextBuildFileContent returned {}", retVal.state.name() );
1271
        return retVal;
1402
        return retVal;
1272
    }
1403
    }
1273
 
1404
 
1274
 
1405
 
1275
    /**collects meta data associated with the baseline
1406
    /**collects meta data associated with the baseline
Line 1281... Line 1412...
1281
     *          mBaseline is an RTAGID
1412
     *          mBaseline is an RTAGID
1282
     */
1413
     */
1283
    public void collectMetaData() throws SQLException, Exception
1414
    public void collectMetaData() throws SQLException, Exception
1284
    {
1415
    {
1285
        Phase phase = new Phase("cmd");
1416
        Phase phase = new Phase("cmd");
1286
        mLogger.debug("collectMetaData mDaemon " + mDaemon);
1417
        mLogger.debug("collectMetaData mDaemon {}", mDaemon);
1287
 
1418
 
1288
        try
1419
        try
1289
        {
1420
        {
1290
            phase.setPhase("connect");
1421
            phase.setPhase("connect");
1291
            mReleaseManager.connect();
1422
            mReleaseManager.connect();
Line 1341... Line 1472...
1341
    {
1472
    {
1342
        mLogger.debug("findPackage");
1473
        mLogger.debug("findPackage");
1343
 
1474
 
1344
        Package retVal = mReleaseManager.findPackage(alias, mPackageCollection);
1475
        Package retVal = mReleaseManager.findPackage(alias, mPackageCollection);
1345
 
1476
 
1346
        mLogger.info("findPackage returned " + retVal.mName);
1477
        mLogger.info("findPackage returned {}", retVal.mName);
1347
        return retVal;
1478
        return retVal;
1348
    }
1479
    }
1349
 
1480
 
1350
    /**
1481
    /**
1351
     * Sets the mBuildFile to -5 (indirectly dependent on package versions which are not reproducible) 
1482
     * Sets the mBuildFile to -5 (indirectly dependent on package versions which are not reproducible) 
1352
     * for the package and all dependent packages 
1483
     * for the package and all dependent packages that are a part of the release set.
-
 
1484
     *  
1353
     * @param p             The package being excluded 
1485
     * @param p             The package being excluded 
1354
     * @param rootPvId      The PVID of the package that is causing the exclusion. Null or -ve values are special
1486
     * @param rootPvId      The PVID of the package that is causing the exclusion. Null or -ve values are special
1355
     *                      This package is the root cause, -2: Excluded by Ripple Stop 
1487
     *                      This package is the root cause, -2: Excluded by Ripple Stop 
1356
     *                   
1488
     *                   
1357
     * @param rootCause     Text message. Max 50 characters imposed by RM database 
1489
     * @param rootCause     Text message. Max 50 characters imposed by RM database 
Line 1360... Line 1492...
1360
     * @param dependentToo  True: Exclude all packages that depend on the excluded package 
1492
     * @param dependentToo  True: Exclude all packages that depend on the excluded package 
1361
     */
1493
     */
1362
    private void rippleBuildExclude(Package p, int rootPvId, String rootCause, ListIterator<BuildExclusion> list, BuildExclusion be, boolean dependentToo )
1494
    private void rippleBuildExclude(Package p, int rootPvId, String rootCause, ListIterator<BuildExclusion> list, BuildExclusion be, boolean dependentToo )
1363
    {
1495
    {
1364
        mLogger.debug("rippleBuildExclude");
1496
        mLogger.debug("rippleBuildExclude");
-
 
1497
     
1365
        if ( p.mBuildFile == 0 || p.mBuildFile == 1 )
1498
        if ( p.mBuildFile == 0 || p.mBuildFile == 1 )
1366
        {
1499
        {
1367
            p.mBuildFile = -5;
1500
            p.mBuildFile = -5;
1368
            mLogger.info("rippleBuildExclude set mBuildFile to -5 for package " + p.mAlias );
1501
            mLogger.info("rippleBuildExclude set mBuildFile to -5 for package {}", p.mAlias );
1369
 
1502
 
1370
            if ( be != null )
1503
            if ( be != null )
1371
            {
1504
            {
1372
                be.setProcessed();
1505
                be.setProcessed();
1373
            }
1506
            }
Line 1421... Line 1554...
1421
            }
1554
            }
1422
 
1555
 
1423
            //  Locate ALL packages that depend on this package and exclude them too
1556
            //  Locate ALL packages that depend on this package and exclude them too
1424
            //  This process will be recursive
1557
            //  This process will be recursive
1425
            //    Not sure that this it is efficient 
1558
            //    Not sure that this it is efficient 
1426
            //  Only ripple a build exclusion through for non test builds
1559
            //  Only ripple a build exclusion through for packages that are a part of the full release set
-
 
1560
            //  NewWIPs, ForcedRipples and TestBuilds will not force consumer packages to be excluded
1427
            //
1561
            //
1428
            if ( p.mTestBuildInstruction == 0 && dependentToo)
1562
            if ( ! p.mIsNotReleased && dependentToo)
1429
            {
1563
            {
1430
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1564
                for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1431
                {
1565
                {
1432
                    Package pkg = it.next();
1566
                    Package pkg = it.next();
1433
 
1567
 
1434
                    if ( pkg != p )
1568
                    if ( pkg != p )
1435
                    {
1569
                    {
Line 1445... Line 1579...
1445
                        }
1579
                        }
1446
                    }
1580
                    }
1447
                }
1581
                }
1448
            }
1582
            }
1449
        }
1583
        }
1450
        mLogger.info("rippleBuildExclude set " + p.mName + " " + p.mBuildFile);
1584
        mLogger.info("rippleBuildExclude set {} {}", p.mName, p.mBuildFile);
1451
    }
1585
    }
1452
 
1586
 
1453
    /**Simple XML string escaping
1587
    /**Simple XML string escaping
1454
     * 
1588
     * 
1455
     * @param xml		- String to escape
1589
     * @param xml		- String to escape
Line 1516... Line 1650...
1516
 
1650
 
1517
            //	Generate properties for each package in this build level or lower build levels
1651
            //	Generate properties for each package in this build level or lower build levels
1518
            //	The properties link the packageAlias to the PackageName and PackageVersion
1652
            //	The properties link the packageAlias to the PackageName and PackageVersion
1519
            //
1653
            //
1520
            //	[DEVI 54816] In escrow mode all unreproducible packages are included 
1654
            //	[DEVI 54816] In escrow mode all unreproducible packages are included 
1521
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1655
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1522
            {
1656
            {
1523
                Package p = it.next();
1657
                Package p = it.next();
1524
 
1658
 
1525
                if ( ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) ) || ( !mDaemon && p.mBuildFile == -2 ) )
1659
                if ( ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) ) || ( !mDaemon && p.mBuildFile == -2 ) )
1526
                {
1660
                {
Line 1529... Line 1663...
1529
            }
1663
            }
1530
 
1664
 
1531
            //	UTF Support
1665
            //	UTF Support
1532
            //	Insert additional info into the build file to provide extra checking
1666
            //	Insert additional info into the build file to provide extra checking
1533
            //
1667
            //
1534
            if ( ! ReleaseManager.mUseDatabase )
1668
            if ( ! mReleaseManager.mUseDatabase )
1535
            {
1669
            {
1536
                // UTF Support
1670
                // UTF Support
1537
                // Insert per-package planning information
1671
                // Insert per-package planning information
1538
                //
1672
                //
1539
                xml.addComment("mPackageCollection");
1673
                xml.addComment("mPackageCollectionAll");
1540
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1674
                for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1541
                {
1675
                {
1542
                    Package p = it.next();
1676
                    Package p = it.next();
1543
                    generatePackageInfo(xml, p);
1677
                    generatePackageInfo(xml, p);
1544
                }
1678
                }
1545
 
1679
 
Line 1564... Line 1698...
1564
                    for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
1698
                    for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
1565
                    {
1699
                    {
1566
                        Package p = it.next();
1700
                        Package p = it.next();
1567
                        String comment =
1701
                        String comment =
1568
                                "pvid="+ p.mId +
1702
                                "pvid="+ p.mId +
1569
                                " order=" +(++order) +
1703
                                " order=" + (++order) +
1570
                                " name=\"" + p.mAlias + "\"";
1704
                                " name=\"" + p.mAlias + "\"";
1571
                        xml.addComment(comment);
1705
                        xml.addComment(comment);
1572
                    }
1706
                    }
1573
                }
1707
                }
1574
            }
1708
            }
Line 1591... Line 1725...
1591
            //
1725
            //
1592
            //	Generate target rules for each package to be built within the current build file
1726
            //	Generate target rules for each package to be built within the current build file
1593
            //
1727
            //
1594
            boolean daemonHasTarget = false;
1728
            boolean daemonHasTarget = false;
1595
 
1729
 
1596
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1730
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1597
            {
1731
            {
1598
                Package p = it.next();
1732
                Package p = it.next();
1599
 
1733
 
1600
                if ( p.mBuildFile > 0 && p.mBuildFile <= buildFile )
1734
                if ( p.mBuildFile > 0 && p.mBuildFile <= buildFile )
1601
                {
1735
                {
Line 1669... Line 1803...
1669
            allProcessed = true;
1803
            allProcessed = true;
1670
 
1804
 
1671
            if (!mDaemon)
1805
            if (!mDaemon)
1672
            {
1806
            {
1673
                // this is escrow mode centric
1807
                // this is escrow mode centric
1674
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1808
                for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1675
                {
1809
                {
1676
                    Package p = it.next();
1810
                    Package p = it.next();
1677
 
1811
 
1678
                    if ( p.mBuildFile > buildFile )
1812
                    if ( p.mBuildFile > buildFile )
1679
                    {
1813
                    {
1680
                        // more build files are required
1814
                        // more build files are required
1681
                        allProcessed = false;
1815
                        allProcessed = false;
1682
                        mLogger.info("planRelease reiterating package has no build requirement " + p.mName + " " + p.mBuildFile + " " + buildFile);
1816
                        mLogger.info("planRelease reiterating package has no build requirement {} {} {}",p.mName, p.mBuildFile,  buildFile);
1683
                        break;
1817
                        break;
1684
                    }
1818
                    }
1685
                } 
1819
                } 
1686
 
1820
 
1687
                buildFile++;
1821
                buildFile++;
Line 1715... Line 1849...
1715
            element.addProperty("abt_rtag_id", mBaseline);
1849
            element.addProperty("abt_rtag_id", mBaseline);
1716
            element.addProperty("abt_daemon", mReleaseManager.currentTimeMillis());
1850
            element.addProperty("abt_daemon", mReleaseManager.currentTimeMillis());
1717
            element.makePropertyTag("abt_packagetarball", true);
1851
            element.makePropertyTag("abt_packagetarball", true);
1718
            element.makePropertyTag("abt_usetestarchive", !ReleaseManager.getUseMutex());
1852
            element.makePropertyTag("abt_usetestarchive", !ReleaseManager.getUseMutex());
1719
 
1853
 
1720
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1854
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1721
            {
1855
            {
1722
                Package p = it.next();
1856
                Package p = it.next();
1723
 
1857
 
1724
                if ( p.mBuildFile == 1 )
1858
                if ( p.mBuildFile == 1 )
1725
                {
1859
                {
Line 2085... Line 2219...
2085
        target.addAttribute("name", "fullstart");
2219
        target.addAttribute("name", "fullstart");
2086
 
2220
 
2087
        if (buildFile == 1)
2221
        if (buildFile == 1)
2088
        {
2222
        {
2089
            antEcho(target, "${line.separator}" + mAnyBuildPlatforms + "${line.separator}${line.separator}");
2223
            antEcho(target, "${line.separator}" + mAnyBuildPlatforms + "${line.separator}${line.separator}");
2090
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
2224
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
2091
            {
2225
            {
2092
                Package p = it.next();
2226
                Package p = it.next();
2093
 
2227
 
2094
                if ( p.mBuildFile == -1 )
2228
                if ( p.mBuildFile == -1 )
2095
                {
2229
                {
2096
                    antEcho(target, "${line.separator}" + p.mAlias + "${line.separator}");
2230
                    antEcho(target, "${line.separator}" + p.mAlias + "${line.separator}");
2097
                }
2231
                }
2098
            }
2232
            }
2099
 
2233
 
2100
            antEcho(target, "${line.separator}" + mAssocBuildPlatforms + "${line.separator}${line.separator}");
2234
            antEcho(target, "${line.separator}" + mAssocBuildPlatforms + "${line.separator}${line.separator}");
2101
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
2235
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
2102
            {
2236
            {
2103
                Package p = it.next();
2237
                Package p = it.next();
2104
 
2238
 
2105
                if ( p.mBuildFile == -2 )
2239
                if ( p.mBuildFile == -2 )
2106
                {
2240
                {
2107
                    antEcho(target, "${line.separator}" + p.mAlias + "${line.separator}");
2241
                    antEcho(target, "${line.separator}" + p.mAlias + "${line.separator}");
2108
                }
2242
                }
2109
            }
2243
            }
2110
 
2244
 
2111
            antEcho(target, "${line.separator}" + mNotInBaseline + "${line.separator}${line.separator}");
2245
            antEcho(target, "${line.separator}" + mNotInBaseline + "${line.separator}${line.separator}");
2112
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
2246
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
2113
            {
2247
            {
2114
                Package p = it.next();
2248
                Package p = it.next();
2115
 
2249
 
2116
                if ( p.mBuildFile == -4 )
2250
                if ( p.mBuildFile == -4 )
2117
                {
2251
                {
2118
                    antEcho(target, "${line.separator}" + p.mAlias + "${line.separator}");
2252
                    antEcho(target, "${line.separator}" + p.mAlias + "${line.separator}");
2119
                }
2253
                }
2120
            }
2254
            }
2121
 
2255
 
2122
            antEcho(target, "${line.separator}" + mDependent + "${line.separator}${line.separator}");
2256
            antEcho(target, "${line.separator}" + mDependent + "${line.separator}${line.separator}");
2123
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
2257
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
2124
            {
2258
            {
2125
                Package p = it.next();
2259
                Package p = it.next();
2126
 
2260
 
2127
                if ( p.mBuildFile == -5 )
2261
                if ( p.mBuildFile == -5 )
2128
                {
2262
                {
Line 2141... Line 2275...
2141
        //      Escrow : All packages
2275
        //      Escrow : All packages
2142
        //      Daemon : Just the package being built
2276
        //      Daemon : Just the package being built
2143
        //
2277
        //
2144
        StringAppender dependList = new StringAppender(",");
2278
        StringAppender dependList = new StringAppender(",");
2145
        dependList.append("fullstart");
2279
        dependList.append("fullstart");
2146
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
2280
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
2147
        {
2281
        {
2148
            Package p = it.next();
2282
            Package p = it.next();
2149
 
2283
 
2150
            if ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) )
2284
            if ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) )
2151
            {
2285
            {
Line 2184... Line 2318...
2184
        mLogger.debug("rippleIndirectlyPlanned");
2318
        mLogger.debug("rippleIndirectlyPlanned");
2185
        if ( !p.mIndirectlyPlanned && p.mBuildFile == 0 )
2319
        if ( !p.mIndirectlyPlanned && p.mBuildFile == 0 )
2186
        {
2320
        {
2187
            p.mIndirectlyPlanned = true;
2321
            p.mIndirectlyPlanned = true;
2188
 
2322
 
2189
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
2323
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
2190
            {
2324
            {
2191
                Package pkg = it.next();
2325
                Package pkg = it.next();
2192
 
2326
 
2193
                if ( pkg != p )
2327
                if ( pkg != p )
2194
                {
2328
                {
Line 2203... Line 2337...
2203
                        }
2337
                        }
2204
                    }
2338
                    }
2205
                }
2339
                }
2206
            }
2340
            }
2207
        }
2341
        }
2208
        mLogger.info("rippleIndirectlyPlanned set " + p.mName + " " + p.mIndirectlyPlanned);    
2342
        mLogger.info("rippleIndirectlyPlanned set {} {}", p.mName, p.mIndirectlyPlanned);    
2209
    }
2343
    }
2210
 
2344
 
2211
    /**accessor method
2345
    /**accessor method
2212
     */
2346
     */
2213
    public String getEscrowSetUp()
2347
    public String getEscrowSetUp()
2214
    {
2348
    {
2215
        mLogger.debug("getEscrowSetUp");
2349
        mLogger.debug("getEscrowSetUp");
2216
        String retVal = mEscrowSetup;
2350
        String retVal = mEscrowSetup;
2217
 
2351
 
2218
        mLogger.debug("getEscrowSetUp returned " + retVal);
2352
        mLogger.debug("getEscrowSetUp returned {}", retVal);
2219
        return retVal;
2353
        return retVal;
2220
    }
2354
    }
2221
 
2355
 
2222
    /**accessor method
2356
    /**accessor method
2223
     */
2357
     */
2224
    public String getRawData()
2358
    public String getRawData()
2225
    {
2359
    {
2226
        mLogger.debug("getRawData");
2360
        mLogger.debug("getRawData");
2227
        String retVal = mEscrowRawData;
2361
        String retVal = mEscrowRawData;
2228
 
2362
 
2229
        mLogger.debug("getRawData returned " + retVal);
2363
        mLogger.debug("getRawData returned {}", retVal);
2230
        return retVal;
2364
        return retVal;
2231
    }
2365
    }
2232
 
2366
 
2233
    /**Get the build loc (location)
2367
    /**Get the build loc (location)
2234
     * This is package specific and will depend on the build mode (Escrow/Daemon)
2368
     * This is package specific and will depend on the build mode (Escrow/Daemon)
Line 2302... Line 2436...
2302
                String info = bs.getBuildStandardText();
2436
                String info = bs.getBuildStandardText();
2303
                result.append(info);
2437
                result.append(info);
2304
            }
2438
            }
2305
        }
2439
        }
2306
 
2440
 
2307
        mLogger.info("buildInfoText returned " + result);
2441
        mLogger.info("buildInfoText returned {}", result);
2308
        return result.toString();
2442
        return result.toString();
2309
    }
2443
    }
2310
 
2444
 
2311
    /**prints to standard out in escrow mode only
2445
    /**prints to standard out in escrow mode only
2312
     * <br>Prints a title and information. The title is only printed once.
2446
     * <br>Prints a title and information. The title is only printed once.
Line 2351... Line 2485...
2351
                +  "<br>Package: " + p.mAlias 
2485
                +  "<br>Package: " + p.mAlias 
2352
                +  "<br>Rm Ref: " + CreateUrls.generateRmUrl(getRtagId(), p.mId); 
2486
                +  "<br>Rm Ref: " + CreateUrls.generateRmUrl(getRtagId(), p.mId); 
2353
 
2487
 
2354
        mailBody += "<p><hr>";
2488
        mailBody += "<p><hr>";
2355
 
2489
 
2356
        //    Generate the list of email recipients
-
 
2357
        //        Transfer the daemon instruction email list into the package before use
-
 
2358
 
-
 
2359
        p.setTestEmail();
-
 
2360
        String target = p.emailInfoNonAntTask(this);
2490
        String target = p.emailInfoNonAntTask(this);
2361
 
2491
 
2362
        mLogger.error("emailRejectedDaemonInstruction Server: " + getMailServer());
2492
        mLogger.error("emailRejectedDaemonInstruction Server: {}", getMailServer());
2363
        mLogger.error("emailRejectedDaemonInstruction Sender: " + getMailSender());
2493
        mLogger.error("emailRejectedDaemonInstruction Sender: {}", getMailSender());
2364
        mLogger.error("emailRejectedDaemonInstruction Target: " + target);
2494
        mLogger.error("emailRejectedDaemonInstruction Target: {}", target);
2365
 
2495
 
2366
        try
2496
        try
2367
        {
2497
        {
2368
            //    
2498
            //    
2369
            Smtpsend.send(getMailServer(), // mailServer
2499
            Smtpsend.send(getMailServer(),  // mailServer
2370
                    getMailSender(),       // source
2500
                    getMailSender(),        // source
2371
                    target,            // target
2501
                    target,                 // target
2372
                    getMailSender(),       // cc
2502
                    getMailSender(),        // cc
2373
                    null,              // bcc
2503
                    null,                   // bcc
2374
                    subject,           // subject
2504
                    subject,                // subject
2375
                    mailBody,          // body
2505
                    mailBody,               // body
2376
                    null               // attachment
2506
                    null                    // attachment
2377
                    );
2507
                    );
2378
        } catch (Exception e)
2508
        } catch (Exception e)
2379
        {
2509
        {
2380
            mLogger.warn("Email Failure: emailRejectedDaemonInstruction:" + e.getMessage());
2510
            mLogger.warn("Email Failure: emailRejectedDaemonInstruction:{}", e.getMessage());
2381
        }
2511
        }
2382
    }
2512
    }
2383
 
2513
 
2384
    /**
2514
    /**
2385
     * @return the mMailServer
2515
     * @return the mMailServer