Subversion Repositories DevTools

Rev

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

Rev 7095 Rev 7096
Line 828... Line 828...
828
                    mLogger.error("planRelease Test Build of an unbuildable of package deleted: {}", p.mName);
828
                    mLogger.error("planRelease Test Build of an unbuildable of package deleted: {}", p.mName);
829
                    mReleaseManager.markDaemonInstCompleted( p.mTestBuildInstruction );
829
                    mReleaseManager.markDaemonInstCompleted( p.mTestBuildInstruction );
830
                    emailRejectedDaemonInstruction(reason,p);
830
                    emailRejectedDaemonInstruction(reason,p);
831
                }
831
                }
832
            }
832
            }
833
            
-
 
834
            //  Daemon Mode Only
-
 
835
            //  Examine the build candidates and verify that a new version number can be calculated for each
-
 
836
            //  version that we need to build.
-
 
837
            //
-
 
838
            //  If we can't generate a new version number, then this is considered to be a build failure
-
 
839
            //  The package will be excluded and the user will be emailed
-
 
840
            //
-
 
841
            ArrayList<Package> testVersions = new ArrayList<Package>();
-
 
842
            testVersions.addAll(mPackageCollectionWip);
-
 
843
            testVersions.addAll(mPackageCollectionRipple);
-
 
844
            testVersions.addAll(mPackageCollectionTest);
-
 
845
            
-
 
846
            for (Iterator<Package> it = mPackageCollection.iterator(); it.hasNext(); )
-
 
847
            {
-
 
848
                Package p = it.next();
-
 
849
                if (p.mBuildFile >= 0 &&  p.mBuildReason != null) {
-
 
850
                    testVersions.add(p);
-
 
851
                }
-
 
852
            }
-
 
853
 
-
 
854
            mLogger.error("Determine new version numbers");
-
 
855
            for (Iterator<Package> it = testVersions.iterator(); it.hasNext(); )
-
 
856
            {
-
 
857
                Package p = it.next();
-
 
858
 
-
 
859
                if ( p.mBuildFile >= 0 )
-
 
860
                {
-
 
861
                    int pvApplied = p.applyPV(mReleaseManager);
-
 
862
 
-
 
863
                    if ( pvApplied == 1 )
-
 
864
                    {
-
 
865
                        // max 50 chars
-
 
866
                        rippleBuildExclude(p, p.mId, "Package has non standard versioning", -5);
-
 
867
                    }
-
 
868
                    else if ( pvApplied == 2 )
-
 
869
                    {
-
 
870
                        // max 50 chars
-
 
871
                        rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", -5);
-
 
872
                    }
-
 
873
                    else if ( pvApplied == 3 )
-
 
874
                    {
-
 
875
                        // max 50 chars
-
 
876
                        rippleBuildExclude(p, p.mId, "Package has invalid change type", -5);
-
 
877
                    }
-
 
878
                }
-
 
879
            }
-
 
880
            
-
 
881
        }
833
        }
882
        else
834
        else
883
        {
835
        {
884
            // escrow reporting only
836
            // escrow reporting only
885
            // Report packages that are not reproducible
837
            // Report packages that are not reproducible
Line 1039... Line 991...
1039
                    // Do not have a plan
991
                    // Do not have a plan
1040
                    // May have tests requests
992
                    // May have tests requests
1041
                    mLogger.error("Use NO plan");
993
                    mLogger.error("Use NO plan");
1042
                }
994
                }
1043
                
995
                
1044
                //  Now have an mBuildOrder
-
 
1045
                //  Mark the first package in the build order as the one to be built
-
 
1046
                //
996
                //
1047
                //  
997
                //  Now have a build order
-
 
998
                //  Allocate new version numbers
-
 
999
                //      Examine packages with a buidLevel of zero
-
 
1000
                //  If we fail all of them then we can't build anything
1048
                //  
1001
                //
-
 
1002
                mLogger.error("Determine new version numbers");
1049
                Package build = ReleaseManager.NULL_PACKAGE;
1003
                Package build = ReleaseManager.NULL_PACKAGE;
-
 
1004
                for (Iterator<PlannedPackage> it = mBuildOrder.iterator(); it.hasNext(); )
-
 
1005
                {
-
 
1006
                    PlannedPackage pkg = it.next();
-
 
1007
                    if (pkg.mBuildLevel != 0)
-
 
1008
                    {
-
 
1009
                        continue;
-
 
1010
                    }
-
 
1011
                    
-
 
1012
                    //
-
 
1013
                    //  Attempt to allocate a new version number
-
 
1014
                    //  If we can't generate a new version number, then this is considered to be a build failure
-
 
1015
                    //  The package will be excluded and the user will be emailed
-
 
1016
                    //
-
 
1017
 
-
 
1018
 
-
 
1019
                    Package p = pkg.mPkg;
-
 
1020
 
-
 
1021
                    int pvApplied = p.applyPV(mReleaseManager);
-
 
1022
 
-
 
1023
                    if ( pvApplied == 0)
-
 
1024
                    {
-
 
1025
                        build = p;
-
 
1026
                        break;
-
 
1027
                    }
-
 
1028
                    else if ( pvApplied == 1 )
-
 
1029
                    {
-
 
1030
                        // max 50 chars
-
 
1031
                        rippleBuildExclude(p, p.mId, "Package has non standard versioning", -12);
-
 
1032
                    }
-
 
1033
                    else if ( pvApplied == 2 )
-
 
1034
                    {
-
 
1035
                        // max 50 chars
-
 
1036
                        rippleBuildExclude(p, p.mId, "Package has reached ripple field limitations", -12);
-
 
1037
                    }
-
 
1038
                    else if ( pvApplied == 3 )
-
 
1039
                    {
-
 
1040
                        // max 50 chars
-
 
1041
                        rippleBuildExclude(p, p.mId, "Package has invalid change type", -12);
-
 
1042
                    }
-
 
1043
                    else
-
 
1044
                    {
-
 
1045
                        // max 50 chars
-
 
1046
                        // Bad programming - should not get here
-
 
1047
                        rippleBuildExclude(p, p.mId, "Unable to calculate next version", -12);
-
 
1048
                    }
-
 
1049
                }
-
 
1050
                
-
 
1051
                
-
 
1052
                //  Now have an mBuildOrder
-
 
1053
                //  Mark the selected package in the build order as the one to be built
-
 
1054
                //  May need to process its it a bit more
-
 
1055
                //  
1050
                if (!mBuildOrder.isEmpty()) {
1056
                if (!mBuildOrder.isEmpty()) {
1051
                    build = mBuildOrder.get(0).mPkg;
-
 
1052
                    build.mBuildFile = 1;
1057
                    build.mBuildFile = 1;
1053
                    
1058
                    
1054
                    if ( build.mForcedRippleInstruction > 0 )
1059
                    if ( build.mForcedRippleInstruction > 0 )
1055
                    {
1060
                    {
1056
                        mReleaseManager.markDaemonInstCompleted( build.mForcedRippleInstruction );
1061
                        mReleaseManager.markDaemonInstCompleted( build.mForcedRippleInstruction );
Line 1165... Line 1170...
1165
                                 
1170
                                 
1166
                                 if (!found)
1171
                                 if (!found)
1167
                                 {
1172
                                 {
1168
                                     BuildExclusion buildExclusion = new BuildExclusion(pkg.mId, p.mId, null, p.mTestBuildInstruction);
1173
                                     BuildExclusion buildExclusion = new BuildExclusion(pkg.mId, p.mId, null, p.mTestBuildInstruction);
1169
                                     it.add(buildExclusion);
1174
                                     it.add(buildExclusion);
1170
                                     mLogger.info("Indirectly Excluded Package {}", pkg.mAlias);  
1175
                                     mLogger.info("Indirectly Excluded Package {}", pkg.mAlias);
-
 
1176
                                     pkg.mBuildFile = -5; 
1171
 
1177
 
1172
                                     ArrayList<Package> usedBy = usedByAnyPackages(pkg, mPackageCollectionAll );
1178
                                     ArrayList<Package> usedBy = usedByAnyPackages(pkg, mPackageCollectionAll );
1173
                                     toExclude.addAll(usedBy);
1179
                                     toExclude.addAll(usedBy);
1174
                                 }
1180
                                 }
1175
                             }
1181
                             }
1176
                         }
1182
                         }
1177
                     }
1183
                     }
1178
                 }
1184
                 }
-
 
1185
                 
-
 
1186
                 //
-
 
1187
                 //  Examine the build order and 'delete' entries with a -ve mBuildFile
-
 
1188
                 //  These will be the product of pvApply errors and the packages that depend on them
-
 
1189
                 
-
 
1190
                 for (Iterator<PlannedPackage> it = mBuildOrder.iterator(); it.hasNext(); )
-
 
1191
                 {
-
 
1192
                     PlannedPackage pkg = it.next();
-
 
1193
                     if (pkg.mPkg.mBuildFile < 0)
-
 
1194
                     {
-
 
1195
                         it.remove();
-
 
1196
                         mLogger.error("Purge mBuildOrder {}", pkg.mPkg);
-
 
1197
                     }
-
 
1198
                 }
-
 
1199
                 
-
 
1200
 
1179
                
1201
                
1180
                //
1202
                //
1181
                //  To fit in with the old algorithm ( ie: could be improved )
1203
                //  To fit in with the old algorithm ( ie: could be improved )
1182
                //  Insert marks into all packages
1204
                //  Insert marks into all packages
1183
                //  Not sure exactly why - Its used in the generation of the ant build file
1205
                //  Not sure exactly why - Its used in the generation of the ant build file
Line 1471... Line 1493...
1471
            //  Need (would like to) build stuff
1493
            //  Need (would like to) build stuff
1472
            //  Determine the packages that we need to build and the time that it will take
1494
            //  Determine the packages that we need to build and the time that it will take
1473
            //
1495
            //
1474
            if ( !toBuild.isEmpty() )
1496
            if ( !toBuild.isEmpty() )
1475
            {
1497
            {
1476
                 
1498
                //  Locate the packages that we need to build
-
 
1499
                //  The build order cannot be correctly determined at this time
1477
                //  Need to add elements to the end of the list while processing
1500
                //      Need to add elements to the end of the list while processing
1478
                //  Sum the buildTimes of the packages that we add to the list
1501
                //      Sum the buildTimes of the packages that we add to the list
1479
                while ( ! toBuild.isEmpty())
1502
                while ( ! toBuild.isEmpty())
1480
                {
1503
                {
1481
                    PlannedPackage pkg = toBuild.remove(0);
1504
                    PlannedPackage pkg = toBuild.remove(0);
1482
                    mLogger.error("Proccessing {}", pkg.mPkg.mAlias);                       
-
 
1483
                    
1505
                    
1484
                    if (pkg.mBuildLevel > 400 ) {
1506
                    if (pkg.mBuildLevel > 400 ) {
1485
                        mLogger.error("Circular dependency detected - not handled well");
1507
                        mLogger.error("Circular dependency detected - not handled well");
1486
                        break;
1508
                        break;
1487
                    }
1509
                    }
1488
                    
1510
                    
1489
                    if ( ! pkg.mPkg.mCheckedCircularDependency )
1511
                    if ( ! pkg.mPkg.mCheckedCircularDependency )
1490
                    {
1512
                    {
1491
                        ripplePlan.add(pkg);
1513
                        ripplePlan.add(pkg);
1492
                        results.planTime += pkg.mPkg.mBuildTime;
1514
                        results.planTime += pkg.mPkg.mBuildTime;
1493
                        
-
 
1494
                        pkg.mPkg.mCheckedCircularDependency = true;
1515
                        pkg.mPkg.mCheckedCircularDependency = true;
1495
                        
1516
                        
1496
                        ArrayList<PlannedPackage> usedBy = usedByPackages(pkg, results.planCollection);
1517
                        ArrayList<PlannedPackage> usedBy = usedByPackages(pkg, results.planCollection);
1497
                        toBuild.addAll(usedBy);
1518
                        toBuild.addAll(usedBy);
1498
                    }
1519
                    }
1499
                    
-
 
1500
                }
1520
                }
1501
                
1521
                
1502
                //
1522
                //
1503
                //  Now we have a collection of packages to build
1523
                //  Now we have a collection of packages to build ( and only the packages to build)
1504
                //  Need to determine the order in which it can be done and assign build levels
1524
                //  Need to determine the order in which it can be done and assign build levels
-
 
1525
                //  Basically:
-
 
1526
                //      Scan the collection looking for any package whose dependencies do not exist in the collection
-
 
1527
                //      or they have been allocated a build level.
-
 
1528
                //
-
 
1529
                //      Need to do this in waves so that we can correctly determine the build level.
-
 
1530
                //  
1505
                //
1531
                //
1506
                for (Iterator<PlannedPackage> it = ripplePlan.iterator(); it.hasNext(); )
1532
                for (Iterator<PlannedPackage> it = ripplePlan.iterator(); it.hasNext(); )
1507
                {
1533
                {
1508
                    PlannedPackage p = it.next();
1534
                    PlannedPackage p = it.next();
1509
                    p.mPkg.mCheckedCircularDependency = true;
1535
                    p.mPkg.mCheckedCircularDependency = true;
Line 1913... Line 1939...
1913
     */
1939
     */
1914
    private void rippleBuildExclude(Package p, int rootPvId, String rootCause, int reason )
1940
    private void rippleBuildExclude(Package p, int rootPvId, String rootCause, int reason )
1915
    {
1941
    {
1916
        mLogger.debug("rippleBuildExclude");
1942
        mLogger.debug("rippleBuildExclude");
1917
     
1943
     
1918
        if ( p.mBuildFile == 0 || p.mBuildFile == 1 )
1944
        if ( p.mBuildFile >= 0 )
1919
        {
1945
        {
1920
            p.mBuildFile = reason;
1946
            p.mBuildFile = reason;
1921
            mLogger.info("rippleBuildExclude set mBuildFile to -5 for package {}", p.mAlias );
1947
            mLogger.info("rippleBuildExclude set mBuildFile to {} for package {}", reason, p.mAlias );
1922
            
1948
            
1923
            //  Scan the complete collection looking for a matching item
1949
            //  Scan the complete collection looking for a matching item
1924
            //  If found then assume that this error is a a PlanError that is still present
1950
            //  If found then assume that this error is a a PlanError that is still present
1925
            //      Mark it as Processed to indicate that its still present
1951
            //      Mark it as Processed to indicate that its still present
1926
            //  If found, process it, else add it (unprocessed)
1952
            //  If found, process it, else add it (unprocessed)