Subversion Repositories DevTools

Rev

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

Rev 922 Rev 924
Line 37... Line 37...
37
  // System
37
  // System
38
  private String fs = System.getProperty( "file.separator" );
38
  private String fs = System.getProperty( "file.separator" );
39
  private String ls = System.getProperty( "line.separator" );
39
  private String ls = System.getProperty( "line.separator" );
40
  private String gbeMachtype = System.getenv("GBE_MACHTYPE");
40
  private String gbeMachtype = System.getenv("GBE_MACHTYPE");
41
  private String dpkg_archive = System.getenv("GBE_DPKG");
41
  private String dpkg_archive = System.getenv("GBE_DPKG");
42
  private String deploy_archive = System.getenv("GBE_DPLY");
-
 
43
  // ant built in
42
  // ant built in
44
  private Project project;
43
  private Project project;
45
  private String basedir;
44
  private String basedir;
46
  // global
45
  // global
47
  private boolean master;
46
  private boolean master;
Line 62... Line 61...
62
  private String packageAlias;
61
  private String packageAlias;
63
  private String packageName;
62
  private String packageName;
64
  private String packageVersion;
63
  private String packageVersion;
65
  private String packageExtension;
64
  private String packageExtension;
66
  private String packageLoc;
65
  private String packageLoc;
67
  private String packageLabel;
66
  private String packageVcsTag;
68
  private String directChange;
67
  private String directChange;
69
  private String doesNotRequireSourceControlInteraction;
68
  private String doesNotRequireSourceControlInteraction;
70
  private String testBuildInstruction;
69
  private String testBuildInstruction;
71
  private String generic;
70
  private String generic;
72
  private String loc;
71
  private String loc;
Line 90... Line 89...
90
  private String[] command = new String[100];
89
  private String[] command = new String[100];
91
  private int commandIndex = 0;
90
  private int commandIndex = 0;
92
  private String cwd;
91
  private String cwd;
93
  private Execute thread;
92
  private Execute thread;
94
  private File wd;
93
  private File wd;
95
  private String newLabel;
94
  private String newVcsTag;
96
  private static final Logger mLogger = Logger.getLogger(ABT.class);
95
  private static final Logger mLogger = Logger.getLogger(ABT.class);
97
  private String fullyPublished = "no";
96
  private String fullyPublished = "no";
98
  private String hostname = new String("unknown");
97
  private String hostname = new String("unknown");
99
 
98
 
100
  private void Log(String message1, String message2)
99
  private void Log(String message1, String message2)
Line 216... Line 215...
216
  {
215
  {
217
    String retVal = "no";
216
    String retVal = "no";
218
    
217
    
219
    if (archive == null)
218
    if (archive == null)
220
    {
219
    {
221
      reportErrorException( "GBE_DPKG or GBE_DPLY environment variable not set", 256 );
220
      reportErrorException( "GBE_DPKG environment variable not set", 256 );
222
    }
221
    }
223
    
222
    
224
    String destination = archive + fs + packageName + fs + packageVersion;
223
    String destination = archive + fs + packageName + fs + packageVersion;
225
    
224
    
226
    if ( packageExtension.length() > 0 )
225
    if ( packageExtension.length() > 0 )
Line 718... Line 717...
718
      {
717
      {
719
        break;
718
        break;
720
      }
719
      }
721
    }
720
    }
722
 
721
 
723
    if ( fullyPublished.compareTo("no") == 0 )
-
 
724
    {
-
 
725
      // check deploy_archive    
-
 
726
      for (Iterator<Platform> it=platformCollection.iterator(); it.hasNext(); )
-
 
727
      {
-
 
728
        Platform platform = it.next();
-
 
729
        fullyPublished = published( deploy_archive, platform.getGbe_Machtype() );
-
 
730
        
-
 
731
        if ( fullyPublished.compareTo("no") == 0 )
-
 
732
        {
-
 
733
          break;
-
 
734
        }
-
 
735
      }
-
 
736
    }
-
 
737
    
-
 
738
    if ( gatherMetricsOnly != null )
722
    if ( gatherMetricsOnly != null )
739
    {
723
    {
740
      return;
724
      return;
741
    }
725
    }
742
 
726
 
Line 746... Line 730...
746
      {
730
      {
747
        //
731
        //
748
        //  Save modified build files
732
        //  Save modified build files
749
        //  Label the resultant files
733
        //  Label the resultant files
750
        //  Create a command of the form:
734
        //  Create a command of the form:
751
        //        jats etool jats_save_build
735
        //      jats etool jats_vcssave_build
752
        //              -locatepkg=zzzz     (Optional)
736
        //          -infile     auto.xml/auto.pl
753
        //              -infile=aaaa        (Optional)
737
        //          -outfile    xxxdepends.xml/build.pl
754
        //              -outfile=bbbb       (Optional)
738
        //          -pname      package_name
755
        //              -pname=xxxx
739
        //          -pversion   package_version
756
        //              -pversion=yyyy
740
        //          -infofile   path_to_info_file
757
        //              -wiplabel=ccccc     (Optional)
741
        //          -wiplabel   Existing WIP label (optional)
758
        //              -infofile=path_name
742
        //          -baselabel  View label
759
        //
743
 
760
        Log("publish save build files", warn);
744
        Log("publish save build files", warn);
761
 
745
 
762
        File saveinfo = new File(basedir + fs + rtagId + "abtinfo.txt");
746
        File saveinfo = new File(basedir + fs + rtagId + "abtinfo.txt");
763
        if ( saveinfo.exists() )
747
        if ( saveinfo.exists() )
764
        {
748
        {
Line 775... Line 759...
775
        {
759
        {
776
          addCommand( "-locatepkg=" + packageLoc );
760
          addCommand( "-locatepkg=" + packageLoc );
777
        }
761
        }
778
 
762
 
779
        addCommand( "etool" );
763
        addCommand( "etool" );
780
        addCommand( "jats_save_build" );
764
        addCommand( "jats_vcssave_build" );
781
 
765
 
782
        if ( buildStandard == BuildStandards.ANT )
766
        if ( buildStandard == BuildStandards.ANT )
783
        {
767
        {
784
          addCommand( "-infile" );
768
          addCommand( "-infile" );
785
          addCommand( "auto.xml" );
769
          addCommand( "auto.xml" );
Line 812... Line 796...
812
 
796
 
813
        if ( directChange != null )
797
        if ( directChange != null )
814
        {
798
        {
815
          // its a WIP. Pass in existing Label
799
          // its a WIP. Pass in existing Label
816
          addCommand( "-wiplabel" );
800
          addCommand( "-wiplabel" );
817
          addCommand( packageLabel );
801
          addCommand( packageVcsTag );
818
        }
802
        }
819
 
803
 
-
 
804
          addCommand( "-baselabel" );
-
 
805
          addCommand( packageVcsTag );
-
 
806
        
-
 
807
 
820
        if ( oldExtension != null && newExtension != null && packageExtension.compareTo( newExtension ) == 0 )
808
        if ( oldExtension != null && newExtension != null && packageExtension.compareTo( newExtension ) == 0 )
821
        {
809
        {
822
          // only branch build.pl where its extension is being migrated
810
          // only branch build.pl where its extension is being migrated
823
          addCommand( "-branch" );
811
          addCommand( "-branch" );
824
          addCommand( "project_migration_branch" );
812
          addCommand( "project_migration_branch" );
Line 829... Line 817...
829
 
817
 
830
        //
818
        //
831
        //  The command creates an info file(saveinfo) to pass information back
819
        //  The command creates an info file(saveinfo) to pass information back
832
        //  to the caller (me). This is a 'properties' file
820
        //  to the caller (me). This is a 'properties' file
833
        //  Need to extract the following information
821
        //  Need to extract the following information
834
        //    newLabel
822
        //    newVcsTag - which is held as VCS.tag
835
        //
823
        //
836
        Log("publish read info file", info);
824
        Log("publish read info file", info);
837
 
825
 
838
        Properties properties = new Properties();
826
        Properties properties = new Properties();
839
        try
827
        try
Line 843... Line 831...
843
        catch (IOException e)
831
        catch (IOException e)
844
        {
832
        {
845
          reportErrorException( "Failed to open save_build info file", 262 );
833
          reportErrorException( "Failed to open save_build info file", 262 );
846
        }
834
        }
847
 
835
 
848
        newLabel = properties.getProperty("Label" );
836
        newVcsTag = properties.getProperty("VCS.tag" );
849
        if ( newLabel == null )
837
        if ( newVcsTag == null )
850
        {
838
        {
851
          reportErrorException( "Save_build info. Missing property:Label", 262 );
839
          reportErrorException( "Save_build info. Missing property:VCS.tag", 262 );
852
        }
840
        }
853
        Log("publish read info file. Label:" + newLabel , info);
841
        Log("publish read info file. Label:" + newVcsTag , info);
854
      }
842
      }
855
    }
843
    }
856
  }
844
  }
857
 
845
 
858
  public void execute()
846
  public void execute()
Line 876... Line 864...
876
      }
864
      }
877
          
865
          
878
      // early target related
866
      // early target related
879
      target = getOwningTarget();
867
      target = getOwningTarget();
880
      packageAlias = target.getName();
868
      packageAlias = target.getName();
881
      packageLabel = project.getProperty(packageAlias + "packagelabel");
869
      packageVcsTag = project.getProperty(packageAlias + "packagevcstag");
882
      Log("execute packageLabel: ", packageLabel);
870
      Log("execute packageVcsTag: ", packageVcsTag);
883
      
871
      
884
      if ( packageLabel == null )
872
      if ( packageVcsTag == null )
885
      {
873
      {
886
        // this abt task has no properties, by design
874
        // this abt task has no properties, by design
887
        // future use to estimate build completion time
875
        // future use to estimate build completion time
888
        Log("execute packageAlias: " + packageAlias, info);
876
        Log("execute packageAlias: " + packageAlias, info);
889
        return;
877
        return;
Line 999... Line 987...
999
      
987
      
1000
      Log("execute owners: ", owners);
988
      Log("execute owners: ", owners);
1001
 
989
 
1002
      if ( packageAlias.compareTo("AbtSetUp") == 0 )
990
      if ( packageAlias.compareTo("AbtSetUp") == 0 )
1003
      {
991
      {
1004
        String packageSrcPath = project.getProperty(packageAlias + "packageSrcPath");
-
 
1005
        
-
 
1006
        if ( packageSrcPath != null )
-
 
1007
        {
-
 
1008
          Log("execute packageSrcPath: ", packageSrcPath);
-
 
1009
          // create rtag_id directory from scratch
992
        // create rtag_id directory from scratch
1010
          File rId = new File( rtagId );
993
        File rId = new File( rtagId );
1011
          deleteDirectory( rId );
994
        deleteDirectory( rId );
1012
          rId.mkdirs();
995
        rId.mkdirs();
1013
          
996
          
1014
          // jats release -extract pkgLabel -path=src_path -root=rtag_id/timestamp -tag=timestamp -noprefix
997
        // jats jats_vcsrelease -extract -label=pkgVcsTag -path=src_path -root=rtag_id/timestamp -tag=timestamp -noprefix
1015
          initCommand();
998
        initCommand();
1016
          addCommand( "jats" );
999
        addCommand( "jats" );
1017
          addCommand( "release" );
1000
        addCommand( "jats_vcsrelease" );
1018
          addCommand( "-extract" );
1001
        addCommand( "-extract" );
1019
          addCommand( packageLabel );
-
 
1020
          addCommand( "-path=" + packageSrcPath );
1002
        addCommand( "-label=" + packageVcsTag );
1021
          addCommand( "-root=" + rtagId );
1003
        addCommand( "-root=" + rtagId );
1022
          addCommand( "-tag=" + daemon );
1004
        addCommand( "-tag=" + daemon );
1023
          addCommand( "-noprefix" );
1005
        addCommand( "-noprefix" );
1024
          addCommand( "-verbose" );
-
 
1025
          addCommand( "-verbose" );
1006
        addCommand( "-verbose=2" );
1026
 
1007
 
1027
          runCommand( "Failure to extract source code from source control" );
1008
        runCommand( "Failure to extract source code from source control" );
1028
        }
-
 
1029
        return;      
1009
        return;
1030
      }
1010
      }
1031
 
1011
 
1032
      // target related    
1012
      // target related    
1033
      packageVersion = project.getProperty(packageAlias + "packageversion");
1013
      packageVersion = project.getProperty(packageAlias + "packageversion");
1034
      Log("execute packageVersion: ", packageVersion);
1014
      Log("execute packageVersion: ", packageVersion);
Line 1138... Line 1118...
1138
        }
1118
        }
1139
      }
1119
      }
1140
 
1120
 
1141
      if ( packageAlias.compareTo("AbtTearDown") == 0 )
1121
      if ( packageAlias.compareTo("AbtTearDown") == 0 )
1142
      {
1122
      {
1143
        // tear the ClearCase view down, regardless of build error
1123
        // tear the build view down, regardless of build error
1144
        wd = new File( basedir );
1124
        wd = new File( basedir );
1145
          
1125
          
1146
        // only now change the thread working directory back
1126
        // only now change the thread working directory back
1147
        thread.setWorkingDirectory( wd );
1127
        thread.setWorkingDirectory( wd );
1148
        
1128
        
1149
        File buildDirectory = new File(wd + getProject().getProperty("abt_package_location"));
1129
        File buildDirectory = new File(wd + getProject().getProperty("abt_package_location"));
1150
        
1130
        
1151
        if ( buildDirectory.exists() )
1131
        if ( buildDirectory.exists() )
1152
        {
1132
        {
1153
          // jats release -extract pkgLabel -root=rtag_id/timestamp -tag=timestamp -noprefix -delete
1133
          // jats jats_vcsrelease -label pkgTag -root=rtag_id/timestamp -tag=timestamp -noprefix -delete
1154
          initCommand();
1134
          initCommand();
1155
          addCommand( "jats" );
1135
          addCommand( "jats" );
1156
          addCommand( "release" );
1136
          addCommand( "jats_vcsrelease" );
1157
          addCommand( "-extract" );
-
 
1158
          addCommand( packageLabel );
1137
          addCommand( "-label=" + packageVcsTag );
1159
          addCommand( "-root=" + rtagId );
1138
          addCommand( "-root=" + rtagId );
1160
          addCommand( "-tag=" + daemon );
1139
          addCommand( "-tag=" + daemon );
1161
          addCommand( "-noprefix" );
1140
          addCommand( "-noprefix" );
1162
          addCommand( "-delete" );
1141
          addCommand( "-delete=2" );
1163
          addCommand( "-verbose" );
-
 
1164
          addCommand( "-verbose" );
1142
          addCommand( "-verbose=2" );
1165
  
1143
 
1166
          runCommand( "Failure to remove source code extraction" );
1144
          runCommand( "Failure to remove source code extraction" );
1167
        }
1145
        }
1168
 
1146
 
1169
        // delete the rtag directory
1147
        // delete the rtag directory
1170
        deleteDirectory( new File( rtagId ) );
1148
        deleteDirectory( new File( rtagId ) );
Line 1201... Line 1179...
1201
      for (Iterator<Ant> it=antCollection.iterator(); it.hasNext(); )
1179
      for (Iterator<Ant> it=antCollection.iterator(); it.hasNext(); )
1202
      {
1180
      {
1203
        Ant ant = it.next();
1181
        Ant ant = it.next();
1204
        Log("execute ant: ", ant.getJava());
1182
        Log("execute ant: ", ant.getJava());
1205
      }
1183
      }
1206
      
1184
 
1207
      newLabel = packageName + "_" + packageVersion;
1185
      // Set newVsTag to the existing VcsTag
1208
      
-
 
1209
      if ( packageExtension.length() > 0 )
1186
      // Will be used when rebuilding a package that already exists
1210
      {
-
 
1211
        newLabel += "." + packageExtension;
1187
      newVcsTag = packageVcsTag;
1212
      }
-
 
1213
      
1188
 
1214
      loc = project.getProperty(packageAlias + "loc");
1189
      loc = project.getProperty(packageAlias + "loc");
1215
      Log("execute loc: ", loc);
1190
      Log("execute loc: ", loc);
1216
      cwd = basedir + loc;
1191
      cwd = basedir + loc;
1217
      Log("execute cwd: ", cwd);
1192
      Log("execute cwd: ", cwd);
1218
      wd = new File( cwd );
1193
      wd = new File( cwd );
Line 1233... Line 1208...
1233
        if ( daemon != null )
1208
        if ( daemon != null )
1234
        {
1209
        {
1235
          // set properties to drive BuildThread attributes
1210
          // set properties to drive BuildThread attributes
1236
          // these are used to determine what ant did
1211
          // these are used to determine what ant did
1237
          getProject().setProperty("abt_fully_published", fullyPublished);
1212
          getProject().setProperty("abt_fully_published", fullyPublished);
1238
          getProject().setProperty("abt_new_label", newLabel);
1213
          getProject().setProperty("abt_new_vcstag", newVcsTag);
1239
        }
1214
        }
1240
        
1215
        
1241
        return;
1216
        return;
1242
      }
1217
      }
1243
      
1218
      
Line 1268... Line 1243...
1268
        // recognise an escrow will be run multiple times on a build stage
1243
        // recognise an escrow will be run multiple times on a build stage
1269
        // do not force continuous rebuilding each time
1244
        // do not force continuous rebuilding each time
1270
        // has this package version already been published on this platform
1245
        // has this package version already been published on this platform
1271
        String published = published( dpkg_archive, gbeMachtype );
1246
        String published = published( dpkg_archive, gbeMachtype );
1272
        
1247
        
1273
        if ( published.compareTo("no") == 0 )
-
 
1274
        {
-
 
1275
          published = published( deploy_archive, gbeMachtype );
-
 
1276
        }
-
 
1277
        
-
 
1278
        if ( published.compareTo("no") != 0 )
1248
        if ( published.compareTo("no") != 0 )
1279
        {
1249
        {
1280
          Log( "execute package has been published on this platform - skipping", info);
1250
          Log( "execute package has been published on this platform - skipping", info);
1281
          propertyValue = "257";
1251
          propertyValue = "257";
1282
          throw new Exception();
1252
          throw new Exception();