Subversion Repositories DevTools

Rev

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

Rev 7184 Rev 7185
Line 500... Line 500...
500
    }
500
    }
501
 
501
 
502
    /**
502
    /**
503
     * Constructor for unit test purposes
503
     * Constructor for unit test purposes
504
     *  Will invoke applyPV and save the results for the UTF framework
504
     *  Will invoke applyPV and save the results for the UTF framework
-
 
505
     * @param proj Package Suffix ( or Project extension)
-
 
506
     * @param isaTest - True - Generate testRequest
505
     */
507
     */
506
    public Package(ReleaseManager rm, String version, int majorLimit, int minorLimit, int patchLimit, int buildNumberLimit)
508
    public Package(ReleaseManager rm, String version, String proj, boolean isaTest, int majorLimit, int minorLimit, int patchLimit, int buildNumberLimit)
507
    {
509
    {
508
        mId = -1;
510
        mId = -1;
509
        mRippleField.setLimit();
511
        mRippleField.setLimit();
510
        mVersion = version;
512
        mVersion = version;
-
 
513
        mExtension = proj;
511
        mMajorLimit = majorLimit;
514
        mMajorLimit = majorLimit;
512
        mMinorLimit = minorLimit;
515
        mMinorLimit = minorLimit;
513
        mPatchLimit = patchLimit;
516
        mPatchLimit = patchLimit;
514
        mBuildLimit = buildNumberLimit;
517
        mBuildLimit = buildNumberLimit;
515
 
518
 
516
        if (version.endsWith(".cots"))
519
        if (isaTest)
-
 
520
        {
-
 
521
        	mTestBuildInstruction = 77;
-
 
522
        }
-
 
523
        
-
 
524
        if (proj.compareTo(".cots") == 0 || proj.compareTo(".tools") == 0 )
517
        {
525
        {
518
            mExtension = ".cots";
-
 
519
            mVersion = version.substring(0, version.length() - 5);
-
 
520
            mChangeType.setMajor(false);
526
            mChangeType.setMajor(false);
521
            mChangeType.setMinor(false);
527
            mChangeType.setMinor(false);
522
            mChangeType.setPatch(true);
528
            mChangeType.setPatch(true);
523
            mRippleField.setBuild();
529
            mRippleField.setBuild();
524
        }
530
        }
525
 
531
  
526
        try
532
        try
527
        {
533
        {
528
            mId = applyPV(rm);
534
            mId = applyPV(rm);
529
        } catch (Exception e)
535
        } catch (Exception e)
530
        {
536
        {
Line 781... Line 787...
781
 
787
 
782
    /**
788
    /**
783
     * Applies the required version number change. Will calculate mNextVersion
789
     * Applies the required version number change. Will calculate mNextVersion
784
     * while not changing mVersion.
790
     * while not changing mVersion.
785
     * 
791
     * 
-
 
792
     * Special cases
-
 
793
     * 	Cots packages - Can ripple if they have a patchBuild number suffix
-
 
794
     *  Test Builds - do as 99.99.99000
-
 
795
     *  Test Builds of Cots - Can do if they have a patchBuild suffix - do as .99000.cots
-
 
796
     * 
786
     * @param releaseManager    Release Manager instance to work against
797
     * @param releaseManager    Release Manager instance to work against
787
     * 
798
     * 
788
     * @return 0 : success
799
     * @return 0 : success
789
     *         1 : cannot work with non standard versioning
800
     *         1 : cannot work with non standard versioning
790
     *         2 : ripple field limitations prevent a ripple build
801
     *         2 : ripple field limitations prevent a ripple build
Line 795... Line 806...
795
    int applyPV(ReleaseManager releaseManager) throws Exception
806
    int applyPV(ReleaseManager releaseManager) throws Exception
796
    {
807
    {
797
        String logInfo = "applyPV," + mName;
808
        String logInfo = "applyPV," + mName;
798
        String changeType = "";
809
        String changeType = "";
799
        mLogger.warn("applyPV on Package {}", mName);
810
        mLogger.warn("applyPV on Package {}", mName);
-
 
811
        boolean isaCots = mExtension.compareTo(".cots") == 0 || mExtension.compareTo(".tools") == 0;
800
        
812
        
801
        //
813
        //
802
        //  This method used to actually perform the version change
814
        //  This method used to actually perform the version change
803
        //  Now it just calculates the potential value
815
        //  Now it just calculates the potential value
804
        //  Must not alter mVersion as it will be used if the package is not selected to be built,
816
        //  Must not alter mVersion as it will be used if the package is not selected to be built,
Line 829... Line 841...
829
        if (mTestBuildInstruction == 0)
841
        if (mTestBuildInstruction == 0)
830
        {
842
        {
831
            mRequiresSourceControlInteraction = true;
843
            mRequiresSourceControlInteraction = true;
832
        }
844
        }
833
        
845
        
834
        //	Force test builds to use a sensible version number
846
        //	Force test builds of non-COTS packages to use a sensible version number
835
        if (mTestBuildInstruction > 0 )
847
        if (mTestBuildInstruction > 0 && !isaCots )
836
        {
848
        {
837
        	mChangeType.resetData();		// Resolve conflict via build numbers
849
        	mChangeType.resetData();		// Resolve conflict via build numbers
838
        	mRippleField.setBuild();
850
        	mRippleField.setBuild();
839
        	mVersion = "99.99.98999";		// Such that rippling build number will goto 99.99.99000
851
        	mVersion = "99.99.98999";		// Such that rippling build number will goto 99.99.99000
840
        }
852
        }
Line 873... Line 885...
873
        //
885
        //
874
        if (mPrevVersion != null)
886
        if (mPrevVersion != null)
875
        {
887
        {
876
        	mVersion = mPrevVersion;
888
        	mVersion = mPrevVersion;
877
        }
889
        }
-
 
890
        
878
        String[] field = mVersion.split("\\D");
891
        String[] field = mVersion.split("\\D");
879
        String nonStandardCotsVersion = "";
892
        String nonStandardCotsVersion = "";
880
        logInfo += ", Prev:" + mVersion;
893
        logInfo += ", Prev:" + mVersion;
881
 
894
 
882
        if (field.length == 3)
895
        if (field.length == 3)
Line 886... Line 899...
886
            patch.value = Integer.parseInt(field[2]);
899
            patch.value = Integer.parseInt(field[2]);
887
        } 
900
        } 
888
        else
901
        else
889
        {
902
        {
890
            //
903
            //
891
            // Can ripple a .cots package under very controlled conditions
904
            // Can ripple a .cots/.tools package under very controlled conditions
892
            // Its ends with a .patchBuild field
905
            // Its ends with a .patchBuild field
893
            // Package is marked as ripple via build number
906
            // Package is marked as ripple via build number
894
            // Change type of Major and Minor are not allowed
907
            // Change type of Major and Minor are not allowed
895
            //
908
            //
896
            if (!mChangeType.mMajor && !mChangeType.mMinor && mRippleField.mBuild && mExtension.compareTo(".cots") == 0 && field.length > 0)
909
            if (isaCots && !mChangeType.mMajor && !mChangeType.mMinor && mRippleField.mBuild && field.length > 0)
897
            {
910
            {
898
                // allow and work with (ripple build) versions a.b.c.d....xxxx
911
                // allow and work with (ripple build) versions a.b.c.d....xxxx
899
                // where xxxx.length > 3
912
                // where xxxx.length > 3
900
                String patchStr = field[field.length - 1];
913
                String patchStr = field[field.length - 1];
901
                int patchLen = patchStr.length();
914
                int patchLen = patchStr.length();
Line 909... Line 922...
909
                }
922
                }
910
            }
923
            }
911
 
924
 
912
            if (nonStandardCotsVersion.length() == 0)
925
            if (nonStandardCotsVersion.length() == 0)
913
            {
926
            {
914
                // cannot work with non standard versioning
927
                // cannot work with non standard version number
915
                mLogger.warn("applyPV cannot work with non standard versioning");
928
                mLogger.warn("applyPV cannot work with non standard versioning");
916
                mLogger.info("applyPv returned 1");
929
                mLogger.info("applyPv returned 1");
917
                return 1;
930
                return 1;
918
            }
931
            }
919
        }
932
        }
Line 921... Line 934...
921
        if (nonStandardCotsVersion.length() == 0 && patch.value < 1000 && field[2].substring(0, 1).compareTo("0") != 0)
934
        if (nonStandardCotsVersion.length() == 0 && patch.value < 1000 && field[2].substring(0, 1).compareTo("0") != 0)
922
        {
935
        {
923
            mLogger.info("applyPV accomodate old style Version of the form 1.0.1");
936
            mLogger.info("applyPV accomodate old style Version of the form 1.0.1");
924
            patch.value = patch.value * 1000;
937
            patch.value = patch.value * 1000;
925
        }
938
        }
-
 
939
        
-
 
940
        //	Force test builds of COTS packages to use a sensible version number
-
 
941
        if (mTestBuildInstruction > 0 )
-
 
942
        {
-
 
943
        	mChangeType.resetData();		// Resolve conflict via build numbers
-
 
944
        	mRippleField.setBuild();
-
 
945
        	patch.value = 98999;			// Such that rippling build number will goto xxxx.99000
-
 
946
        }
926
 
947
 
927
        // mChangeType overrides mRippleField
948
        // mChangeType overrides mRippleField
928
        do
949
        do
929
        {
950
        {
930
            if (mChangeType.mMajor)
951
            if (mChangeType.mMajor)
Line 1373... Line 1394...
1373
     * Returns true if the package is a part of a circular dependency within the provided collection
1394
     * Returns true if the package is a part of a circular dependency within the provided collection
1374
     * 
1395
     * 
1375
     * If the package depends on a package with a circular dependency then the function
1396
     * If the package depends on a package with a circular dependency then the function
1376
     * will return false.
1397
     * will return false.
1377
     */
1398
     */
1378
    public boolean hasCircularDependency(ArrayList<Package> packageCollection)
1399
    public boolean hasCircularDependency(PackageCollection packageCollection)
1379
    {
1400
    {
1380
        mLogger.debug("hasCircularDependency: {}", mAlias);
1401
        mLogger.debug("hasCircularDependency: {}", mAlias);
1381
        boolean retVal = detectCircularDependency(mAlias, packageCollection, null);
1402
        boolean retVal = detectCircularDependency(mAlias, packageCollection, null);
1382
        mLogger.debug("hasCircularDependency returned {} ", retVal);
1403
        mLogger.debug("hasCircularDependency returned {} ", retVal);
1383
        return retVal;
1404
        return retVal;
Line 1385... Line 1406...
1385
    
1406
    
1386
    /** Reset the circular dependency testing information
1407
    /** Reset the circular dependency testing information
1387
     * 
1408
     * 
1388
     * @param packageCollection - Collection of packages to process
1409
     * @param packageCollection - Collection of packages to process
1389
     */
1410
     */
1390
    public static void resetCircularDependency(ArrayList<Package> packageCollection)
1411
    public static void resetCircularDependency(PackageCollection packageCollection)
1391
    {
1412
    {
1392
        for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
1413
        for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
1393
        {
1414
        {
1394
            Package p = it.next();
1415
            Package p = it.next();
1395
            p.mCheckedCircularDependency = false;
1416
            p.mCheckedCircularDependency = false;
Line 1409... Line 1430...
1409
     * 
1430
     * 
1410
     *  Assumes that the caller will walk ALL packages and flag those with a circular
1431
     *  Assumes that the caller will walk ALL packages and flag those with a circular
1411
     *  dependence AND those that depend on that package.
1432
     *  dependence AND those that depend on that package.
1412
     * 
1433
     * 
1413
     */
1434
     */
1414
    private boolean detectCircularDependency(String alias, ArrayList<Package> packageCollection, Package parent)
1435
    private boolean detectCircularDependency(String alias, PackageCollection packageCollection, Package parent)
1415
    {
1436
    {
1416
        mLogger.debug("detectCircularDependency");
1437
        mLogger.debug("detectCircularDependency");
1417
        boolean retVal = false;
1438
        boolean retVal = false;
1418
        
1439
        
1419
        // if this package has yet to be checked for circular dependency
1440
        // if this package has yet to be checked for circular dependency
Line 1439... Line 1460...
1439
                
1460
                
1440
                // Recurse down the dependencies and sub dependencies
1461
                // Recurse down the dependencies and sub dependencies
1441
                for (Iterator<PkgDependency> it2 = mDependencyCollection.iterator(); it2.hasNext();)
1462
                for (Iterator<PkgDependency> it2 = mDependencyCollection.iterator(); it2.hasNext();)
1442
                {
1463
                {
1443
                    PkgDependency depEntry = it2.next();
1464
                    PkgDependency depEntry = it2.next();
1444
                    
-
 
1445
                    // Scan the collection looking for the specified package alias
-
 
1446
                    for (Iterator<Package> it = packageCollection.iterator(); it.hasNext();)
1465
                    Package depPackage = packageCollection.contains(depEntry.alias);
1447
                    {
-
 
1448
                        Package dependency = it.next();
1466
                    if ( depPackage != null ) {
1449
 
-
 
1450
                        if ( dependency.mAlias.compareTo( depEntry.alias ) == 0 )
-
 
1451
                        {
-
 
1452
                            dependency.detectCircularDependency(alias, packageCollection, this);
1467
                    	depPackage.detectCircularDependency(alias, packageCollection, this);
1453
                            break;
-
 
1454
                        }
-
 
1455
                    }
1468
                    }
1456
                }
1469
                }
1457
                
1470
                
1458
                if (mBreadCrumb == 2)
1471
                if (mBreadCrumb == 2)
1459
                {
1472
                {
Line 1490... Line 1503...
1490
    }
1503
    }
1491
 
1504
 
1492
    /** Reset the processed flag on a collection of packages
1505
    /** Reset the processed flag on a collection of packages
1493
     * 
1506
     * 
1494
     */
1507
     */
1495
    public static void resetProcessed (ArrayList<Package> al)
1508
    public static void resetProcessed (PackageCollection packageCollection)
1496
    {
1509
    {
1497
        for (Iterator<Package> it = al.iterator(); it.hasNext(); )
1510
        for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
1498
        {
1511
        {
1499
            Package p = it.next();
1512
            Package p = it.next();
1500
            p.mIsProcessed = false;
1513
            p.mIsProcessed = false;
1501
            p.mProcessed = false;
1514
            p.mProcessed = false;
1502
            if (p.mBuildFile > 0)
1515
            if (p.mBuildFile > 0)