Subversion Repositories DevTools

Rev

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

Rev 7333 Rev 7489
Line 4775... Line 4775...
4775
                disconnect();
4775
                disconnect();
4776
            }
4776
            }
4777
        }        
4777
        }        
4778
    }
4778
    }
4779
 
4779
 
-
 
4780
    /** Potentially take a snapshot of the current release
-
 
4781
     *  Assumes that the last build-plan was an empty plan. ie: Nothing to build
-
 
4782
     *  Will check that there are no build errors
-
 
4783
     *  It will ignore packages that cannot be built as they have no BuildStandard
-
 
4784
     *  
-
 
4785
     * @param mRtagId   - Release to process
-
 
4786
     * @throws Exception 
-
 
4787
     * @throws SQLException 
-
 
4788
     */
-
 
4789
    public void takeSnapshot(int mRtagId) throws SQLException, Exception {
-
 
4790
        int buildErrors = 0;
-
 
4791
        try
-
 
4792
        {
-
 
4793
            connect();
-
 
4794
            
-
 
4795
            //  Determine if there are any packages that have been excluded from the build
-
 
4796
            //
-
 
4797
            mLogger.debug("takeSnapshot {}", mRtagId);
-
 
4798
            PreparedStatement stmt0 = mConnection.prepareStatement(
-
 
4799
                    "select count(*) as count from do_not_ripple dnr, package_build_info pbi where rtag_id = ? and dnr.pv_id = pbi.pv_id");
-
 
4800
            stmt0.setFetchSize(1000);
-
 
4801
            stmt0.setInt(1, mRtagId);
-
 
4802
 
-
 
4803
            RmResultSet rset = new RmResultSet(stmt0.executeQuery(),"queryBuildExclusions");
-
 
4804
 
-
 
4805
            if ( rset.next() )             {
-
 
4806
                buildErrors = rset.mustGetKeyInt("count");
-
 
4807
            } else {
-
 
4808
                buildErrors = 1;
-
 
4809
            }
-
 
4810
 
-
 
4811
            rset.close();
-
 
4812
            stmt0.close();
-
 
4813
            
-
 
4814
            if (buildErrors == 0 )
-
 
4815
            {
-
 
4816
                //  No Build errors
-
 
4817
                //  Take a snapshot, but not if its the same as the last one
-
 
4818
                //
-
 
4819
                CallableStatement stmt1 = mConnection.prepareCall( "call PK_RELEASE.TAKE_SNAPSHOT(?,?,?,?)" );
-
 
4820
                stmt1.setInt( 1, mRtagId );
-
 
4821
                stmt1.setInt( 2, 0 );
-
 
4822
                stmt1.setInt( 3, 3768 );               // USER ID - buildadm ( Yes I know its ugly )
-
 
4823
                stmt1.registerOutParameter( 4, Types.INTEGER);
-
 
4824
                stmt1.executeUpdate();
-
 
4825
                int newRtagId = stmt1.getInt( 4 );
-
 
4826
                stmt1.close();
-
 
4827
                
-
 
4828
                if (newRtagId > 0 ) {
-
 
4829
                    mLogger.warn("Snapshot taken: {} New: {}", mRtagId, newRtagId);
-
 
4830
                }
-
 
4831
            }
-
 
4832
            
-
 
4833
 
-
 
4834
        }
-
 
4835
        catch ( SQLException e )
-
 
4836
        {
-
 
4837
            handleSQLException(e, "");
-
 
4838
        }
-
 
4839
        finally
-
 
4840
        {
-
 
4841
            // this block is executed regardless of what happens in the try block
-
 
4842
            // even if an exception is thrown
-
 
4843
            // ensure disconnect
-
 
4844
            disconnect();
-
 
4845
        }        
-
 
4846
    }
-
 
4847
 
4780
}
4848
}
4781
 
4849