Subversion Repositories DevTools

Rev

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

Rev 7052 Rev 7070
Line 889... Line 889...
889
     *  This is a stand alone method to contain the work
889
     *  This is a stand alone method to contain the work
890
     *  
890
     *  
891
     * @throws Exception
891
     * @throws Exception
892
     * @throws SQLException
892
     * @throws SQLException
893
     */
893
     */
894
    private void planBuildOrder() throws Exception, SQLException {
894
    private void planBuildOrder() throws Exception, SQLException 
-
 
895
    {
895
        
896
        
896
//TODO - Planing is not working well
897
//TODO - Planning is not working well
897
/**
898
/**
898
 * Current status
899
 * Current status
899
 * The selection of the package to build next is deeply flawed
900
 * The selection of the package to build next is deeply flawed
900
 * Currently it will select a ripple over a directly planned package - thus the unit tests are not working
901
 * Currently it will select a directly planned package over a ripple - (perhaps that is good)
-
 
902
 * 
-
 
903
 * Currently on the buildPlan of the 'selected' package is included in the BuildOrder
-
 
904
 * 
901
 * The current algorithm is based on time - but all packages have zero build time ( in UTF )
905
 * The current algorithm is based on time - but all packages have zero build time ( in UTF )
902
 * Even if this is fixed the algorithm is broken as we will select the complete build with the shortest time
906
 * Even if this is fixed the algorithm is broken as we will select the complete build with the shortest time
903
 * which will be the ripple of a leaf package ( perhaps that is good )
907
 * which will be the ripple of a leaf package ( perhaps that is good )
904
 * 
908
 * 
905
 * Also:
909
 * Also:
906
 *      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
907
 * 
911
 * 
908
 *      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
909
 *      Remove duplicates from the complete package set
913
 *      [Done]Remove duplicates from the complete package set
910
 *      
914
 *      
911
 *      Need more test cases
915
 *      Need more test cases
912
 *      
916
 *      
913
 *      Need to report all build options, not just the selected one
917
 *      Need to report all build options, not just the selected one
914
 *      
918
 *      
915
 *      Cleanup the ANT build file - don't list all the release dependencies, just those needed to build the current package
919
 *      Cleanup the ANT build file - don't list all the release dependencies, just those needed to build the current package
-
 
920
 *      
-
 
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.
-
 
922
 *      Should not exclude a WIP of a package with a circular dependency
916
 */
923
 */
917
 
924
 
918
        // Process remaining packages which are need to be reproduced for this baseline.
925
        // Process remaining packages which are need to be reproduced for this baseline.
919
        //    Determine the build file for each package
926
        //    Determine the build file for each package
920
        //    For daemon builds:
927
        //    For daemon builds:
Line 1034... Line 1041...
1034
        if ( mDaemon )
1041
        if ( mDaemon )
1035
        {
1042
        {
1036
 
1043
 
1037
            //
1044
            //
1038
            //  Daemon Mode:
1045
            //  Daemon Mode:
1039
            //  Locate all packages that we can build now
-
 
1040
            //      Packages that have a build requirement and have no reason we cannot build them
-
 
1041
            //
1046
            //
-
 
1047
 
-
 
1048
            //  Create a list of build candidates
-
 
1049
            //
-
 
1050
            //  Add in the WIPs, Tests and Ripple Requests so that we can process them as one collections
-
 
1051
            //  Now have a collection of packages that we would like to build right now
-
 
1052
            //  See if any of them can be excluded due to issues with creating a new package version
1042
            ArrayList<Package> buildCandidates = new ArrayList<Package>();
1053
            ArrayList<Package> buildCandidates = new ArrayList<Package>();
-
 
1054
            buildCandidates.addAll(mPackageCollectionWip);
-
 
1055
            buildCandidates.addAll(mPackageCollectionTest);
-
 
1056
            buildCandidates.addAll(mPackageCollectionRipple);
-
 
1057
 
-
 
1058
            //  Locate all packages that we can build now
-
 
1059
            //      Packages that have a build requirement and have no reason we cannot build them
1043
 
1060
 
1044
            
-
 
1045
            for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
1061
            for (Iterator<Package> it = mBuildOrder.iterator(); it.hasNext(); )
1046
            {
1062
            {
1047
                Package p = it.next();
1063
                Package p = it.next();
1048
                if ( p.mProcessed && p.mBuildFile > 0 )
1064
                if ( p.mProcessed && p.mBuildFile > 0 )
1049
                {
1065
                {
Line 1054... Line 1070...
1054
                        mLogger.info("planRelease Candidate {}",p.mAlias);
1070
                        mLogger.info("planRelease Candidate {}",p.mAlias);
1055
                    }
1071
                    }
1056
                }
1072
                }
1057
            }
1073
            }
1058
            
1074
            
1059
            //  Add in the WIPs, Tests and Ripple Requests so that we can process them as one collections
1075
            //  Examine the build candidates and verify that a new version number can be calculated for each
1060
            //  Now have a collection of packages that we would like to build right now
1076
            //  version that we need to build.
1061
            //  See if any of them can be excluded due to issues with creating a new package version
-
 
1062
            buildCandidates.addAll(mPackageCollectionWip);
1077
            //
1063
            buildCandidates.addAll(mPackageCollectionTest);
1078
//TODO If we find WIP/TEST/RIPPLE with invalid nextVersion, then we could email the submitter and treat it as a fail.            
1064
            buildCandidates.addAll(mPackageCollectionRipple);
-
 
1065
            
1079
            
1066
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1080
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1067
            {
1081
            {
1068
                Package p = it.next();
1082
                Package p = it.next();
1069
 
1083
 
Line 1112... Line 1126...
1112
                        else 
1126
                        else 
1113
                        {
1127
                        {
1114
                            //  Calculate the time to build the package AND all of the packages that depend on it
1128
                            //  Calculate the time to build the package AND all of the packages that depend on it
1115
                            //  Calculate the build plan for the package
1129
                            //  Calculate the build plan for the package
1116
                            //
1130
                            //
1117
                            calcBuildPlan(p);
1131
                            calcBuildPlan(p, mPackageCollection, true);
1118
                        }
1132
                        }
1119
                    }
1133
                    }
1120
                }
1134
                }
1121
            }
1135
            }
1122
            
1136
            
1123
            //
-
 
1124
            //  Determine the NON-test package the we will build next
-
 
1125
            //
-
 
1126
            Package build = ReleaseManager.NULL_PACKAGE; 
-
 
1127
            
-
 
1128
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
-
 
1129
            {
-
 
1130
                
-
 
1131
                Package p = it.next();
-
 
1132
                if ( p.mBuildFile >= 0 )
-
 
1133
                {
-
 
1134
                    if (p.mTestBuildInstruction == 0)
-
 
1135
                    {
-
 
1136
                        //  Not a Test Build
-
 
1137
                        if (build == ReleaseManager.NULL_PACKAGE || p.mRippleTime < build.mRippleTime)
-
 
1138
                        {
-
 
1139
                            build = p;
-
 
1140
                        }
-
 
1141
                    }
-
 
1142
                }
-
 
1143
            }
-
 
1144
 
-
 
1145
            //  Determine the first test build package
1137
            //  Determine the first test build package
1146
            //  Assume the collection is in build instruction id order, 
1138
            //  Assume the collection is in build instruction id order, 
1147
            //      So that the first request will be built first
1139
            //      So that the first request will be built first
1148
            //  Add all buildable test-builds to the mBuildOrder collection 
1140
            //  Add all buildable test-builds to the mBuildOrder collection 
1149
            Package testBuild = ReleaseManager.NULL_PACKAGE;
1141
            Package testBuild = ReleaseManager.NULL_PACKAGE;
Line 1166... Line 1158...
1166
                    }
1158
                    }
1167
                }
1159
                }
1168
            }
1160
            }
1169
            
1161
            
1170
            //
1162
            //
1171
            //  Extend mBuildOrder with the selected non-test build package and its build plan
1163
            //  Determine the NON-test packages the we will build next
1172
            //  Really only for display purposes
1164
            //  This will be the one with the lowest ripple time
1173
            //
1165
            //
1174
            if (build != ReleaseManager.NULL_PACKAGE)
1166
            Package build = ReleaseManager.NULL_PACKAGE;
-
 
1167
            ArrayList<Package> buildNext = new ArrayList<Package>();
-
 
1168
            
-
 
1169
            //  Extract candidates that are left
-
 
1170
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
1175
            {
1171
            {
-
 
1172
                Package p = it.next();
-
 
1173
                if ( p.mBuildFile >= 0  &&p.mTestBuildInstruction == 0)
-
 
1174
                {
-
 
1175
                    buildNext.add(p);
-
 
1176
                }
-
 
1177
            }
-
 
1178
            
-
 
1179
            if ( !buildNext.isEmpty() )
-
 
1180
            {
-
 
1181
                //  Sort on mRippleTime so that
-
 
1182
                //      We can get the lowest first
-
 
1183
                //      We can generate the complete plan in a nice order
-
 
1184
                //
-
 
1185
                Collections.sort(buildNext, Package.RippleTimeComparator);
-
 
1186
                
-
 
1187
                //  At the moment extract the first one - this is the fastedt
-
 
1188
                //  TODO - could build another candidate as long as it does't extend the time by (say) 10%
-
 
1189
                //         Would need to rejigger the collection - for the next step
-
 
1190
                //
-
 
1191
                build = buildNext.get(0);
-
 
1192
                
-
 
1193
                //  Determine the amount of time we would allow the 'best' plan to be extended
-
 
1194
                //      Allow for a 20% extension in time
-
 
1195
                //      Min of 10 minutes
-
 
1196
                int baseTime = build.mRippleTime;
-
 
1197
                baseTime = ( baseTime * 1200) / 1000;
-
 
1198
                if ( baseTime < 10 * 60) {
-
 
1199
                    baseTime = (10 * 60);
-
 
1200
                }
-
 
1201
                mLogger.error("Scan for package to build: {} {}", build.mRippleTime, baseTime);
-
 
1202
 
-
 
1203
                //  Find last package that does not exceed the extended ripple time
-
 
1204
                for (Iterator<Package> it = buildNext.iterator(); it.hasNext(); )
-
 
1205
                {
-
 
1206
                    Package p = it.next();
-
 
1207
                    if (p.mRippleTime > baseTime)
-
 
1208
                    {
-
 
1209
                        break;
-
 
1210
                    }
-
 
1211
                    build = p;
-
 
1212
                }
-
 
1213
 
-
 
1214
                //
-
 
1215
                //  Extend mBuildOrder with the selected non-test build package and its build plan
-
 
1216
                //  Really only for display purposes
-
 
1217
                //
-
 
1218
                Package.resetProcessed(buildNext);
1176
                mBuildOrder.add(build);
1219
                mBuildOrder.add(build);
-
 
1220
                updateBuildList(build.mRipplePlan, buildNext);
1177
                mBuildOrder.addAll(build.mRipplePlan);
1221
                mBuildOrder.addAll(build.mRipplePlan);
-
 
1222
                
-
 
1223
                //  Add in other build candidates
-
 
1224
                for (Iterator<Package> it = buildNext.iterator(); it.hasNext(); )
-
 
1225
                {
-
 
1226
                    Package p = it.next();
-
 
1227
                    if ( p.mBuildFile >= 0 )
-
 
1228
                    {
-
 
1229
                        if ( p != build && ! p.mIsProcessed)
-
 
1230
                        {
-
 
1231
                            //  Not our selected package and not already processed
-
 
1232
                            mBuildOrder.add(p);
-
 
1233
                            updateBuildList(p.mRipplePlan, buildNext);
-
 
1234
                            mBuildOrder.addAll(p.mRipplePlan);
-
 
1235
                        }
-
 
1236
                    }
-
 
1237
                }
1178
            }
1238
            }
1179
            
1239
            
1180
            //
1240
            //
1181
            //  Mark the first package in the build order as the one to be built
1241
            //  Mark the first package in the build order as the one to be built
1182
            //  This will give test builds priority, while indicating what will be built after that
1242
            //  This will give test builds priority, while indicating what will be built after that
Line 1206... Line 1266...
1206
                    build.mVersion = build.mNextVersion;
1266
                    build.mVersion = build.mNextVersion;
1207
                }
1267
                }
1208
            }
1268
            }
1209
            
1269
            
1210
            //
1270
            //
-
 
1271
            //  Massage the package collection
-
 
1272
            //      Replace WIP/TEST/RIPPLE so that the mPackageCollection is a collection of packages we would like in the release
-
 
1273
            //      Don't replace those that we can't build due to errors
-
 
1274
            //
-
 
1275
            for (Iterator<Package> it = buildCandidates.iterator(); it.hasNext(); )
-
 
1276
            {
-
 
1277
                Package p = it.next();
-
 
1278
                if ( p.mBuildFile >= 0 )
-
 
1279
                {
-
 
1280
                    Package pReleased = findPackage(p.mAlias);
-
 
1281
                    if ( pReleased != ReleaseManager.NULL_PACKAGE)
-
 
1282
                    {
-
 
1283
                        int index = mReleaseManager.findPackageLastIndex;
-
 
1284
                        mPackageCollection.set(index, p);
-
 
1285
                        p.mIsNotReleased = false;
-
 
1286
                    }
-
 
1287
                }
-
 
1288
            }
-
 
1289
                        
-
 
1290
            
-
 
1291
            //
1211
            //  To fit in with the old algorithm ( ie: could be improved )
1292
            //  To fit in with the old algorithm ( ie: could be improved )
1212
            //  Insert marks into all packages
1293
            //  Insert marks into all packages
1213
            //  Not sure exactly why - Its used in the generation of the ant build file
1294
            //  Not sure exactly why - Its used in the generation of the ant build file
1214
            //  Want to set mNoBuildReason, mBuildFile
1295
            //                     Want to set mNoBuildReason, mBuildFile
1215
            //
1296
            //
1216
            //      Package we have selected to build: 0     , 1
1297
            //      Package we have selected to build: 0     , 1
1217
            //      Package we could have built      : 2     , 3
1298
            //      Package we could have built      : 0     , 2
1218
            //      Packages we can't build          : reason, 3
1299
            //      Packages we can't build          : reason, 3
1219
            //      Packages that are OK             : 3     , 3
1300
            //      Packages that are OK             : 3     , 3
-
 
1301
            //      ????                             : 0     , 3
1220
            
1302
            
1221
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1303
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1222
            {
1304
            {
1223
                Package p = it.next();
1305
                Package p = it.next();
1224
                if (p == build ) {
1306
                if (p == build ) {
Line 1230... Line 1312...
1230
                    p.mNoBuildReason = p.mBuildFile;
1312
                    p.mNoBuildReason = p.mBuildFile;
1231
                    p.mBuildFile = 3;
1313
                    p.mBuildFile = 3;
1232
                }
1314
                }
1233
                else if (p.mBuildReason != null)
1315
                else if (p.mBuildReason != null)
1234
                {
1316
                {
1235
                    p.mNoBuildReason = 2;
1317
                    p.mNoBuildReason = 0;
1236
                    p.mBuildFile = 3;
1318
                    p.mBuildFile = 2;
1237
                }
1319
                }
1238
                else
1320
                else
1239
                {
1321
                {
1240
                    p.mNoBuildReason = 0;
1322
                    p.mNoBuildReason = 0;
1241
                    p.mBuildFile = 3;
1323
                    p.mBuildFile = 3;
1242
                }
1324
                }
1243
            }
1325
            }
-
 
1326
 
1244
        }
1327
        }
1245
 
1328
 
1246
    }
1329
    }
1247
 
1330
 
-
 
1331
    /** Update a collection of packages such that the collection contains packages from the WIP/RIPPLE collection
-
 
1332
     *  in preference to the package in the main collection
-
 
1333
     *  
-
 
1334
     * @param packageList   - List to process and update
-
 
1335
     * @param repList - List of replacement candidates. Assumes valid packages
-
 
1336
     */
-
 
1337
    private void updateBuildList(ArrayList<Package> packageList, ArrayList<Package> repList ) {
-
 
1338
 
-
 
1339
        int baseIndex = 0;
-
 
1340
        for (Iterator<Package> it = packageList.iterator(); it.hasNext(); baseIndex++)
-
 
1341
        {
-
 
1342
            Package basePkg = it.next();
-
 
1343
 
-
 
1344
            for (Iterator<Package> repit = repList.iterator(); repit.hasNext(); )
-
 
1345
            {
-
 
1346
                Package repPkg = repit.next();
-
 
1347
                if ( basePkg.mAlias.compareTo( repPkg.mAlias ) == 0 )                    
-
 
1348
                {
-
 
1349
                    //  Replacement package has been found
-
 
1350
                    //  Only looking for non-test packages that can be built
-
 
1351
                    //  Flag that the package is now a part of the official release set
-
 
1352
                    //  Flag that the package has been processed to prevent it being included in a future plan
-
 
1353
                    
-
 
1354
                    packageList.set(baseIndex, repPkg);
-
 
1355
                    repPkg.mIsNotReleased = false;
-
 
1356
                    repPkg.mIsProcessed = true;
-
 
1357
                    break;
-
 
1358
                    
-
 
1359
                }
-
 
1360
            }
-
 
1361
        }
-
 
1362
    }
-
 
1363
 
1248
    /**
1364
    /**
1249
     * Calculate a build plan for the specified package
1365
     * Calculate a build plan for the specified package
1250
     * Calculates : mRippleTime - time to build the package and the ripple effect
1366
     * Calculates : mRippleTime - time to build the package and the ripple effect
1251
     * Calculates : mBuildPlan - collection of packages in the plan that can be built at the moment
1367
     * Calculates : mBuildPlan - collection of packages in the plan that can be built at the moment
1252
     * 
1368
     * 
1253
     * Needs to determine all packages that consume the package - and all packages that consume them
1369
     * Needs to determine all packages that consume the package - and all packages that consume them
1254
     *  Note: The package may not be in the mPackageCollection ( it may be a WIP/TEST/RIPPLE )
1370
     *  Note: The package may not be in the mPackageCollection ( it may be a WIP/TEST/RIPPLE )
1255
     *  
1371
     *  
-
 
1372
     * Note: The rippleTime of PackageA is not the sum of the rippleTimes of the packages that consume PackageA.
-
 
1373
     *  
1256
     * Need to:
1374
     * Need to:
1257
     *      Only include a package once.
1375
     *      Only include a package once.
1258
     *      Only include packages that can/need to be built at the moment
1376
     *      Only include packages that can/need to be built at the moment
1259
     * 
1377
     * 
1260
     * @param p     - Package to process
1378
     * @param p                 - Package to process
1261
     */
1379
     * @param pkgCollection     - Package Collection to scan
-
 
1380
     * @param processAll        - True: Order all packages discovered
1262
 
1381
 
1263
    private void calcBuildPlan(Package p) {
-
 
1264
        
1382
     */
1265
        p.mRipplePlan = usedByPackages(p);
1383
    private void calcBuildPlan(Package p, ArrayList<Package> pkgCollection, boolean processAll) {
1266
        
1384
        
-
 
1385
        mLogger.error("calcBuildPlan Add {}", p.mAlias);
-
 
1386
        p.mRipplePlan = usedByPackages(p, pkgCollection);
-
 
1387
        p.mRippleTime = p.mBuildTime;
-
 
1388
 
1267
        //  Use a ListIterator so that we can add elements to the end of the list while processing
1389
        //  Use a ListIterator so that we can add elements to the end of the list while processing
-
 
1390
        //  Sum the buildTimes of the packages that we add to the list
-
 
1391
        
1268
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1392
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1269
        {
1393
        {
1270
            Package pkg = it.next();
1394
            Package pkg = it.next();
-
 
1395
            mLogger.error("calc process {}", pkg.mAlias);
-
 
1396
            pkg.mRippleOrder++;
-
 
1397
            p.mRippleTime += pkg.mBuildTime;
-
 
1398
            
1271
            ArrayList<Package> usedBy = usedByPackages(pkg);
1399
            ArrayList<Package> usedBy = usedByPackages(pkg, pkgCollection);
1272
            for (Iterator<Package> it1 = usedBy.iterator(); it1.hasNext(); )
1400
            for (Iterator<Package> it1 = usedBy.iterator(); it1.hasNext(); )
1273
            {
1401
            {
1274
                Package uPkg = it1.next();
1402
                Package uPkg = it1.next();
-
 
1403
                uPkg.mRippleOrder = pkg.mRippleOrder + 1;
1275
                if ( ! p.mRipplePlan.contains( uPkg ))
1404
                if ( ! p.mRipplePlan.contains( uPkg ))
1276
                {
1405
                {
1277
                    it.add(uPkg);
1406
                    it.add(uPkg);
-
 
1407
                    it.previous();
-
 
1408
                    p.mRippleTime += uPkg.mBuildTime;
-
 
1409
                    mLogger.error("calc Add {}", uPkg.mAlias);
1278
                }
1410
                }
1279
            }
1411
            }
1280
        }
1412
        }
1281
        
1413
        
1282
        //
1414
        //
-
 
1415
        //  Need to determine the rippleTime for each package in the plan
-
 
1416
        //      Have a much smaller set of packages to process
1283
        //  Now have a plan on what will be affected when we build the package
1417
        //  Don't care about the mRipplePlan item in the packages
-
 
1418
        //  Don't modify the mRippleOrder
-
 
1419
        //  
-
 
1420
        
-
 
1421
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
-
 
1422
        {
-
 
1423
            Package pkg = it.next();
-
 
1424
            
-
 
1425
            pkg.mRipplePlan = usedByPackages(pkg, pkgCollection);
-
 
1426
            pkg.mRippleTime = pkg.mBuildTime;
-
 
1427
 
-
 
1428
            //  Use a ListIterator so that we can add elements to the end of the list while processing
1284
        //  Calculate the time it will take - include my time
1429
            //  Sum the buildTimes of the packages that we add to the list
-
 
1430
            
-
 
1431
            for (ListIterator<Package> it0 = pkg.mRipplePlan.listIterator(); it0.hasNext(); )
-
 
1432
            {
-
 
1433
                Package pkg1 = it0.next();
-
 
1434
                pkg.mRippleTime += pkg1.mBuildTime;
-
 
1435
                
-
 
1436
                ArrayList<Package> usedBy = usedByPackages(pkg1, pkgCollection);
-
 
1437
                for (Iterator<Package> it1 = usedBy.iterator(); it1.hasNext(); )
-
 
1438
                {
-
 
1439
                    Package uPkg = it1.next();
-
 
1440
                    if ( ! pkg.mRipplePlan.contains( uPkg ))
-
 
1441
                    {
-
 
1442
                        it0.add(uPkg);
-
 
1443
                        it0.previous();
-
 
1444
                        pkg.mRippleTime += uPkg.mBuildTime;
-
 
1445
                    }
-
 
1446
                }
-
 
1447
            }
-
 
1448
 
-
 
1449
        }
-
 
1450
        
1285
        //
1451
        //
-
 
1452
        //  Sort the ripplePlan so that we build the fastest elements first
-
 
1453
        //  Only care about the ripplePlan for the main Package
-
 
1454
        //
-
 
1455
        Collections.sort(p.mRipplePlan, Package.PlanComparator);
-
 
1456
        
1286
        p.mRippleTime = p.mBuildTime;
1457
        //  Debugging
-
 
1458
        mLogger.error("calcBuildPlan. Pkg:{} pvid:{}, Order:{} RippleT:{} BuildT:{}", p.mAlias, p.mId, p.mRippleOrder, p.mRippleTime, p.mBuildTime);
1287
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1459
        for (ListIterator<Package> it = p.mRipplePlan.listIterator(); it.hasNext(); )
1288
        {
1460
        {
1289
            Package pkg = it.next();
1461
            Package pkg = it.next();
1290
            p.mRippleTime += pkg.mBuildTime;
1462
            mLogger.error("calcBuildPlan. Plan: Pkg:{} pvid:{}, Order:{} RippleT:{} BuildT:{}", pkg.mAlias, pkg.mId, pkg.mRippleOrder, pkg.mRippleTime, pkg.mBuildTime);
1291
        }
1463
        }
1292
    }
1464
    }
1293
 
1465
 
1294
    /** 
1466
    /** 
1295
     *  Calculate a collection of packages that actively use the named package
1467
     *  Calculate a collection of packages that actively use the named package
Line 1297... Line 1469...
1297
     *      If the consumer is an SDK or is Pegged
1469
     *      If the consumer is an SDK or is Pegged
1298
     *      If the consumer is marked as advisoryRipple
1470
     *      If the consumer is marked as advisoryRipple
1299
     *      If the consumer cannot be built
1471
     *      If the consumer cannot be built
1300
     *   
1472
     *   
1301
     * @param pkg - Package to process
1473
     * @param pkg - Package to process
-
 
1474
     * @param pkgCollection - collection of packages to scan
1302
     * @return A collection of packages that actively 'use' the specified package
1475
     * @return A collection of packages that actively 'use' the specified package
1303
 
1476
 
1304
     */
1477
     */
1305
    private ArrayList<Package> usedByPackages(Package pkg) {
1478
    private ArrayList<Package> usedByPackages(Package pkg, ArrayList<Package> pkgCollection) {
1306
        
1479
        
1307
        ArrayList<Package> usedBy = new ArrayList<Package>();
1480
        ArrayList<Package> usedBy = new ArrayList<Package>();
1308
        
1481
        
1309
        for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1482
        for (Iterator<Package> it = pkgCollection.iterator(); it.hasNext(); )
1310
        {
1483
        {
1311
            Package p = it.next();
1484
            Package p = it.next();
1312
            
1485
            
1313
            //  Is this package 'actively used' in the current build
1486
            //  Is this package 'actively used' in the current build
1314
            if (p.mBuildFile >= 0)
1487
            if (p.mBuildFile >= 0)
1315
            {
1488
            {
1316
                for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
1489
                for (Iterator<String> it2 = p.mDependencyCollection.iterator(); it2.hasNext(); )
1317
                {
1490
                {
1318
                    String alias = it2.next();
1491
                    String alias = it2.next();
1319
                    if ( alias == pkg.mAlias) {
1492
                    if (  pkg.mAlias.compareTo( alias ) == 0  ) {
1320
                        //  Have found a consumer of 'pkg'
1493
                        //  Have found a consumer of 'pkg'
1321
                        usedBy.add(p);
1494
                        usedBy.add(p);
1322
                        break;
1495
                        break;
1323
                    }
1496
                    }
1324
                }
1497
                }
Line 1483... Line 1656...
1483
        }
1656
        }
1484
    }
1657
    }
1485
 
1658
 
1486
    /**
1659
    /**
1487
     * Find Package by package alias
1660
     * Find Package by package alias
1488
     * Searches the complete package collection
1661
     * Searches the released package collection
1489
     * @param   alias               - alias of package to locate
1662
     * @param   alias               - alias of package to locate
1490
     * @return  Package with the matching mAlias or NULL_PACKAGE if no package has the mAlias
1663
     * @return  Package with the matching mAlias or NULL_PACKAGE if no package has the mAlias
1491
     */
1664
     */
1492
    public Package findPackage(String alias)
1665
    public Package findPackage(String alias)
1493
    {
1666
    {
Line 1496... Line 1669...
1496
        Package retVal = mReleaseManager.findPackage(alias, mPackageCollection);
1669
        Package retVal = mReleaseManager.findPackage(alias, mPackageCollection);
1497
 
1670
 
1498
        mLogger.info("findPackage returned {}", retVal.mName);
1671
        mLogger.info("findPackage returned {}", retVal.mName);
1499
        return retVal;
1672
        return retVal;
1500
    }
1673
    }
1501
 
1674
    
1502
    /**
1675
    /**
1503
     * Sets the mBuildFile to -5 (indirectly dependent on package versions which are not reproducible) 
1676
     * Sets the mBuildFile to -5 (indirectly dependent on package versions which are not reproducible) 
1504
     * for the package and all dependent packages that are a part of the release set.
1677
     * for the package and all dependent packages that are a part of the release set.
1505
     *  
1678
     *  
1506
     * @param p             The package being excluded 
1679
     * @param p             The package being excluded 
Line 1671... Line 1844...
1671
 
1844
 
1672
            //	Generate properties for each package in this build level or lower build levels
1845
            //	Generate properties for each package in this build level or lower build levels
1673
            //	The properties link the packageAlias to the PackageName and PackageVersion
1846
            //	The properties link the packageAlias to the PackageName and PackageVersion
1674
            //
1847
            //
1675
            //	[DEVI 54816] In escrow mode all unreproducible packages are included 
1848
            //	[DEVI 54816] In escrow mode all unreproducible packages are included 
1676
            for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1849
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1677
            {
1850
            {
1678
                Package p = it.next();
1851
                Package p = it.next();
1679
 
1852
 
1680
                if ( ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) ) || ( !mDaemon && p.mBuildFile == -2 ) )
1853
                if ( ( ( p.mBuildFile > 0 ) && ( p.mBuildFile <= buildFile ) ) || ( !mDaemon && p.mBuildFile == -2 ) )
1681
                {
1854
                {
Line 1689... Line 1862...
1689
            if ( ! mReleaseManager.mUseDatabase )
1862
            if ( ! mReleaseManager.mUseDatabase )
1690
            {
1863
            {
1691
                // UTF Support
1864
                // UTF Support
1692
                // Insert per-package planning information
1865
                // Insert per-package planning information
1693
                //
1866
                //
1694
                xml.addComment("mPackageCollectionAll");
1867
                xml.addComment("mPackageCollection");
1695
                for (Iterator<Package> it = mPackageCollectionAll.iterator(); it.hasNext(); )
1868
                for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
1696
                {
1869
                {
1697
                    Package p = it.next();
1870
                    Package p = it.next();
1698
                    generatePackageInfo(xml, p);
1871
                    generatePackageInfo(xml, p);
1699
                }
1872
                }
1700
 
1873
 
-
 
1874
                xml.addComment("mPackageCollectionWip");
-
 
1875
                for (Iterator<Package> it = mPackageCollectionWip.iterator(); it.hasNext(); )
-
 
1876
                {
-
 
1877
                    Package p = it.next();
-
 
1878
                    if (p.mIsNotReleased )
-
 
1879
                        generatePackageInfo(xml, p);
-
 
1880
                }
-
 
1881
                
-
 
1882
                xml.addComment("mPackageCollectionTest");
-
 
1883
                for (Iterator<Package> it = mPackageCollectionTest.iterator(); it.hasNext(); )
-
 
1884
                {
-
 
1885
                    Package p = it.next();
-
 
1886
                    if (p.mIsNotReleased )
-
 
1887
                        generatePackageInfo(xml, p);
-
 
1888
                }
-
 
1889
 
-
 
1890
                xml.addComment("mPackageCollectionTestRipple");
-
 
1891
                for (Iterator<Package> it = mPackageCollectionRipple.iterator(); it.hasNext(); )
-
 
1892
                {
-
 
1893
                    Package p = it.next();
-
 
1894
                    if (p.mIsNotReleased )
-
 
1895
                        generatePackageInfo(xml, p);
-
 
1896
                }
-
 
1897
 
1701
                // UTF Support
1898
                // UTF Support
1702
                // Insert build exclusion information
1899
                // Insert build exclusion information
1703
                xml.addComment("mBuildExclusionCollection");
1900
                xml.addComment("mBuildExclusionCollection");
1704
                for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
1901
                for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
1705
                {
1902
                {
Line 1720... Line 1917...
1720
                    {
1917
                    {
1721
                        Package p = it.next();
1918
                        Package p = it.next();
1722
                        String comment =
1919
                        String comment =
1723
                                "pvid="+ p.mId +
1920
                                "pvid="+ p.mId +
1724
                                " order=" + (++order) +
1921
                                " order=" + (++order) +
-
 
1922
                                " Rorder=" + (p.mRippleOrder) +
-
 
1923
                                " time=" + p.mRippleTime +
1725
                                " name=\"" + p.mAlias + "\"";
1924
                                " name=\"" + p.mAlias + "\"";
1726
                        xml.addComment(comment);
1925
                        xml.addComment(comment);
1727
                    }
1926
                    }
1728
                }
1927
                }
1729
            }
1928
            }