[Bio] / FigKernelScripts / build_sas_distro_from_cvs.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/build_sas_distro_from_cvs.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4, Mon Jun 27 21:08:09 2011 UTC revision 1.5, Mon Jun 27 21:29:23 2011 UTC
# Line 10  Line 10 
10    
11  use Getopt::Long;  use Getopt::Long;
12    
13    my $version;
14  my $build_dtr;  my $build_dtr;
 my $rc = GetOptions(dtr => \$build_dtr);  
15    
16  $rc && @ARGV == 1 or die "usage: $0 [--dtr] output-tarfile\n";  my $rc = GetOptions(dtr => \$build_dtr,
17                        'version=s' => \$version,
18                       );
19    
20    $rc && @ARGV == 1 or die "usage: $0 [--version version-string] [--dtr] output-tarfile\n";
21    
22  my $output_tarfile = shift;  my $output_tarfile = shift;
23    
# Line 29  Line 33 
33  chdir($temp);  chdir($temp);
34    
35  my @cvs_modules = qw(FigKernelScripts FigKernelPackages ModelSEED ModelSEEDScripts);  my @cvs_modules = qw(FigKernelScripts FigKernelPackages ModelSEED ModelSEEDScripts);
36    my $tarfile_dir;
37  my $cmd;  my $cmd;
38  if ($build_dtr)  if ($build_dtr)
39  {  {
40      push(@cvs_modules, 'DesktopRast');      push(@cvs_modules, 'DesktopRast');
41      $cmd = "build_dtr_distro";      $cmd = "build_dtr_distro";
42        $tarfile_dir = "myrast-$version";
43        my $new = "$distro_dir/$tarfile_dir";
44        &FIG::verify_dir($new);
45        $distro_dir = $new;
46  }  }
47  else  else
48  {  {
# Line 50  Line 59 
59    
60  chdir($here);  chdir($here);
61    
62    if (defined($version))
63    {
64        my $vfile = "$temp/FigKernelPackages/myRASTVersion.pm";
65        if (open(VF, ">", $vfile))
66        {
67            print VF <<END;
68    # This is a SAS component.
69    package myRASTVersion;
70    use base 'Class::Accessor';
71    __PACKAGE__->mk_accessors(qw(release));
72    sub new
73    {
74        my(\$class) = \@_;
75        my \$self = {
76            release => \"$version\",
77        };
78        return bless \$self, \$class;
79    }
80    1;
81    END
82        }
83        else
84        {
85            warn "Cannot open $vfile: $!";
86        }
87    
88        #
89        # Also look for ClientThing and update AGENT_NAME.
90        #
91        my $ct = "$temp/FigKernelPackages/ClientThing.pm";
92        if (open(my $ctfh, "<", $ct))
93        {
94            local $/;
95            undef $/;
96            my $txt = <$ctfh>;
97            close($ctfh);
98            my $new_name;
99            if ($build_dtr)
100            {
101                $new_name = "myRAST version $version";
102            }
103            else
104            {
105                $new_name = "SAS version $version";
106            }
107            $txt =~ s/AGENT_NAME\s+=>\s+"[^"]*"/AGENT_NAME => "$new_name"/;
108            open($ctfh, ">", $ct);
109            print $ctfh $txt;
110            close($ctfh);
111        }
112    }
113    
114  $rc = system("$FIG_Config::bin/$cmd", "--source", $temp, $distro_dir, $modules);  $rc = system("$FIG_Config::bin/$cmd", "--source", $temp, $distro_dir, $modules);
115    
116  if ($rc != 0)  if ($rc != 0)
# Line 57  Line 118 
118      die "build_sas_distro failed with rc=$rc\n";      die "build_sas_distro failed with rc=$rc\n";
119  }  }
120    
121    if ($tarfile_dir)
122    {
123        $rc = system("tar", "-c", "-C", "$distro_dir/..", "-z", "-f", $output_tarfile, $tarfile_dir);
124    }
125    else
126    {
127  $rc = system("tar", "-c", "-C", $distro_dir, "-z", "-f", $output_tarfile, ".");  $rc = system("tar", "-c", "-C", $distro_dir, "-z", "-f", $output_tarfile, ".");
128    }
129  if ($rc != 0)  if ($rc != 0)
130  {  {
131      die "tar failed with rc=$rc\n";      die "tar failed with rc=$rc\n";

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3