Subversion Repositories DevTools

Rev

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

Rev 7358 Rev 7489
Line 15... Line 15...
15
 
15
 
16
import java.io.BufferedReader;
16
import java.io.BufferedReader;
17
import java.io.DataInputStream;
17
import java.io.DataInputStream;
18
import java.io.File;
18
import java.io.File;
19
import java.io.FileInputStream;
19
import java.io.FileInputStream;
-
 
20
import java.io.IOException;
20
import java.io.InputStreamReader;
21
import java.io.InputStreamReader;
21
import java.sql.SQLException;
22
import java.sql.SQLException;
22
import java.util.Iterator;
23
import java.util.Iterator;
23
 
24
 
24
import org.slf4j.Logger;
25
import org.slf4j.Logger;
Line 348... Line 349...
348
                                    //    Insert package metrics into Release Manager
349
                                    //    Insert package metrics into Release Manager
349
                                    //        Metrics have been placed in a file in a format suitable for RM
350
                                    //        Metrics have been placed in a file in a format suitable for RM
350
                                    //
351
                                    //
351
                                    mReporting.errMsg = "Error publishing Package Metrics";     // Max 50 Characters
352
                                    mReporting.errMsg = "Error publishing Package Metrics";     // Max 50 Characters
352
                                    mPhase.setPhase("Insert Metrics");
353
                                    mPhase.setPhase("Insert Metrics");
353
                                    FileInputStream abtmetrics = new FileInputStream( String.valueOf(mRtagId) + "abtmetrics.txt" );
354
                                    mAbtMetricsFile = new File( String.valueOf(mRtagId) + "abtmetrics.txt");
-
 
355
                                    FileInputStream abtmetrics = new FileInputStream( mAbtMetricsFile);
354
                                    DataInputStream din = new DataInputStream( abtmetrics );
356
                                    DataInputStream din = new DataInputStream( abtmetrics );
355
                                    InputStreamReader isr = new InputStreamReader( din );
357
                                    InputStreamReader isr = new InputStreamReader( din );
356
                                    BufferedReader br = new BufferedReader( isr );
358
                                    BufferedReader br = new BufferedReader( isr );
357
                                    String metrics = br.readLine();
359
                                    String metrics = br.readLine();
358
                                    mLogger.warn( "execute read metrics string {}", metrics );
360
                                    mLogger.warn( "execute read metrics string {}", metrics );
Line 580... Line 582...
580
 
582
 
581
                // Quick Test to validate the provided Version Control tag/label
583
                // Quick Test to validate the provided Version Control tag/label
582
                mPhase.setPhase("Validate Version Tag");
584
                mPhase.setPhase("Validate Version Tag");
583
                if ( deliverChange("AbtTestPath", true, false) )
585
                if ( deliverChange("AbtTestPath", true, false) )
584
                {
586
                {
-
 
587
                    // Master will extract the package and determine the buildInfo before
-
 
588
                    // starting up slaves
-
 
589
                    //
-
 
590
                    mLogger.warn("Build Package {}_{}", mReporting.packageName, mReporting.packageVersion);
-
 
591
 
-
 
592
                    mPhase.setPhase("Setup View for build");
-
 
593
                    deliverChange("AbtSetUp", true, false);
-
 
594
 
-
 
595
                    if ( !mMasterBuildFile.isaDummy() ) {
-
 
596
                        mPhase.setPhase("Generate buildInfo");
-
 
597
                        deliverChange("AbtBuildInfo", false, false);
-
 
598
                        processBuildInfo();
-
 
599
                    }
585
 
600
 
586
                    //---------------------------------------------------------------
601
                    //---------------------------------------------------------------
587
                    //    Notify all slaves that there is work to be done
602
                    //    Notify all slaves that there is work to be done
588
                    //      This is done by publishing a buildfile for them to consume
603
                    //      This is done by publishing a buildfile for them to consume
589
                    //      A NonGeneric build will be done with a real build file on all machines
604
                    //      A NonGeneric build will be done with a real build file on all machines
Line 633... Line 648...
633
                if ( mMasterBuildFile.state == BuildFileState.Dummy)
648
                if ( mMasterBuildFile.state == BuildFileState.Dummy)
634
                {
649
                {
635
                    // no build requirement, so let things settle
650
                    // no build requirement, so let things settle
636
                    mLogger.warn("run no build requirement, so let things settle");
651
                    mLogger.warn("run no build requirement, so let things settle");
637
                    mLastBuildWasBenign = true;
652
                    mLastBuildWasBenign = true;
-
 
653
                    
-
 
654
                    // If there are are no packages that are in error, then we can snapshot the
-
 
655
                    // Release as all packages will be built against each other
-
 
656
                    mReleaseManager.takeSnapshot( mRtagId );
638
                }        
657
                }        
639
            }
658
            }
640
            //---------------------------------------------------------------
659
            //---------------------------------------------------------------
641
            //    Build loop exception handling (only)
660
            //    Build loop exception handling (only)
642
            //
661
            //
Line 728... Line 747...
728
            mLogger.error("Exception in clearCurrentPackageBeingBuilt: {}", e.getMessage());
747
            mLogger.error("Exception in clearCurrentPackageBeingBuilt: {}", e.getMessage());
729
        }
748
        }
730
        mPhase.setPhase("Exit Thread");
749
        mPhase.setPhase("Exit Thread");
731
    }
750
    }
732
 
751
 
-
 
752
    /** Process the generated buildInfo and determine which build machines need to be used
-
 
753
     *  in the current build.
-
 
754
     *  
-
 
755
     *  ***********************************************************************
-
 
756
     *  This work has been interrupted
-
 
757
     *  It is incomplete
-
 
758
     *  Need to determine the machines that we NEED to build the package on
-
 
759
     *  Only activate those machines, not all of the slaves
-
 
760
     *  This is only a first step. The next step is to allocate a slave from a pool of
-
 
761
     *  suitable machines.
-
 
762
     *  ***********************************************************************
-
 
763
     *  
-
 
764
     *  
-
 
765
     * @throws IOException 
-
 
766
     */
-
 
767
    private void processBuildInfo() throws IOException {
-
 
768
        mBuildInfoFile = new File (mRtagId + "abtBuildInfo.properties");
-
 
769
        if ( mBuildInfoFile.exists() )
-
 
770
        {
-
 
771
            BuildInfo bi = new BuildInfo(mBuildInfoFile);
-
 
772
            mLogger.warn("Can build for: {}", bi.mPlatforms);
-
 
773
            mLogger.warn("Built for: {}", bi.mBuildPlatforms);
-
 
774
        }
-
 
775
        else
-
 
776
        {
-
 
777
            mLogger.error("No BuildInfo file. {}", mBuildInfoFile);
-
 
778
            mErrorReported = true;
-
 
779
        }
-
 
780
    }
-
 
781
 
733
    /**
782
    /**
734
     * Locate the <rtagId>abtBuildInfo.properties file and insert data into Release Manager
783
     * Locate the <rtagId>abtBuildInfo.properties file and insert data into Release Manager
735
     * Insert mPlatforms and mBuildPlatforms
784
     * Insert mPlatforms and mBuildPlatforms
-
 
785
     * We can only do this after a new package version has been created.
736
     * @param bIsaTestBuild - True. Is a test build
786
     * @param bIsaTestBuild - True. Is a test build
737
     * @throws Exception 
787
     * @throws Exception 
738
     */
788
     */
739
    private void insertBuildInfo(boolean bIsaTestBuild) throws Exception {
789
    private void insertBuildInfo(boolean bIsaTestBuild) throws Exception {
740
 
790
 
741
        File buildInfoFile = new File (mRtagId + "abtBuildInfo.properties");
791
        mBuildInfoFile = new File (mRtagId + "abtBuildInfo.properties");
742
        if ( buildInfoFile.exists() )
792
        if ( mBuildInfoFile.exists() )
743
        {
793
        {
744
            BuildInfo bi = new BuildInfo(buildInfoFile);
794
            BuildInfo bi = new BuildInfo(mBuildInfoFile);
745
            mLogger.warn("Can build for: {}", bi.mPlatforms);
795
            mLogger.warn("Can build for: {}", bi.mPlatforms);
746
            mLogger.warn("Built for: {}", bi.mBuildPlatforms);
796
            mLogger.warn("Built for: {}", bi.mBuildPlatforms);
747
            mReleaseManager.insertBuildInfo(bIsaTestBuild, mReporting, bi);
797
            mReleaseManager.insertBuildInfo(bIsaTestBuild, mReporting, bi);
748
        }
798
        }
749
        else
799
        else
750
        {
800
        {
751
            mLogger.warn("No BuildInfo file. {}", buildInfoFile);
801
            mLogger.warn("No BuildInfo file. {}", mBuildInfoFile);
752
        }
802
        }
753
    }
803
    }
754
 
804
 
755
    /**   Delete a specified version of a package from dpkg_archive
805
    /**   Delete a specified version of a package from dpkg_archive
756
     *    Used during error processing to cleanup packages that did not build correctly
806
     *    Used during error processing to cleanup packages that did not build correctly