Subversion Repositories DevTools

Rev

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

Rev 7070 Rev 7071
Line 441... Line 441...
441
                //  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
442
                p.mBuildFile = 0;
442
                p.mBuildFile = 0;
443
                
443
                
444
                // exclude all dependent packages
444
                // exclude all dependent packages
445
                // max 50 chars
445
                // max 50 chars
446
                rippleBuildExclude(p, p.mId, "Package has circular dependency", null, null, true);
446
                rippleBuildExclude(p, p.mId, "Package has circular dependency", null, null, true, false);
447
 
447
 
448
                // take the package out of the build
448
                // take the package out of the build
449
                p.mBuildFile = -6;
449
                p.mBuildFile = -6;
450
                mLogger.info("planRelease set mBuildFile to -6 for package {}", p.mAlias );
450
                mLogger.info("planRelease set mBuildFile to -6 for package {}", p.mAlias );
451
                standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
451
                standardOut(mCircularDependency, p.mAlias, mCircularDependencyFlag);
Line 480... Line 480...
480
                if (dependency == ReleaseManager.NULL_PACKAGE)
480
                if (dependency == ReleaseManager.NULL_PACKAGE)
481
                {
481
                {
482
                    mLogger.info("planRelease dependency is not in the baseline {}", alias);
482
                    mLogger.info("planRelease dependency is not in the baseline {}", alias);
483
                    // exclude all dependent packages
483
                    // exclude all dependent packages
484
                    // max 50 chars
484
                    // max 50 chars
485
                    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, true);
486
 
486
 
487
                    // take the package out of the build
487
                    // take the package out of the build
488
                    p.mBuildFile = -4;
488
                    p.mBuildFile = -4;
489
                    mLogger.info("planRelease set mBuildFile to -4 for package {}", p.mAlias );
489
                    mLogger.info("planRelease set mBuildFile to -4 for package {}", p.mAlias );
490
                    standardOut(mNotInBaseline, p.mAlias, mNotInBaselineFlag);
490
                    standardOut(mNotInBaseline, p.mAlias, mNotInBaselineFlag);
Line 518... Line 518...
518
                // Daemon - Exclude this package, but not its consumers. If the package is available then we can use it.
518
                // Daemon - Exclude this package, but not its consumers. If the package is available then we can use it.
519
                if (!p.isReproducible())
519
                if (!p.isReproducible())
520
                {
520
                {
521
                    mLogger.info("planRelease package not reproducible {}" ,p.mName);
521
                    mLogger.info("planRelease package not reproducible {}" ,p.mName);
522
                    // max 50 chars
522
                    // max 50 chars
523
                    rippleBuildExclude(p, p.mId, "Package has no build environment", null, null, false);
523
                    rippleBuildExclude(p, p.mId, "Package has no build environment", null, null, false, true);
524
 
524
 
525
                    // package is not reproducible, discard
525
                    // package is not reproducible, discard
526
                    p.mBuildFile = -1;
526
                    p.mBuildFile = -1;
527
                    mLogger.info("planRelease set mBuildFile to -1 for package {}", p.mAlias );
527
                    mLogger.info("planRelease set mBuildFile to -1 for package {}", p.mAlias );
528
                    standardOut(mAnyBuildPlatforms, p.mAlias, mAnyBuildPlatformsFlag);
528
                    standardOut(mAnyBuildPlatforms, p.mAlias, mAnyBuildPlatformsFlag);
Line 539... Line 539...
539
        //    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'
540
        //
540
        //
541
        //    Only exclude the failing package and not its dependents
541
        //    Only exclude the failing package and not its dependents
542
        //    May be legitimate in the release
542
        //    May be legitimate in the release
543
        //
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
-
 
545
        mLogger.debug("planRelease process packages which are not reproducible2");
544
        mLogger.debug("planRelease process packages which are not reproducible2");
546
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
545
        for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
547
        {
546
        {
548
            Package p = it.next();
547
            Package p = it.next();
549
 
548
 
Line 581... Line 580...
581
                if ( !reproduce )
580
                if ( !reproduce )
582
                {
581
                {
583
                    mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline {}", p.mName);
582
                    mLogger.info("planRelease package not reproducible on the build platforms configured for this baseline {}", p.mName);
584
 
583
 
585
                    // max 50 chars
584
                    // max 50 chars
586
                    rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null, null, false);
585
                    rippleBuildExclude(p, p.mId, "Package not built for configured platforms", null, null, false, true);
587
 
586
 
588
                    // package is not reproducible on the build platforms configured for this baseline, discard
587
                    // package is not reproducible on the build platforms configured for this baseline, discard
589
                    p.mBuildFile = -2;
588
                    p.mBuildFile = -2;
590
                    mLogger.info("planRelease set mBuildFile to -2 for package {}", p.mAlias );
589
                    mLogger.info("planRelease set mBuildFile to -2 for package {}", p.mAlias );
591
                    standardOut(mAssocBuildPlatforms, p.mAlias, mAssocBuildPlatformsFlag);
590
                    standardOut(mAssocBuildPlatforms, p.mAlias, mAssocBuildPlatformsFlag);
Line 596... Line 595...
596
 
595
 
597
        if (mDaemon)
596
        if (mDaemon)
598
        {
597
        {
599
            // Daemon Mode Only
598
            // Daemon Mode Only
600
            // Process packages which are not ripple buildable, and all packages dependent upon them
599
            // Process packages which are not ripple buildable, and all packages dependent upon them
-
 
600
            //      I would have thought that all consumer packages had already been excluded ??
601
            mLogger.debug("planRelease process packages which are not ripple buildable");
601
            mLogger.debug("planRelease process packages which are not ripple buildable");
602
            for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
602
            for (ListIterator<BuildExclusion> it = mBuildExclusionCollection.listIterator(); it.hasNext(); )
603
            {
603
            {
604
                BuildExclusion be = it.next();
604
                BuildExclusion be = it.next();
605
 
605
 
606
                for (Iterator<Package> it1 = mPackageCollection.iterator(); it1.hasNext(); )
606
                for (Iterator<Package> it1 = mPackageCollectionAll.iterator(); it1.hasNext(); )
607
                {
607
                {
608
                    Package p = it1.next();
608
                    Package p = it1.next();
609
 
609
 
610
                    // ensure only root cause, non test build, build exclusions are excluded
610
                    // ensure only root cause, non test build, build exclusions are excluded
611
                    // mBuildExclusionCollection is at this point based on
611
                    // mBuildExclusionCollection is at this point based on
612
                    // relevant (direct and indirect) excluded pv's in the database
612
                    // relevant (direct and indirect) excluded pv's in the database
613
                    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 )
614
                    {
614
                    {
615
                        // package is not reproducible, discard
615
                        // package is not reproducible, discard
616
 
616
 
617
                        rippleBuildExclude( p, p.mId, null, it, be, true );
617
                        rippleBuildExclude( p, p.mId, null, it, be, true, true );
618
                        p.mBuildFile = -3;
618
                        p.mBuildFile = -3;
619
                        mLogger.info("planRelease set mBuildFile to -3 for package {}", p.mAlias );
619
                        mLogger.info("planRelease set mBuildFile to -3 for package {}", p.mAlias );
620
                        break;
620
                        break;
621
                    }
621
                    }
622
                }
622
                }
Line 668... Line 668...
668
                                //
668
                                //
669
                                if (p.mRippleStop == 's' || p.mRippleStop == 'w') 
669
                                if (p.mRippleStop == 's' || p.mRippleStop == 'w') 
670
                                {
670
                                {
671
                                    // Package marked as a rippleStop
671
                                    // Package marked as a rippleStop
672
                                    // max 50 chars
672
                                    // max 50 chars
673
                                    rippleBuildExclude(p, -2, "Ripple Required." + " Waiting for user", null, null, false);
673
                                    rippleBuildExclude(p, -2, "Ripple Required." + " Waiting for user", null, null, false, true);
674
 
674
 
675
                                    // package is unBuildable, mark reason and discard
675
                                    // package is unBuildable, mark reason and discard
676
                                    p.mBuildFile = -11;
676
                                    p.mBuildFile = -11;
677
                                    
677
                                    
678
                                    if (p.mRippleStop == 's' ) {
678
                                    if (p.mRippleStop == 's' ) {
Line 711... Line 711...
711
                                {
711
                                {
712
                                    //  Package does not exist in dpkg_archive and it has been flagged as unbuildable
712
                                    //  Package does not exist in dpkg_archive and it has been flagged as unbuildable
713
                                    //  This may be because is Unbuildable or Manually built
713
                                    //  This may be because is Unbuildable or Manually built
714
                                    mLogger.info("planRelease Unbuildable package not found in archive {}", p.mName);
714
                                    mLogger.info("planRelease Unbuildable package not found in archive {}", p.mName);
715
                                    // max 50 chars
715
                                    // max 50 chars
716
                                    rippleBuildExclude(p, p.mId, "Unbuildable" + " package not found in archive", null, null, true);
716
                                    rippleBuildExclude(p, p.mId, "Unbuildable" + " package not found in archive", null, null, true, true);
717
 
717
 
718
                                    // package is unBuildable, mark reason and discard
718
                                    // package is unBuildable, mark reason and discard
719
                                    p.mBuildFile = -10;
719
                                    p.mBuildFile = -10;
720
                                    
720
                                    
721
                                }
721
                                }
Line 729... Line 729...
729
                                    //  Pegged packages or packages provided from an SDK MUST exist in dpkg_archive
729
                                    //  Pegged packages or packages provided from an SDK MUST exist in dpkg_archive
730
                                    //  They will not be built within the context of this release. It is the responsibility
730
                                    //  They will not be built within the context of this release. It is the responsibility
731
                                    //  of another release to build them.
731
                                    //  of another release to build them.
732
                                    mLogger.info("planRelease {} package not found in archive {}", reason, p.mName);
732
                                    mLogger.info("planRelease {} package not found in archive {}", reason, p.mName);
733
                                    // max 50 chars
733
                                    // max 50 chars
734
                                    rippleBuildExclude(p, p.mId, reason + " package not found in archive", null, null, true);
734
                                    rippleBuildExclude(p, p.mId, reason + " package not found in archive", null, null, true, true);
735
 
735
 
736
                                    // package is not reproducible, mark reason and discard
736
                                    // package is not reproducible, mark reason and discard
737
                                    p.mBuildFile = -7;
737
                                    p.mBuildFile = -7;
738
 
738
 
739
                                }
739
                                }
Line 751... Line 751...
751
                                            // This package cannot be rebuilt as one of its dependents is NOT in this release
751
                                            // This package cannot be rebuilt as one of its dependents is NOT in this release
752
                                            // exclude all dependent package versions
752
                                            // exclude all dependent package versions
753
                                            
753
                                            
754
                                            mLogger.info("planRelease package not found in archive. Cannot be rebuilt due to {}", p.mName);
754
                                            mLogger.info("planRelease package not found in archive. Cannot be rebuilt due to {}", p.mName);
755
                                            // max 50 chars
755
                                            // max 50 chars
756
                                            rippleBuildExclude(p, p.mId, "Package cannot be rebuilt in this release", null, null, true);
756
                                            rippleBuildExclude(p, p.mId, "Package cannot be rebuilt in this release", null, null, true, true);
757
 
757
 
758
                                            // package is not reproducible, mark reason and discard
758
                                            // package is not reproducible, mark reason and discard
759
                                            p.mBuildFile = -4;
759
                                            p.mBuildFile = -4;
760
                                            break;
760
                                            break;
761
                                        }
761
                                        }
Line 910... Line 910...
910
 *      [Done] Need to include all packages that we can now build into the final build plan, not just the first one and its build tree
910
 *      [Done] Need to include all packages that we can now build into the final build plan, not just the first one and its build tree
911
 * 
911
 * 
912
 *      [Done-ish]Need to generate a single package set - so that WIPS and others replace those in the final build set
912
 *      [Done-ish]Need to generate a single package set - so that WIPS and others replace those in the final build set
913
 *      [Done]Remove duplicates from the complete package set
913
 *      [Done]Remove duplicates from the complete package set
914
 *      
914
 *      
915
 *      Need more test cases
915
 *      [Being Done] Need more test cases
916
 *      
916
 *      
917
 *      Need to report all build options, not just the selected one
917
 *      [Done, in the UTF] Need to report all build options, not just the selected one
-
 
918
 *                         Data to RM may need some more info
918
 *      
919
 *      
919
 *      Cleanup the ANT build file - don't list all the release dependencies, just those needed to build the current package
920
 *      Cleanup the ANT build file - don't list all the release dependencies, just those needed to build the current package
-
 
921
 *      Chances are - all we need is the new package version number
920
 *      
922
 *      
921
 *      If a WIP on a package that has circular dependencies is added, then the WIP will be excluded. This prevents the problem being fixed.
923
 *      [Fixed] If a WIP on a package that has circular dependencies is added, then the WIP will be excluded. This prevents the problem being fixed.
922
 *      Should not exclude a WIP of a package with a circular dependency
924
 *              Should not exclude a WIP of a package with a circular dependency
923
 */
925
 */
924
 
926
 
925
        // Process remaining packages which are need to be reproduced for this baseline.
927
        // Process remaining packages which are need to be reproduced for this baseline.
926
        //    Determine the build file for each package
928
        //    Determine the build file for each package
927
        //    For daemon builds:
929
        //    For daemon builds:
Line 1073... Line 1075...
1073
            }
1075
            }
1074
            
1076
            
1075
            //  Examine the build candidates and verify that a new version number can be calculated for each
1077
            //  Examine the build candidates and verify that a new version number can be calculated for each
1076
            //  version that we need to build.
1078
            //  version that we need to build.
1077
            //
1079
            //
1078
//TODO If we find WIP/TEST/RIPPLE with invalid nextVersion, then we could email the submitter and treat it as a fail.            
1080
            //  If we can't generate a new version number, then this is considered to be a build failure
-
 
1081
            //  The package will be excluded and the user will be emailed
1079
            
1082
            //
1080
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1083
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1081
            {
1084
            {
1082
                Package p = it.next();
1085
                Package p = it.next();
1083
 
1086
 
1084
                if ( p.mBuildFile >= 0 )
1087
                if ( p.mBuildFile >= 0 )
Line 1086... Line 1089...
1086
                    int pvApplied = p.applyPV(mReleaseManager);
1089
                    int pvApplied = p.applyPV(mReleaseManager);
1087
 
1090
 
1088
                    if ( pvApplied == 1 )
1091
                    if ( pvApplied == 1 )
1089
                    {
1092
                    {
1090
                        // max 50 chars
1093
                        // max 50 chars
1091
                        rippleBuildExclude(p, p.mId, "Package has non standard versioning", null, null, true);
1094
                        rippleBuildExclude(p, p.mId, "Package has non standard versioning", null, null, true, true);
1092
                    }
1095
                    }
1093
                    else if ( pvApplied == 2 )
1096
                    else if ( pvApplied == 2 )
1094
                    {
1097
                    {
1095
                        // max 50 chars
1098
                        // max 50 chars
1096
                        rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null, null, true);
1099
                        rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", null, null, true, true);
1097
                    }
1100
                    }
1098
                    else if ( pvApplied == 3 )
1101
                    else if ( pvApplied == 3 )
1099
                    {
1102
                    {
1100
                        // max 50 chars
1103
                        // max 50 chars
1101
                        rippleBuildExclude(p, p.mId, "Package has invalid change type", null, null, true);
1104
                        rippleBuildExclude(p, p.mId, "Package has invalid change type", null, null, true, true);
1102
                    }
1105
                    }
1103
                    
1106
                    
1104
                    if ( pvApplied != 0) 
1107
                    if ( pvApplied != 0) 
1105
                    {
1108
                    {
1106
                        // If this package is not a WIP/TEST/RIPPLE, then remove it from this collection
1109
                        // If this package is not a WIP/TEST/RIPPLE, then remove it from this collection
Line 1126... Line 1129...
1126
                        else 
1129
                        else 
1127
                        {
1130
                        {
1128
                            //  Calculate the time to build the package AND all of the packages that depend on it
1131
                            //  Calculate the time to build the package AND all of the packages that depend on it
1129
                            //  Calculate the build plan for the package
1132
                            //  Calculate the build plan for the package
1130
                            //
1133
                            //
1131
                            calcBuildPlan(p, mPackageCollection, true);
1134
                            calcBuildPlan(p, mPackageCollection);
1132
                        }
1135
                        }
1133
                    }
1136
                    }
1134
                }
1137
                }
1135
            }
1138
            }
1136
            
1139
            
Line 1182... Line 1185...
1182
                //      We can get the lowest first
1185
                //      We can get the lowest first
1183
                //      We can generate the complete plan in a nice order
1186
                //      We can generate the complete plan in a nice order
1184
                //
1187
                //
1185
                Collections.sort(buildNext, Package.RippleTimeComparator);
1188
                Collections.sort(buildNext, Package.RippleTimeComparator);
1186
                
1189
                
1187
                //  At the moment extract the first one - this is the fastedt
1190
                //  At the moment extract the first one - this is the fastest
-
 
1191
                //  Allowing for a 20% extension.
-
 
1192
                //
1188
                //  TODO - could build another candidate as long as it does't extend the time by (say) 10%
1193
                //  TODO - what if two build sets don't overlap. Do we build the longer one first ?
1189
                //         Would need to rejigger the collection - for the next step
1194
                //  TODO - what if two build sets do overlay. Can we merge them somehow
1190
                //
1195
                //
1191
                build = buildNext.get(0);
1196
                build = buildNext.get(0);
1192
                
1197
                
1193
                //  Determine the amount of time we would allow the 'best' plan to be extended
1198
                //  Determine the amount of time we would allow the 'best' plan to be extended
1194
                //      Allow for a 20% extension in time
1199
                //      Allow for a 20% extension in time
1195
                //      Min of 10 minutes
1200
                //      Minimum of 10 minutes
1196
                int baseTime = build.mRippleTime;
1201
                int baseTime = build.mRippleTime;
1197
                baseTime = ( baseTime * 1200) / 1000;
1202
                baseTime = ( baseTime * 1200) / 1000;
1198
                if ( baseTime < 10 * 60) {
1203
                if ( baseTime < 10 * 60) {
1199
                    baseTime = (10 * 60);
1204
                    baseTime = (10 * 60);
1200
                }
1205
                }
Line 1256... Line 1261...
1256
                    mReleaseManager.markDaemonInstInProgress( build.mTestBuildInstruction );
1261
                    mReleaseManager.markDaemonInstInProgress( build.mTestBuildInstruction );
1257
                }
1262
                }
1258
                
1263
                
1259
                //  Now that we know which package we are building
1264
                //  Now that we know which package we are building
1260
                //      Set the previously calculated nextVersion as the packages version number
1265
                //      Set the previously calculated nextVersion as the packages version number
1261
                //      Claim the version number to prevent other builds from using it. Unless doing a test build
1266
                //      Claim the version number to prevent other builds from using it. Even if doing a test build
1262
                //
1267
                //
1263
                if (build.mTestBuildInstruction == 0 && build.mNextVersion != null)
1268
                if (build.mNextVersion != null)
1264
                {
1269
                {
1265
                    mReleaseManager.claimVersion(build.mPid, build.mNextVersion + build.mExtension, mBaseline);
1270
                    mReleaseManager.claimVersion(build.mPid, build.mNextVersion + build.mExtension, mBaseline);
1266
                    build.mVersion = build.mNextVersion;
1271
                    build.mVersion = build.mNextVersion;
1267
                }
1272
                }
1268
            }
1273
            }
Line 1375... Line 1380...
1375
     *      Only include a package once.
1380
     *      Only include a package once.
1376
     *      Only include packages that can/need to be built at the moment
1381
     *      Only include packages that can/need to be built at the moment
1377
     * 
1382
     * 
1378
     * @param p                 - Package to process
1383
     * @param p                 - Package to process
1379
     * @param pkgCollection     - Package Collection to scan
1384
     * @param pkgCollection     - Package Collection to scan
1380
     * @param processAll        - True: Order all packages discovered
-
 
1381
 
1385
 
1382
     */
1386
     */
1383
    private void calcBuildPlan(Package p, ArrayList<Package> pkgCollection, boolean processAll) {
1387
    private void calcBuildPlan(Package p, ArrayList<Package> pkgCollection) {
1384
        
1388
        
1385
        mLogger.error("calcBuildPlan Add {}", p.mAlias);
-
 
1386
        p.mRipplePlan = usedByPackages(p, pkgCollection);
-
 
1387
        p.mRippleTime = p.mBuildTime;
-
 
1388
 
1389
 
1389
        //  Use a ListIterator so that we can add elements to the end of the list while processing
1390
        p.mRipplePlan = new ArrayList<Package>(); 
1390
        //  Sum the buildTimes of the packages that we add to the list
1391
        p.mRippleTime = p.mBuildTime;
1391
        
1392
        
-
 
1393
        //  Need to add elements to the end of the list while processing
-
 
1394
        //  Sum the buildTimes of the packages that we add to the list
1392
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1395
        ArrayList<Package> toProcess = usedByPackages(p, pkgCollection, 1);
-
 
1396
        while ( ! toProcess.isEmpty())
1393
        {
1397
        {
1394
            Package pkg = it.next();
1398
            Package pkg = toProcess.remove(0);
1395
            mLogger.error("calc process {}", pkg.mAlias);
-
 
1396
            pkg.mRippleOrder++;
-
 
1397
            p.mRippleTime += pkg.mBuildTime;
1399
            if ( ! p.mRipplePlan.contains( pkg ))
1398
            
-
 
1399
            ArrayList<Package> usedBy = usedByPackages(pkg, pkgCollection);
-
 
1400
            for (Iterator<Package> it1 = usedBy.iterator(); it1.hasNext(); )
-
 
1401
            {
1400
            {
1402
                Package uPkg = it1.next();
-
 
1403
                uPkg.mRippleOrder = pkg.mRippleOrder + 1;
-
 
1404
                if ( ! p.mRipplePlan.contains( uPkg ))
-
 
1405
                {
-
 
1406
                    it.add(uPkg);
1401
                p.mRipplePlan.add(pkg);
1407
                    it.previous();
-
 
1408
                    p.mRippleTime += uPkg.mBuildTime;
1402
                p.mRippleTime += pkg.mBuildTime;
1409
                    mLogger.error("calc Add {}", uPkg.mAlias);
-
 
1410
                }
-
 
1411
            }
1403
            }
-
 
1404
            
-
 
1405
            ArrayList<Package> usedBy = usedByPackages(pkg, pkgCollection, pkg.mRippleOrder + 1);
-
 
1406
            toProcess.addAll(usedBy);
1412
        }
1407
        }
1413
        
1408
        
1414
        //
1409
        //
1415
        //  Need to determine the rippleTime for each package in the plan
1410
        //  Need to determine the rippleTime for each package in the plan
1416
        //      Have a much smaller set of packages to process
1411
        //      Have a much smaller set of packages to process (need only scan those in p.mRipplePlan)
-
 
1412
        //  Similar to the above code, but 
1417
        //  Don't care about the mRipplePlan item in the packages
1413
        //      Don't care about the mRipplePlan item in the packages
1418
        //  Don't modify the mRippleOrder
1414
        //      Don't modify the mRippleOrder
1419
        //  
1415
        //
1420
        
-
 
1421
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1416
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1422
        {
1417
        {
1423
            Package pkg = it.next();
1418
            Package p1 = it.next();
1424
            
1419
            
1425
            pkg.mRipplePlan = usedByPackages(pkg, pkgCollection);
-
 
1426
            pkg.mRippleTime = pkg.mBuildTime;
1420
            int rippleTime = 0;
1427
 
-
 
1428
            //  Use a ListIterator so that we can add elements to the end of the list while processing
1421
            ArrayList<Package> ripplePlan = new ArrayList<Package>();
1429
            //  Sum the buildTimes of the packages that we add to the list
1422
            ArrayList<Package> toProcess1 = new ArrayList<Package>();
1430
            
1423
            
-
 
1424
            toProcess1.add(p1);
1431
            for (ListIterator<Package> it0 = pkg.mRipplePlan.listIterator(); it0.hasNext(); )
1425
            while ( ! toProcess1.isEmpty())
1432
            {
1426
            {
1433
                Package pkg1 = it0.next();
1427
                Package pkg = toProcess1.remove(0);
1434
                pkg.mRippleTime += pkg1.mBuildTime;
1428
                if ( ! ripplePlan.contains( pkg ))
1435
                
-
 
1436
                ArrayList<Package> usedBy = usedByPackages(pkg1, pkgCollection);
-
 
1437
                for (Iterator<Package> it1 = usedBy.iterator(); it1.hasNext(); )
-
 
1438
                {
1429
                {
1439
                    Package uPkg = it1.next();
-
 
1440
                    if ( ! pkg.mRipplePlan.contains( uPkg ))
-
 
1441
                    {
-
 
1442
                        it0.add(uPkg);
1430
                    ripplePlan.add(pkg);
1443
                        it0.previous();
-
 
1444
                        pkg.mRippleTime += uPkg.mBuildTime;
1431
                    rippleTime += pkg.mBuildTime;
1445
                    }
-
 
1446
                }
1432
                }
-
 
1433
                
-
 
1434
                ArrayList<Package> usedBy = usedByPackages(pkg, p.mRipplePlan, -1);
-
 
1435
                toProcess1.addAll(usedBy);
1447
            }
1436
            }
1448
 
1437
            
-
 
1438
            p1.mRippleTime = rippleTime;
1449
        }
1439
        }
1450
        
1440
        
-
 
1441
        
1451
        //
1442
        //
1452
        //  Sort the ripplePlan so that we build the fastest elements first
1443
        //  Sort the ripplePlan so that we build the fastest elements first
1453
        //  Only care about the ripplePlan for the main Package
1444
        //  Only care about the ripplePlan for the main Package
1454
        //
1445
        //
1455
        Collections.sort(p.mRipplePlan, Package.PlanComparator);
1446
        Collections.sort(p.mRipplePlan, Package.PlanComparator);
Line 1470... Line 1461...
1470
     *      If the consumer is marked as advisoryRipple
1461
     *      If the consumer is marked as advisoryRipple
1471
     *      If the consumer cannot be built
1462
     *      If the consumer cannot be built
1472
     *   
1463
     *   
1473
     * @param pkg - Package to process
1464
     * @param pkg - Package to process
1474
     * @param pkgCollection - collection of packages to scan
1465
     * @param pkgCollection - collection of packages to scan
-
 
1466
     * @param rippleOrder - Set the ripple oder, if >= 0
1475
     * @return A collection of packages that actively 'use' the specified package
1467
     * @return A collection of packages that actively 'use' the specified package
1476
 
1468
 
1477
     */
1469
     */
1478
    private ArrayList<Package> usedByPackages(Package pkg, ArrayList<Package> pkgCollection) {
1470
    private ArrayList<Package> usedByPackages(Package pkg, ArrayList<Package> pkgCollection, int rippleOrder) {
1479
        
1471
        
1480
        ArrayList<Package> usedBy = new ArrayList<Package>();
1472
        ArrayList<Package> usedBy = new ArrayList<Package>();
1481
        
1473
        
1482
        for (Iterator<Package> it = pkgCollection.iterator(); it.hasNext(); )
1474
        for (Iterator<Package> it = pkgCollection.iterator(); it.hasNext(); )
1483
        {
1475
        {
Line 1490... Line 1482...
1490
                {
1482
                {
1491
                    String alias = it2.next();
1483
                    String alias = it2.next();
1492
                    if (  pkg.mAlias.compareTo( alias ) == 0  ) {
1484
                    if (  pkg.mAlias.compareTo( alias ) == 0  ) {
1493
                        //  Have found a consumer of 'pkg'
1485
                        //  Have found a consumer of 'pkg'
1494
                        usedBy.add(p);
1486
                        usedBy.add(p);
-
 
1487
                        if (rippleOrder >= 0)
-
 
1488
                            p.mRippleOrder = rippleOrder;
1495
                        break;
1489
                        break;
1496
                    }
1490
                    }
1497
                }
1491
                }
1498
            }
1492
            }
1499
        }
1493
        }
Line 1541... Line 1535...
1541
                    buildExclusion.includeToBuild(mReleaseManager, mBaseline);
1535
                    buildExclusion.includeToBuild(mReleaseManager, mBaseline);
1542
                    mLogger.error("reportChange remove unused exclusion: {}", buildExclusion.info());
1536
                    mLogger.error("reportChange remove unused exclusion: {}", buildExclusion.info());
1543
                } else {
1537
                } else {
1544
                    // Exclude and notify
1538
                    // Exclude and notify
1545
                    buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
1539
                    buildExclusion.excludeFromBuild(mReleaseManager, mBaseline);
1546
                    buildExclusion.email(this, mPackageCollection);
1540
                    buildExclusion.email(this, mPackageCollectionAll);
1547
                    counter++;
1541
                    counter++;
1548
                }
1542
                }
1549
            }
1543
            }
1550
        }
1544
        }
1551
        mLogger.error("reportChange exclusion count: {}", counter);
1545
        mLogger.error("reportChange exclusion count: {}", counter);
Line 1677... Line 1671...
1677
     * for the package and all dependent packages that are a part of the release set.
1671
     * for the package and all dependent packages that are a part of the release set.
1678
     *  
1672
     *  
1679
     * @param p             The package being excluded 
1673
     * @param p             The package being excluded 
1680
     * @param rootPvId      The PVID of the package that is causing the exclusion. Null or -ve values are special
1674
     * @param rootPvId      The PVID of the package that is causing the exclusion. Null or -ve values are special
1681
     *                      This package is the root cause, -2: Excluded by Ripple Stop 
1675
     *                      This package is the root cause, -2: Excluded by Ripple Stop 
1682
     *                   
-
 
1683
     * @param rootCause     Text message. Max 50 characters imposed by RM database 
1676
     * @param rootCause     Text message. Max 50 characters imposed by RM database 
1684
     * @param list          If not null, add build exclusion to specified list, else use default(mBuildExclusionCollection) list. Allows insertions while iterating the list.
1677
     * @param list          If not null, add build exclusion to specified list, else use default(mBuildExclusionCollection) list. Allows insertions while iterating the list.
1685
     * @param be            If not null, process provided BuildExclusion element, otherwise find-existing/create a BuildExclusion element
1678
     * @param be            If not null, process provided BuildExclusion element, otherwise find-existing/create a BuildExclusion element
1686
     * @param dependentToo  True: Exclude all packages that depend on the excluded package 
1679
     * @param dependentToo  True: Exclude all packages that depend on the excluded package 
-
 
1680
     * @param depWipsToo    False: Don't exclude WIP packages that depend on the excluded package
1687
     */
1681
     */
1688
    private void rippleBuildExclude(Package p, int rootPvId, String rootCause, ListIterator<BuildExclusion> list, BuildExclusion be, boolean dependentToo )
1682
    private void rippleBuildExclude(Package p, int rootPvId, String rootCause, ListIterator<BuildExclusion> list, BuildExclusion be, boolean dependentToo, boolean depWipsToo )
1689
    {
1683
    {
1690
        mLogger.debug("rippleBuildExclude");
1684
        mLogger.debug("rippleBuildExclude");
1691
     
1685
     
1692
        if ( p.mBuildFile == 0 || p.mBuildFile == 1 )
1686
        if ( p.mBuildFile == 0 || p.mBuildFile == 1 )
1693
        {
1687
        {
Line 1756... Line 1750...
1756
            if ( ! p.mIsNotReleased && dependentToo)
1750
            if ( ! p.mIsNotReleased && dependentToo)
1757
            {
1751
            {
1758
                for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1752
                for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1759
                {
1753
                {
1760
                    Package pkg = it.next();
1754
                    Package pkg = it.next();
-
 
1755
                    
-
 
1756
                    //  Skip myself
-
 
1757
                    if (pkg == p)
-
 
1758
                        continue;
1761
 
1759
 
-
 
1760
                    //  Ignore dependent WIPS if required
-
 
1761
                    if (!depWipsToo && pkg.mDirectlyPlanned)
1762
                    if ( pkg != p )
1762
                        continue;
-
 
1763
                    
-
 
1764
                    for (Iterator<Package> it2 = pkg.mPackageDependencyCollection.iterator(); it2.hasNext(); )
1763
                    {
1765
                    {
1764
                        for (Iterator<Package> it2 = pkg.mPackageDependencyCollection.iterator(); it2.hasNext(); )
-
 
1765
                        {
-
 
1766
                            Package dependency = it2.next();
1766
                        Package dependency = it2.next();
1767
 
1767
 
1768
                            if ( dependency == p )
1768
                        if ( dependency == p )
1769
                            {
1769
                        {
1770
                                rippleBuildExclude( pkg, rootPvId, null, list, null, dependentToo );
1770
                            rippleBuildExclude( pkg, rootPvId, null, list, null, dependentToo, depWipsToo );
1771
                                break;
1771
                            break;
1772
                            }
-
 
1773
                        }
1772
                        }
1774
                    }
1773
                    }
-
 
1774
 
1775
                }
1775
                }
1776
            }
1776
            }
1777
        }
1777
        }
1778
        mLogger.info("rippleBuildExclude set {} {}", p.mName, p.mBuildFile);
1778
        mLogger.info("rippleBuildExclude set {} {}", p.mName, p.mBuildFile);
1779
    }
1779
    }
Line 2174... Line 2174...
2174
     * @param xml	- An xml element to append data to
2174
     * @param xml	- An xml element to append data to
2175
     * @param p	- Package to process
2175
     * @param p	- Package to process
2176
     */
2176
     */
2177
    private void generatePackageInfo (XmlBuilder xml, Package p)
2177
    private void generatePackageInfo (XmlBuilder xml, Package p)
2178
    {
2178
    {
2179
        String joiner = "";
-
 
2180
        
-
 
2181
        String comment =
2179
        StringBuilder comment = new StringBuilder();
2182
                "pvid="+ p.mId + 
-
 
2183
                " name=\"" + p.mAlias + "\""+
-
 
2184
                " reason=" + p.mNoBuildReason +" "+ 
-
 
2185
                " buildFile=" + p.mBuildFile + " "+
2180
        StringBuilder deps = new StringBuilder();
2186
                " directlyPlanned=" + p.mDirectlyPlanned + " "+
-
 
2187
                " indirectlyPlanned=" + p.mIndirectlyPlanned + " depends=[" ;
-
 
2188
        
2181
        
-
 
2182
        String joiner = "";
2189
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
2183
        for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
2190
        {
2184
        {
2191
            String alias = it2.next();
2185
            String alias = it2.next();
2192
            comment += joiner + alias;
2186
            deps.append(joiner).append(alias); 
2193
            joiner = ",";
2187
            joiner = ",";
2194
        }
2188
        }
2195
        
2189
        
2196
        comment += "]";
2190
        comment.append("pvid=").append(p.mId);
-
 
2191
        comment.append(" name=").append('"').append(p.mAlias).append('"');
-
 
2192
        comment.append(" reason=").append(p.mNoBuildReason);
-
 
2193
        comment.append(" buildFile=").append(p.mBuildFile);
-
 
2194
        comment.append(" directlyPlanned=").append(p.mDirectlyPlanned);
-
 
2195
        comment.append(" indirectlyPlanned=").append(p.mIndirectlyPlanned);
-
 
2196
        comment.append(" depends=[").append(deps).append("]");
2197
 
2197
 
2198
        xml.addComment(comment);            
2198
        xml.addComment(comment.toString());            
2199
    }
2199
    }
2200
 
2200
 
2201
    /**returns an ant target for the passed Package
2201
    /**returns an ant target for the passed Package
2202
     * in daemon mode:
2202
     * in daemon mode:
2203
     *  packages are categorized with one of three mBuildFile values:
2203
     *  packages are categorized with one of three mBuildFile values: