[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.1, Mon Nov 5 21:27:47 2007 UTC revision 1.9, Wed May 7 23:09:47 2008 UTC
# Line 77  Line 77 
77    
78  Specify the stage at which to start. The current stages are as follows  Specify the stage at which to start. The current stages are as follows
79    
80  =over 4  =over 8
81    
82  =item 1 Set up directories and check out the source.  =item 1
83    
84  =item 2 Bootstrap and build the new FIG.  Set up directories and check out the source.
85    
86  =item 3 Perform configuration fixes.  =item 2
87    
88  =item 4 Fix file permissions.  Bootstrap and build the new FIG.
89    
90  =item 5 Display instructions for the remaining scripts.  =item 3
91    
92    Perform configuration fixes.
93    
94    =item 4
95    
96    Fix file permissions.
97    
98    =item 5
99    
100    Copy the cover pages.
101    
102    =item 6
103    
104    Copy the drug target files.
105    
106  =back  =back
107    
# Line 98  Line 112 
112    
113  =item server  =item server
114    
115  Name of the server that contains the NMPDR cover pages.  Server path to the cover pages. This indicates the type of NMPDR being created,
116    and is usually the name of a symlink known to the Apache configuration. The
117    default is C<next>, which indicates the development version. For the experimental
118    version, it should be C<dev>.
119    
120  =back  =back
121    
# Line 115  Line 132 
132  use strict;  use strict;
133  use Tracer;  use Tracer;
134  use DocUtils;  use DocUtils;
 use TestUtils;  
135  use Cwd;  use Cwd;
136  use File::Copy;  use File::Copy;
137  use File::Path;  use File::Path;
138  use File::stat;  use File::stat;
139  use POSIX;  #use POSIX;
140  use IO::Handle;  use IO::Handle;
141    
142  # Get the command-line options.  # Get the command-line options.
# Line 141  Line 157 
157                                                         'force an update over a possible existing SEED'],                                                         'force an update over a possible existing SEED'],
158                                            group =>    ['fig',                                            group =>    ['fig',
159                                                         'group to be given write permission for the new files'],                                                         'group to be given write permission for the new files'],
160                                            server =>   ['nmpdr-1.nmpdr.org',                                            server =>   ['next',
161                                                         'name of the server containing the development NMPDR cover pages'],                                                         'server path to the cover pages'],
162                                          },                                          },
163                                              '<versionID>',                                              '<versionNumber>',
164                                              @ARGV);                                              @ARGV);
165    
166  # Get the main directory names.  # Get the main directory names.
# Line 153  Line 169 
169  my $blastmat_tarfile = $options->{blastMAT};  my $blastmat_tarfile = $options->{blastMAT};
170  my $base_dir = $FIG_Config::nmpdr_base;  my $base_dir = $FIG_Config::nmpdr_base;
171    
172  # Get the version number.  # Get the new version number.
173  my $version = $parameters[0];  my $version = $parameters[0];
174    # Compute the current version number.
175    $FIG_Config::nmpdr_version =~ /(\d+)/;
176    my $old_version = $1;
177    
178  # Set up the CVS data. Note that we are using an anonymous login. You can  # Set up the CVS data. Note that we are using an anonymous login. You can
179  # update from the NMPDR server but you can't commit!  # update from the NMPDR server but you can't commit!
180  my $cvsroot = ":pserver:anonymous\@biocvs.mcs.anl.gov:/disks/cvs/bio";  my $cvsroot = ":pserver:anonymous\@biocvs.mcs.anl.gov:/disks/cvs/bio";
181  my $cvs_packages = "seed_base GBrowse Sprout NmpdrConfigs FigSeedViewer PPO SubsystemEditor WebApplication";  my $cvs_packages = "nmpdr_base";
182    
183  # Check the parameters. Note that if the starting stage is 5 (display instructions), we don't need to do any of this.  # Check the parameters.
 if ($options->{stage} < 5) {  
184      if (! $FIG_Config::nmpdr_base) {      if (! $FIG_Config::nmpdr_base) {
185          Confess("Please specify a value for FIG_Config::nmpdr_base.");          Confess("Please specify a value for FIG_Config::nmpdr_base.");
186      } elsif (! -d $FIG_Config::nmpdr_base) {      } elsif (! -d $FIG_Config::nmpdr_base) {
# Line 176  Line 194 
194      } elsif ($version !~ /^\d+$/) {      } elsif ($version !~ /^\d+$/) {
195          Confess("Invalid (non-numeric) version number $version.");          Confess("Invalid (non-numeric) version number $version.");
196      }      }
 }  
197  # Make the version number pretty.  # Make the version number pretty.
198  $version = sprintf("%02d", $version);  $version = sprintf("%02d", $version);
199  # Add the version number to the release name.  # Add the version number to the release name.
# Line 223  Line 240 
240      # Now we create the code directories.      # Now we create the code directories.
241      Insure("$target_dir/dist");      Insure("$target_dir/dist");
242      Insure("$target_dir/dist/releases");      Insure("$target_dir/dist/releases");
243      # Finally, we create the directories that hold generated HTML files.      # Finally, we create the directory that holds the cover pages.
244      Insure("$version_dir/html");      Insure("$version_dir/html");
     Insure("$version_dir/html/includes");  
     Insure("$version_dir/html/includes/forms");  
245      # Change to the target directory. This means we're inside FIGdisk and above      # Change to the target directory. This means we're inside FIGdisk and above
246      # FIG.      # FIG.
247      ChDir($target_dir);      ChDir($target_dir);
# Line 318  Line 333 
333          Trace("CVS checkout would be to " . getcwd() . ".") if T(2);          Trace("CVS checkout would be to " . getcwd() . ".") if T(2);
334      } else {      } else {
335          Trace("Checking out from CVS.") if T(2);          Trace("Checking out from CVS.") if T(2);
336          my $rc = system("cvs -d $cvsroot co $cvs_packages >$lf 2>&1 ");          my $rc = system("cvs -d $cvsroot co -P $cvs_packages >$lf 2>&1 ");
337          if ($? != 0) {          if ($? != 0) {
338              # Here the checkout failed.              # Here the checkout failed.
339              Confess("Error during CVS checkout for $cvsroot.");              Confess("Error during CVS checkout for $cvsroot.");
# Line 332  Line 347 
347          # Copy the make file.          # Copy the make file.
348          copy("ReleaseTools/Makefile.top", "Makefile") ||          copy("ReleaseTools/Makefile.top", "Makefile") ||
349              Confess("Could not copy master make file.");              Confess("Could not copy master make file.");
         # Create the dummy GBrowse group files. After the database  
         # is loaded these will be rebuilt, but we need something  
         # to keep the make from failing.  
         my %sampleGenomes = (Campylobacter => '192222.1',  
                              Listeria => '169963.1',  
                              Staphylococcus => '273036.3',  
                              Streptococcus => '160490.1',  
                              Vibrio => '312309.3',  
                              Other => '83333.1'  
                             );  
         for my $group (keys %sampleGenomes) {  
             Open(\*GROUP, ">NmpdrConfigs/$group.group");  
             print GROUP "$sampleGenomes{$group}\n";  
             close GROUP;  
         }  
350          # Write out the release name.          # Write out the release name.
351          Open(\*RELFILE, ">$target_dir/DEFAULT_RELEASE");          Open(\*RELFILE, ">$target_dir/DEFAULT_RELEASE");
352          print RELFILE "$rel\n";          print RELFILE "$rel\n";
# Line 377  Line 377 
377      Trace("Stage 2 complete.") if T(2);      Trace("Stage 2 complete.") if T(2);
378  }  }
379  #  #
380  #   STAGE 3: Configure FIG_Config and the config script, set the  #   STAGE 3: Configure FIG_Config and the config script
381  #            GBrowse symlink, and protect from updates.  #            and protect from updates.
382  #  #
383  if ($options->{stage} <= 3) {  if ($options->{stage} <= 3) {
384      # Switch to the configuration directory.      # Switch to the configuration directory.
# Line 388  Line 388 
388      my %changes = (      my %changes = (
389                     temp_url          => "\$nmpdr_site_url/FIG-Tmp",                     temp_url          => "\$nmpdr_site_url/FIG-Tmp",
390                     cgi_url           => "\$nmpdr_site_url/FIG",                     cgi_url           => "\$nmpdr_site_url/FIG",
391                       temp_base         => "/next/FIG-Tmp",
392                       cgi_base          => "/next/FIG",
393                     template_url      => "\$nmpdr_site_url/templates",                     template_url      => "\$nmpdr_site_url/templates",
                    java              => $FIG_Config::java,  
394                     dbms              => "mysql",                     dbms              => "mysql",
395                     sproutDbms        => "mysql",                     sproutDbms        => "mysql",
396                     db                => $FIG_Config::db,                     db                => $FIG_Config::db,
# Line 404  Line 405 
405                     sproutPass        => "",                     sproutPass        => "",
406                     sproutSock        => "",                     sproutSock        => "",
407                     sproutPort        => 3306,                     sproutPort        => 3306,
408                       sprout_host       => "localhost",
409                     nmpdr_version     => $version_rel,                     nmpdr_version     => $version_rel,
410                       nmpdr_release     => $version,
411                     nmpdr_base        => $FIG_Config::nmpdr_base,                     nmpdr_base        => $FIG_Config::nmpdr_base,
412                     nmpdr_pages       => "$version_dir/html",                     nmpdr_pages       => "$version_dir/html",
413                     preIndex          => 1,                     preIndex          => 1,
# Line 414  Line 417 
417                     blast_limit       => 1000,                     blast_limit       => 1000,
418                     prop_search_limit => 4,                     prop_search_limit => 4,
419                     drug_directory    => "\$var/DrugTargets",                     drug_directory    => "\$var/DrugTargets",
420                     dockLimit         => "00000030",                     dockLimit         => "00000100",
421                     advanced_class    => "FidSearch BlastSearch",                     advanced_class    => "FidSearch BlastSearch",
422                     splitter          => " : ",                     splitter          => " : ",
423                     attrURL           => "http://anno-3.nmpdr.org/attrib_server/AttribXMLRPC.cgi",                     attrURL           => "http://anno-3.nmpdr.org/attrib_server/AttribXMLRPC.cgi",
# Line 426  Line 429 
429                     attrPort          => 3306,                     attrPort          => 3306,
430                     attrSock          => undef,                     attrSock          => undef,
431                     attrDBD           => "/disks/nmpdr/v$version/FIGdisk/FIG/AttributesDBD.xml",                     attrDBD           => "/disks/nmpdr/v$version/FIGdisk/FIG/AttributesDBD.xml",
432                       phone             => "{ user => 'BruceTheHumanPet', password => 'STARl00k', api_id => '2561022' }",
433                       nmpdr_mode        => 1,
434                       lib               => "\$FIG_Config::fig_disk/dist/releases/$version_rel/$FIG_Config::arch/lib",
435                       wiki_data         => "\$FIG_Config::fig/WikiData",
436                       web_app_db        => "{ -database => 'WebAppBackend', -host => 'bioseed.mcs.anl.gov', -user => 'root' };",
437                       app_name          => "NMPDR",
438                       live_server       => 0,
439                       sprout_host       => "localhost",
440                       ontology_db       => "\$FIG_Config::global/Ontology/ontology.sqlite",
441                       file_images_only  => 1,
442                       error_feed        => "rss2trace.xml",
443                       nmpdr_source      => "\$FIG_Config::fig_disk/dist/releases/current",
444                    );                    );
445        # Pull forward the server values from the current version.
446        for my $serverKey (qw(bbh_server_url sim_server_url pin_server_url pch_server_url use_pch_server)) {
447            my $value = eval("\$FIG_Config::$serverKey");
448            if (defined $value) {
449                $changes{$serverKey} = $value;
450            }
451        }
452    
453      # Create a list of lines to be added to the front.      # Create a list of lines to be added to the front.
454        my $nmpdr_url = "http://" . $ENV{'HTTP-HOST'} . "/$options->{server}";
455        Trace("URL for this NMPDR release is $nmpdr_url") if T(2);
456      my $inserts = [      my $inserts = [
457                     "",                     "",
458                     "\$nmpdr_site_url = \"http://$options->{server}/next\";",                     "\$nmpdr_site_url = \"$nmpdr_url\";",
459                    ];                    ];
460      if ($options->{test}) {      if ($options->{test}) {
461          Trace("Configuration file update would run from " . getcwd() . ".") if T(2);          Trace("Configuration file update would run from " . getcwd() . ".") if T(2);
# Line 438  Line 463 
463          Trace("Updating configuration file in " . getcwd() . ".") if T(2);          Trace("Updating configuration file in " . getcwd() . ".") if T(2);
464          DocUtils::ModifyConfigFile("FIG_Config.pm", \%changes, $inserts);          DocUtils::ModifyConfigFile("FIG_Config.pm", \%changes, $inserts);
465      }      }
     # Now we need to set up the Gbrowse symlink. This insures that the  
     # GBrowse can find the web pages in the correct place.  
     if ($options->{test}) {  
         Trace("Html pointer directory would be $target_dir/Html.") if T(2);  
     } else {  
         Trace("Configuring Html pointer directory.") if T(2);  
         ChDir($target_dir);  
         do_symlink("$target_dir/FIG/CGI/Html", "Html");  
         # Create the "doc_root". It's not used, but the software needs to know  
         # it's there.  
         Insure("$target_dir/doc_root");  
     }  
466      # The next step is to update the shell script. We need to add CVS information and      # The next step is to update the shell script. We need to add CVS information and
467      # the temp directory.      # the temp directory.
468      my %elims = (CVSROOT => $cvsroot,      my %elims = (CVSROOT => $cvsroot,
# Line 484  Line 497 
497          close FIGOUT;          close FIGOUT;
498          rename "fig-user-env.sh~", "fig-user-env.sh";          rename "fig-user-env.sh~", "fig-user-env.sh";
499      }      }
500        # Copy the WebApplication configuration subdirectory from the
501        # current version to the next version. First, we get our current
502        # configuration directory.
503        my $currentConfig = "$FIG_Config::fig_disk/config";
504        # Now we create the web-application subdirectory in the target directory.
505        mkdir "WebApplication";
506        # Copy across the files inside.
507        my @lines = `cp -r $currentConfig/WebApplication/* $target_dir/config/WebApplication`;
508        Trace("WebApplication configuration files copied:\n" . join("\n", @lines)) if T(2);
509      # Finally, create a marker file to protect this installation from      # Finally, create a marker file to protect this installation from
510      # automatic updates.      # automatic updates.
511      my $marker_file = "$target_dir/config/DISABLE_P2P";      my $marker_file = "$target_dir/config/DISABLE_P2P";
# Line 511  Line 533 
533          # Set the permissions.          # Set the permissions.
534          Tracer::SetPermissions($version_dir, $options->{group}, 02664, tmp => 02777);          Tracer::SetPermissions($version_dir, $options->{group}, 02664, tmp => 02777);
535      }      }
536      Trace("Stage 5 complete.") if T(2);      Trace("Stage 4 complete.") if T(2);
537  }  }
538  #  #
539  # STAGE 5: Display remaining steps.  # STAGE 5: Copy the cover pages.
540  #  #
541  if ($options->{stage} <= 5) {  if ($options->{stage} <= 5) {
542      # Get this user's name so we can put it in the command line prototypes.      Trace("Copying cover pages.") if T(2);
543      my $user = $options->{user};      my @syncData = `rsync --archive --recursive /disks/nmpdr/v$old_version/html $version_dir/`;
544      # Compute the next release date.      Trace("Copy results\n" . join("\n", @syncData)) if T(3);
545      my @timeParts = localtime();      # Create the version number file for the wiki.
546      my $today = strftime("%B %d, %Y", @timeParts);      my $text = join("\n", "<?php",
547      # Display the instructions.                            "\$wgNmpdrVersion = $version;",
548      Trace("Switch to the new environment and then perform the following steps.") if T(2);                            "?>",
549      Trace("Log off COMPLETELY before switching to clear out the old CVS configuration.") if T(2);                            "");
550      Trace("(1) Make the new SEED.") if T(2);      my $fh = Tracer::Open(undef, ">$version_dir/html/wiki/extensions/NmpdrVersion.php");
551      Trace("    touch NmpdrConfigs/*.group") if T(2);      print "$fh", $text;
552      Trace("    make") if T(2);      close $fh;
553      Trace("(2) Create the code templates.") if T(2);      Trace("Version file created for wiki.") if T(2);
554      Trace("    CompileTemplate -trace=3 /disks/nmpdr/code_helpers /disks/nmpdr/next/FIGdisk/FIG/CGI/Html") if T(2);      Trace("Stage 5 complete.") if T(2);
     Trace("(3) Create the NMPDR database. (You may be prompted for a password.)") if T(2);  
     Trace("    mysqladmin -u $FIG_Config::sproutUser -p create $sprout_db_name") if T(2);  
     Trace("(4) Run LoadSproutTables to load the NMPDR database from the SEED.") if T(2);  
     Trace("(5) Run MakeGroupFiles to set up the GBrowse group files.") if T(2);  
     Trace("(6) Use Dreamweaver to move the cover pages to the WEB server.") if T(2);  
     Trace("(7) Run ShowCounts and GenomeStats to create the include pages.") if T(2);  
     Trace("(8) Run nmpdr2gff to create the GFF files, then ZIP and copy them.") if T(2);  
     Trace("    nmpdr2gff /disks/nmpdr/next/FIGdisk/FIG/var/downloads") if T(2);  
555  }  }
556    #
557    # STAGE 6: Copy the drug target files.
558    #
559    if ($options->{stage} <= 6) {
560        Trace("Copying drug target files.") if T(2);
561        my @syncData = `  rsync --archive --recursive /disks/nmpdr/v$old_version/FIGdisk/FIG/var/DrugTargets $version_dir/FIGdisk/FIG/var/`;
562        Trace("Copy results\n" . join("\n", @syncData)) if T(3);
563        Trace("Stage 6 complete.") if T(2);
564    }
565    
566  Trace("Processing complete.") if T(0);  Trace("Processing complete.") if T(0);
567    
568  # Forge a symbolic Link.  # Forge a symbolic Link.

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3