[Bio] / Sprout / NMPDRSetup.pl Repository:
ViewVC logotype

Diff of /Sprout/NMPDRSetup.pl

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

revision 1.14, Tue Sep 23 02:55:49 2008 UTC revision 1.15, Tue Sep 23 20:42:51 2008 UTC
# Line 117  Line 117 
117  default is C<next>, which indicates the development version. For the experimental  default is C<next>, which indicates the development version. For the experimental
118  version, it should be C<dev>.  version, it should be C<dev>.
119    
120    =item logdir
121    
122    Directory to contain the log files. The default is C<logs> in the NMPDR base
123    directory.
124    
125    =item version
126    
127    If specified, displays information about this version of the NMPDR and exits.
128    
129  =back  =back
130    
131  =head2 Maintenance Notes  =head2 Maintenance Notes
# Line 134  Line 143 
143  use File::Path;  use File::Path;
144  use File::stat;  use File::stat;
145  use IO::Handle;  use IO::Handle;
146    use SFXlate;
147    
148  # Get the command-line options.  # Get the command-line options.
149  my ($options, @parameters) = StandardSetup(['Sprout', 'DocUtils'],  my ($options, @parameters) = StandardSetup(['Sprout', 'DocUtils'],
# Line 148  Line 158 
158                                            group =>    ['fig', 'group to be given write permission for the new files'],                                            group =>    ['fig', 'group to be given write permission for the new files'],
159                                            server =>   ['next', 'NMPDR version type'],                                            server =>   ['next', 'NMPDR version type'],
160                                            trace =>    [3, 'tracing level'],                                            trace =>    [3, 'tracing level'],
161                                              logdir =>   ["$FIG_Config::nmpdr_base/logs", 'directory for log files'],
162                                              version =>  [0, 'print NMPDR version info and exit'],
163                                          },                                          },
164                                              '<versionNumber>',                                              '<versionNumber>',
165                                              @ARGV);                                              @ARGV);
# Line 178  Line 190 
190      Confess("BlastMAT TAR file not found at $blastmat_tarfile.");      Confess("BlastMAT TAR file not found at $blastmat_tarfile.");
191  } elsif (! -d $env_dir) {  } elsif (! -d $env_dir) {
192      Confess("Environment directory $env_dir not found.");      Confess("Environment directory $env_dir not found.");
193  } elsif (! $version) {  }
194    
195    # If this is version-display-only, display version info.
196    if ($options->{version}) {
197        Trace("Computing version information.") if T(3);
198        # We'll put the version data in here, a line at a time.
199        my @lines;
200        push @lines, "Current directory is " . getcwd . ".";
201        my $type = $FIG_Config::nmpdr_site_type;
202        $type =~ s#/##;
203        push @lines, "NMPDR version is $old_version with type \"$type\" for $FIG_Config::arch.";
204        push @lines, "Sprout database is $FIG_Config::sproutDB.";
205        push @lines, "Attribute database is $FIG_Config::attrDbName on $FIG_Config::attrHost.";
206        # This part is a little tricky. We want to see what's in the database, but it may
207        # not exist yet.
208        my $sproutLine = "Sprout database is not working.";
209        eval {
210            my $sprout = SFXlate->new_sprout_only();
211            # If we got this far, the database exists.
212            $sproutLine = "Sprout database is working.";
213            my $features = Tracer::CommaFormat($sprout->GetCount(['Feature'], "", []));
214            # Here the database exists and it has features in it.
215            $sproutLine = "Sprout database contains $features features.";
216        };
217        push @lines, $sproutLine;
218        # Check for load files.
219        if (! -d $FIG_Config::sproutData) {
220            push @lines, "No sprout load files found.";
221        } else {
222            my $dtxFiles = scalar(grep { $_ =~ /\.dtx$/i } Tracer::OpenDir("$FIG_Config::sproutData"));
223            push @lines, "$dtxFiles sprout load files found.";
224        }
225        Trace("NMPDR Version information:\n\n" . join("\n", @lines)) if T(2);
226        exit;
227    }
228    # Check the version parameter.
229    if (! $version) {
230      Confess("No version number specified.");      Confess("No version number specified.");
231  } elsif ($version !~ /^\d+$/) {  } elsif ($version !~ /^\d+$/) {
232      Confess("Invalid (non-numeric) version number $version.");      Confess("Invalid (non-numeric) version number $version.");
# Line 190  Line 238 
238  # Add the version number to the release name.  # Add the version number to the release name.
239  my $version_rel = $options->{relName};  my $version_rel = $options->{relName};
240  $version_rel =~ s/XX/$version/e;  $version_rel =~ s/XX/$version/e;
241    # Create the log file directory.
242    my $log_dir = $options->{logdir};
243    Insure($log_dir);
244    my $logFilePrefix = "$log_dir/v$version";
245  # Now we can start the setup.  # Now we can start the setup.
246  Trace("Creating NMPDR version $version with name $version_rel.");  Trace("Creating NMPDR version $version with name $version_rel.");
247  # Get the directory for the version-specific stuff.  # Get the directory for the version-specific stuff.
# Line 197  Line 249 
249  Insure($version_dir);  Insure($version_dir);
250  # This will be the directory of FIG stuff.  # This will be the directory of FIG stuff.
251  my $target_dir = "$version_dir/FIGdisk";  my $target_dir = "$version_dir/FIGdisk";
252    # This is a global for the name of the code directory.
253    my $code_dir = "$target_dir/dist/releases/$version_rel";
254  # Compute the Sprout database name.  # Compute the Sprout database name.
255  my $sprout_db_name = "nmpdr_v${version}_sprout";  my $sprout_db_name = "nmpdr_v${version}_sprout";
256  Trace("Starting at stage $options->{stage}.") if T(2);  Trace("Starting at stage $options->{stage}.") if T(2);
# Line 319  Line 373 
373      ChDir($rel);      ChDir($rel);
374      # Set up the CVS log file. Note it will be in the same directory as      # Set up the CVS log file. Note it will be in the same directory as
375      # our other log files with the same suffix.      # our other log files with the same suffix.
376      my $lf = "$FIG_Config::temp/CVS$options->{user}.log";      my $lf = "$logFilePrefix-CVS.log";
377      if ($options->{test}) {      if ($options->{test}) {
378          Trace("CVS checkout would be to " . getcwd() . ".") if T(2);          Trace("CVS checkout would be to " . getcwd() . ".") if T(2);
379      } else {      } else {
# Line 358  Line 412 
412          Trace("Configuration script would be executed from $target_dir.") if T(2);          Trace("Configuration script would be executed from $target_dir.") if T(2);
413      } else {      } else {
414          delete $ENV{PERL5LIB};          delete $ENV{PERL5LIB};
415          my $lf = "$FIG_Config::temp/Config$options->{user}.log";          my $lf = "$logFilePrefix-Config.log";
416          Trace("Executing configuration script from $target_dir.") if T(2);          Trace("Executing configuration script from $target_dir.") if T(2);
417          system("./configure $arch $target_dir >$lf 2>&1");          system("./configure $arch $target_dir >$lf 2>&1");
418          if ($? != 0) {          if ($? != 0) {
# Line 457  Line 511 
511      Trace("Stage 3 complete.") if T(2);      Trace("Stage 3 complete.") if T(2);
512  }  }
513  #  #
514  # STAGE 4: fix the file permissions.  # STAGE 4: Fix the file permissions and do a make.
515  #  #
516  if ($options->{stage} <= 4) {  if ($options->{stage} <= 4) {
517      # Get the group name and ID.      # Get the group name and ID.
# Line 469  Line 523 
523          # Set the permissions.          # Set the permissions.
524          Tracer::SetPermissions($version_dir, $options->{group}, 02664, tmp => 02777);          Tracer::SetPermissions($version_dir, $options->{group}, 02664, tmp => 02777);
525          Trace("Permissions fixed in $version_dir.") if T(2);          Trace("Permissions fixed in $version_dir.") if T(2);
526            # Make the build utilities executable.
527            my @utilities = grep { $_ =~ m/\.pl$/i } Tracer::OpenDir("$code_dir/WinBuild");
528            for my $script (@utilities) {
529                Trace("Fixing permissions for $script in $code_dir.") if T(3);
530                chmod 0775, "$code_dir/$script";
531            }
532        }
533        if ($options->{test}) {
534            Trace("Make would occur in directory $code_dir.") if T(2);
535        } else {
536            ChDir($code_dir);
537            Trace("Making in $code_dir.") if T(2);
538            my $lf = "$logFilePrefix-Make.log";
539            my @lines = `make 2>&1 1>$lf`;
540            if (scalar @lines) {
541                Trace("Messages from make:\n" . join("\n", @lines)) if T(1);
542            }
543            Trace("Make complete.") if T(2);
544      }      }
545      Trace("Stage 4 complete.") if T(2);      Trace("Stage 4 complete.") if T(2);
546  }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3