Subversion Repositories DevTools

Rev

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

Rev 910 Rev 924
Line 32... Line 32...
32
   * for escrow builds = mName + mVersion + mExtension
32
   * for escrow builds = mName + mVersion + mExtension
33
   * @attribute
33
   * @attribute
34
   */
34
   */
35
  String mAlias = new String();
35
  String mAlias = new String();
36
 
36
 
37
  /**clearcase vob location, must not contain spaces
37
  /**Version Control System Tag
38
   * @attribute
38
   * @attribute
39
   */
39
   */
40
  String mLocation = new String();
-
 
41
 
-
 
42
  /**clearcase source file instance identifier
-
 
43
   * @attribute
-
 
44
   */
-
 
45
  String mLabel = new String();
40
  String mVcsTag = new String();
46
 
41
 
47
  /**build standards
42
  /**build standards
48
   * @attribute
43
   * @attribute
49
   */
44
   */
50
  Vector<BuildStandard> mBuildStandardCollection = new Vector<BuildStandard>();
45
  Vector<BuildStandard> mBuildStandardCollection = new Vector<BuildStandard>();
Line 140... Line 135...
140
  /**test build email destination
135
  /**test build email destination
141
   * @attribute
136
   * @attribute
142
   */
137
   */
143
  String mTestBuildEmail;
138
  String mTestBuildEmail;
144
 
139
 
145
  /**clearcase vob location, must not contain spaces
140
  /**Version Control System Tag
146
   * @attribute
141
   * @attribute
147
   */
142
   */
148
  String mTestBuildLocation = new String();
-
 
149
 
-
 
150
  /**clearcase source file instance identifier
-
 
151
   * @attribute
-
 
152
   */
-
 
153
  String mTestBuildLabel = new String();
143
  String mTestBuildVcsTag = new String();
154
 
144
 
155
  /**build standards
145
  /**build standards
156
   * @attribute
146
   * @attribute
157
   */
147
   */
158
  Vector<BuildStandard> mTestBuildStandardCollection = new Vector<BuildStandard>();
148
  Vector<BuildStandard> mTestBuildStandardCollection = new Vector<BuildStandard>();
Line 201... Line 191...
201
  /**dpkg archive location
191
  /**dpkg archive location
202
   * @attribute
192
   * @attribute
203
   */
193
   */
204
  public static final String mGbeDpkg = System.getenv("GBE_DPKG");
194
  public static final String mGbeDpkg = System.getenv("GBE_DPKG");
205
 
195
 
206
  /**deploy archive location
-
 
207
   * @attribute
-
 
208
   */
-
 
209
  public static final String mGbeDply = System.getenv("GBE_DPLY");
-
 
210
 
-
 
211
  /**Exception message used upon detection an archive does not exist
196
  /**Exception message used upon detection an archive does not exist
212
   * Seems this is a rare but transient and recoverable scenario
197
   * Seems this is a rare but transient and recoverable scenario
213
   * @attribute
198
   * @attribute
214
   */
199
   */
215
  public static final String mRecoverable = "dpkg or deploy_archive do not exist, recovery will be attempted";
200
  public static final String mRecoverable = "dpkg_archive does not exist, recovery will be attempted";
216
 
201
 
217
  /**true if the package exists in the dpkg or deploy archive
202
  /**true if the package exists in the package archive (dpkg_archive)
218
   * @attribute
203
   * @attribute
219
   */
204
   */
220
  private boolean mArchivalExistence = true;
205
  private boolean mArchivalExistence = true;
221
 
206
 
222
  /**when true will trigger source control interaction eg labelling
207
  /**when true will trigger source control interaction eg labelling
Line 235... Line 220...
235
  boolean mHasCircularDependency = false;
220
  boolean mHasCircularDependency = false;
236
 
221
 
237
  /**constructor
222
  /**constructor
238
   */
223
   */
239
  Package(int pv_id, String pkg_name, String v_ext, String alias, 
224
  Package(int pv_id, String pkg_name, String v_ext, String alias, 
240
          String pkg_label, String src_path, char change_type, char ripple_field)
225
          String pkg_vcs_tag, char change_type, char ripple_field)
241
  {
226
  {
242
    mLogger.debug("Package 1: pv_id " + pv_id + " pkg_name " + pkg_name + " v_ext " + v_ext + " alias " + alias + " pkg_label " + pkg_label + " src_path " + src_path + " change_type " + change_type);
227
    mLogger.debug("Package 1: pv_id " + pv_id + " pkg_name " + pkg_name + " v_ext " + v_ext + " alias " + alias + " pkg_vcs_tag " + pkg_vcs_tag + " change_type " + change_type);
243
    mId = pv_id;
228
    mId = pv_id;
244
    mName = pkg_name;
229
    mName = pkg_name;
245
    mVersion = "0.0.0000";
230
    mVersion = "0.0.0000";
246
    mExtension = v_ext;
231
    mExtension = v_ext;
247
    mAlias = alias;
232
    mAlias = alias;
248
    mLabel = pkg_label;
233
    mVcsTag = pkg_vcs_tag;
249
    mLocation = src_path;
-
 
250
    
234
 
251
    if (change_type == 'M')
235
    if (change_type == 'M')
252
    {
236
    {
253
      // a ripple_field of 'L' indicates this package has limited version numbering
237
      // a ripple_field of 'L' indicates this package has limited version numbering
254
      mChangeType.setMajor(ripple_field == 'L' ? true : false);
238
      mChangeType.setMajor(ripple_field == 'L' ? true : false);
255
    }
239
    }
Line 264... Line 248...
264
  }
248
  }
265
 
249
 
266
  /**constructor
250
  /**constructor
267
   */
251
   */
268
  Package(int pv_id, String pkg_name, String pkg_version, String v_ext, 
252
  Package(int pv_id, String pkg_name, String pkg_version, String v_ext, 
269
          String alias, String pkg_label, String src_path, 
253
          String alias, String pkg_vcs_tag, char ripple_field)
270
          char ripple_field)
-
 
271
  {
254
  {
272
    mLogger.debug("Package 2: pv_id " + pv_id + " pkg_name " + pkg_name + " pkg_version " + pkg_version + " v_ext " + v_ext + " alias " + alias + " pkg_label " + pkg_label + " src_path " + src_path + " ripple_field " + ripple_field);
255
    mLogger.debug("Package 2: pv_id " + pv_id + " pkg_name " + pkg_name + " pkg_version " + pkg_version + " v_ext " + v_ext + " alias " + alias + " pkg_vcs_tag " + pkg_vcs_tag + " ripple_field " + ripple_field);
273
    mId = pv_id;
256
    mId = pv_id;
274
    mName = pkg_name;
257
    mName = pkg_name;
275
    mVersion = pkg_version;
258
    mVersion = pkg_version;
276
    int endindex = mVersion.length() - v_ext.length();
259
    int endindex = mVersion.length() - v_ext.length();
277
    
260
    
Line 280... Line 263...
280
      mVersion = mVersion.substring(0, endindex);
263
      mVersion = mVersion.substring(0, endindex);
281
    }
264
    }
282
    
265
    
283
    mExtension = v_ext;
266
    mExtension = v_ext;
284
    mAlias = alias;
267
    mAlias = alias;
285
    mLabel = pkg_label;
268
    mVcsTag = pkg_vcs_tag;
286
    mLocation = src_path;
-
 
287
    
269
 
288
    // setBuild is the default
270
    // setBuild is the default
289
    if (ripple_field == 'M')
271
    if (ripple_field == 'M')
290
    {
272
    {
291
      mRippleField.setMajor();
273
      mRippleField.setMajor();
292
    }
274
    }
Line 311... Line 293...
311
    mLogger.debug("Package 3");
293
    mLogger.debug("Package 3");
312
    mId = 0;
294
    mId = 0;
313
    mName = "null";
295
    mName = "null";
314
    mExtension = "null";
296
    mExtension = "null";
315
    mAlias = "null";
297
    mAlias = "null";
316
    mLabel = "null";
298
    mVcsTag = "null";
317
    mLocation = "null";
-
 
318
  }
299
  }
319
 
300
 
320
  /**constructor for test build purposes
301
  /**constructor for test build purposes
321
   */
302
   */
322
  Package(String pkg_name, String v_ext, String alias, 
303
  Package(String pkg_name, String v_ext, String alias, 
323
          String pkg_label, String src_path, int testBuildInstruction, String email)
304
          String pkg_vcs_tag, int testBuildInstruction, String email)
324
  {
305
  {
325
    mLogger.debug("Package 4: pkg_name " + pkg_name + " v_ext " + v_ext + " alias " + alias + " pkg_label " + pkg_label + " src_path " + src_path);
306
    mLogger.debug("Package 4: pkg_name " + pkg_name + " v_ext " + v_ext + " alias " + alias + " pkg_vcs_tag " + pkg_vcs_tag );
326
    // don't need pv_id
307
    // don't need pv_id
327
    mId = -1;
308
    mId = -1;
328
    mName = pkg_name;
309
    mName = pkg_name;
329
    // avoid interaction with real versions
310
    // avoid interaction with real versions
330
    mVersion = "0.0.0000";
311
    mVersion = "0.0.0000";
331
    mExtension = v_ext;
312
    mExtension = v_ext;
332
    mAlias = alias;
313
    mAlias = alias;
333
    mTestBuildInstruction = testBuildInstruction;
314
    mTestBuildInstruction = testBuildInstruction;
334
    mTestBuildEmail = email;
315
    mTestBuildEmail = email;
335
    mTestBuildLocation = src_path;
-
 
336
    mTestBuildLabel = pkg_label;
316
    mTestBuildVcsTag = pkg_vcs_tag;
337
  }
317
  }
338
  
318
  
339
/**constructor for unit test purposes
319
/**constructor for unit test purposes
340
  */
320
  */
341
  public Package(ReleaseManager rm, String version, int majorLimit, int minorLimit, int patchLimit, int buildNumberLimit)
321
  public Package(ReleaseManager rm, String version, int majorLimit, int minorLimit, int patchLimit, int buildNumberLimit)
Line 792... Line 772...
792
    }
772
    }
793
    
773
    
794
    return retVal;
774
    return retVal;
795
  }
775
  }
796
  
776
  
797
  /**returns true if the version exists in the dpkg_archive, deploy_archive or release manager database
777
  /**returns true if the version exists in the dpkg_archive or release manager database
798
   * claims the version in the release manager database
778
   * claims the version in the release manager database
799
   */
779
   */
800
  private boolean exists(ReleaseManager releaseManager, int rtag_id) throws Exception
780
  private boolean exists(ReleaseManager releaseManager, int rtag_id) throws Exception
801
  {
781
  {
802
    mLogger.debug("exists 1 on Package " + mName + " version " + mVersion + " extension " + mExtension);
782
    mLogger.debug("exists 1 on Package " + mName + " version " + mVersion + " extension " + mExtension);
Line 825... Line 805...
825
    
805
    
826
    mLogger.info("exists 1 returned " + retVal);
806
    mLogger.info("exists 1 returned " + retVal);
827
    return retVal;
807
    return retVal;
828
  }
808
  }
829
 
809
 
830
  /**returns true if the dpkg_archive and deploy_archive exist
810
  /**returns true if the required package archives (dpkg_archive) exist
831
   * attempt to recover from their transient loss 
811
   * attempt to recover from their transient loss 
832
   */
812
   */
833
  public static boolean recover()
813
  public static boolean recover()
834
  {
814
  {
835
    mLogger.debug("recover");
815
    mLogger.debug("recover");
836
    boolean retVal = false;
816
    boolean retVal = false;
837
 
817
 
838
    String Release = mGbeDpkg;
818
    String Release = mGbeDpkg;
839
    String Deploy = mGbeDply;
-
 
840
 
-
 
841
    if (Release != null && Deploy != null)
819
    if (Release != null )
842
    {
820
    {
843
      File dpkg = new File(mGbeDpkg);
821
      File dpkg = new File(mGbeDpkg);
844
      File dply = new File(mGbeDply);
-
 
845
      
822
      
846
      if ( dpkg.exists() && dply.exists() )
823
      if ( dpkg.exists() )
847
      {
824
      {
848
        retVal = true;
825
        retVal = true;
849
      }
826
      }
850
    }
827
    }
851
    
828
    
852
    mLogger.info("recover returned " + retVal);
829
    mLogger.info("recover returned " + retVal);
853
    return retVal;
830
    return retVal;
854
  }
831
  }
855
  
832
  
856
  /**returns true if the version exists in the dpkg_archive or deploy_archive
833
  /**returns true if the version exists in a package archive (dpkg_archive)
857
   */
834
   */
858
  boolean exists()
835
  boolean exists()
859
    throws Exception
836
    throws Exception
860
  {
837
  {
861
    mLogger.debug("exists 2 on Package " + mName);
838
    mLogger.debug("exists 2 on Package " + mName);
862
    boolean retVal = false;
839
    boolean retVal = false;
863
 
840
 
864
    String Release = mGbeDpkg;
841
    String Release = mGbeDpkg;
865
    String Deploy = mGbeDply;
-
 
866
 
-
 
867
    if (Release == null || Deploy == null)
842
    if (Release == null)
868
    {
843
    {
869
      mLogger.fatal("exists 2 Release == null || Deploy == null");
844
      mLogger.fatal("exists 2 Release == null");
870
      throw new Exception("exists 2 Release == null || Deploy == null");
845
      throw new Exception("exists 2 Release == null");
871
    }
846
    }
872
    
847
    
873
    File dpkg = new File(mGbeDpkg);
848
    File dpkg = new File(mGbeDpkg);
874
    File dply = new File(mGbeDply);
-
 
875
    
-
 
876
    if ( !dpkg.exists() || !dply.exists() )
849
    if ( !dpkg.exists()  )
877
    {
850
    {
878
      mLogger.fatal("exists 2 " + mRecoverable);
851
      mLogger.fatal("exists 2 " + mRecoverable);
879
      throw new Exception(mRecoverable);
852
      throw new Exception(mRecoverable);
880
    }
853
    }
881
 
854
 
Line 888... Line 861...
888
    {
861
    {
889
      mLogger.info("exists 2 release.exists()");
862
      mLogger.info("exists 2 release.exists()");
890
      retVal = true;
863
      retVal = true;
891
    }
864
    }
892
 
865
 
893
    if (!retVal && (Release != Deploy))
-
 
894
    {
-
 
895
      name = Deploy + fs + mName + fs + mVersion + mExtension;
-
 
896
 
-
 
897
      File deploy = new File(name);
-
 
898
 
-
 
899
      if (deploy.exists())
-
 
900
      {
-
 
901
        mLogger.info("exists 2 deploy.exists()");
-
 
902
        retVal = true;
-
 
903
      }
-
 
904
    }
-
 
905
 
-
 
906
    mArchivalExistence = retVal;
866
    mArchivalExistence = retVal;
907
    mLogger.info("exists 2 returned " + retVal);
867
    mLogger.info("exists 2 returned " + retVal);
908
    return retVal;
868
    return retVal;
909
  }
869
  }
910
  
870
  
Line 1014... Line 974...
1014
    
974
    
1015
    if ( mTestBuildInstruction == 0)
975
    if ( mTestBuildInstruction == 0)
1016
    {
976
    {
1017
      return;
977
      return;
1018
    }
978
    }
1019
    
-
 
-
 
979
    String indentString = "&nbsp;&nbsp;&nbsp;&nbsp;";
1020
    String mailBody="Test build issues are identified in preceding build failure email.<p>" +
980
    String mailBody="Test build issues are identified in preceding build failure email.<p>" +
1021
                    "Release: " + release + "<br>" +
981
                    "Release: " + release + "<br>" +
1022
                    "Package: " + mAlias + "<br>" +
982
                    "Package: " + mAlias + "<br>" +
1023
                    "Label: " + mLabel + "<br>" +
983
                    "VcsTag: " + mVcsTag + "<br>" +
1024
                    "Location: " + mLocation + "<p>" +
-
 
1025
                    "Build dependencies:<p>";
984
                    "Build dependencies:<br>";
1026
    
985
    
1027
    for (Iterator<Package> it3 = mPackageDependencyCollection.iterator(); it3.hasNext(); )
986
    for (Iterator<Package> it3 = mPackageDependencyCollection.iterator(); it3.hasNext(); )
1028
    {
987
    {
1029
      Package depend = it3.next();
988
      Package depend = it3.next();
1030
      
989
      
Line 1033... Line 992...
1033
      
992
      
1034
      if ( dependsExtension.length() > 0 )
993
      if ( dependsExtension.length() > 0 )
1035
      {
994
      {
1036
        dependsVersion += dependsExtension;
995
        dependsVersion += dependsExtension;
1037
      }
996
      }
1038
      mailBody += "\'" + depend.mName + "\',\'" + dependsVersion + "\' <br>";
997
      mailBody += indentString + "\'" + depend.mName + "\',\'" + dependsVersion + "\' <br>";
1039
    }
998
    }
1040
 
999
 
1041
    mailBody += "<br>Build standards:<p>";
1000
    mailBody += "<br>Build standards:<br>";
1042
 
1001
 
1043
    for (Iterator<BuildStandard> it = mBuildStandardCollection.iterator(); it.hasNext(); )
1002
    for (Iterator<BuildStandard> it = mBuildStandardCollection.iterator(); it.hasNext(); )
1044
    {
1003
    {
1045
      BuildStandard bs = it.next();
1004
      BuildStandard bs = it.next();
1046
      
1005
      
1047
      String platform = bs.getPlatform(!ReleaseManager.mUseDatabase, false);
1006
      String platform = bs.getPlatform(!ReleaseManager.mUseDatabase, false);
1048
    
1007
    
1049
      if ( platform.length() > 0 )
1008
      if ( platform.length() > 0 )
1050
      {
1009
      {
1051
        mailBody += platform + ", ";
1010
        mailBody += indentString + platform + ", ";
1052
      }
1011
      }
1053
 
1012
 
1054
      String standard = bs.getBuildStandard(!ReleaseManager.mUseDatabase, false);
1013
      String standard = bs.getBuildStandard(!ReleaseManager.mUseDatabase, false);
1055
      
1014
      
1056
      if ( standard.length() > 0 )
1015
      if ( standard.length() > 0 )
1057
      {
1016
      {
1058
        mailBody += standard + "<br>";
1017
        mailBody += standard + "<br>";
1059
      }
1018
      }
1060
    }
1019
    }
1061
    
1020
 
-
 
1021
    mailBody += "<p><hr>";
1062
    try
1022
    try
1063
    {
1023
    {
1064
      Smtpsend.send(
1024
      Smtpsend.send(
1065
      mailServer, // mailServer
1025
      mailServer,           // mailServer
1066
      mailSender, // source
1026
      mailSender,           // source
1067
      emailInfoNonAntTask(), // target
1027
      emailInfoNonAntTask(),// target
1068
      null, // cc
1028
      null,                 // cc
1069
      null, // bcc
1029
      null,                 // bcc
1070
      success == true ? "TEST BUILD COMPLETED SUCCESSFULLY" : "TEST BUILD FAILED", // subject
1030
      success == true ? "TEST BUILD COMPLETED SUCCESSFULLY" : "TEST BUILD FAILED", // subject
1071
      mailBody, // body
1031
      mailBody,             // body
1072
      null // attachment
1032
      null                  // attachment
1073
      );
1033
      );
1074
    }
1034
    }
1075
    catch( Exception e )
1035
    catch( Exception e )
1076
    {
1036
    {
1077
    }
1037
    }