[Bio] / FigCommon / bootstrap.pl Repository:
ViewVC logotype

Diff of /FigCommon/bootstrap.pl

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

revision 1.3, Tue Dec 23 17:56:32 2003 UTC revision 1.31, Tue Nov 27 23:16:21 2007 UTC
# Line 1  Line 1 
1  #  #
2    # Copyright (c) 2003-2006 University of Chicago and Fellowship
3    # for Interpretations of Genomes. All Rights Reserved.
4    #
5    # This file is part of the SEED Toolkit.
6    #
7    # The SEED Toolkit is free software. You can redistribute
8    # it and/or modify it under the terms of the SEED Toolkit
9    # Public License.
10    #
11    # You should have received a copy of the SEED Toolkit Public License
12    # along with this program; if not write to the University of Chicago
13    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14    # Genomes at veronika@thefig.info or download a copy from
15    # http://www.theseed.org/LICENSE.TXT.
16    #
17    
18    #
19  # FIG bootstrap script.  # FIG bootstrap script.
20  #  #
21  # Control is passed here from the toplevel configure (or dists/releases/install depending  # Control is passed here from the toplevel configure (or dists/releases/install depending
# Line 7  Line 24 
24  # The configure has set the following environment variables for our use:  # The configure has set the following environment variables for our use:
25  #  #
26  #  FIG_HOME             Root of the FIGdisk tree we're setting up  #  FIG_HOME             Root of the FIGdisk tree we're setting up
27    #  FIGCONFIG_ENV_TYPE   Type of configuration environment - "config_file"  for config file with host-type->directory
28    #                       mappings, or "dir" tranditional single-environment configuration.
29  #  FIGCONFIG_ENV        Name of the environment we're configuring for  #  FIGCONFIG_ENV        Name of the environment we're configuring for
30    #  FIGCONFIG_ENV_CONFIG Location of enviroment configuration file.
31  #  FIGCONFIG_ENV_DIR    Directory in which the binary install tree for $FIGCONFIG_ENV lives  #  FIGCONFIG_ENV_DIR    Directory in which the binary install tree for $FIGCONFIG_ENV lives
32  #  FIGCONFIG_RELEASE    Release number we're configuring  #  FIGCONFIG_RELEASE    Release number we're configuring
33  #  FIGCONFIG_RELEASE_DIR Directory in which that release lives  #  FIGCONFIG_RELEASE_DIR Directory in which that release lives
# Line 36  Line 56 
56    
57      print "Here in the perl bootstrap. inc is:\n" . join("\n", @INC), "\n";      print "Here in the perl bootstrap. inc is:\n" . join("\n", @INC), "\n";
58    
59      my $my_prefix, $prefix, $inc, @newInc;      my ($my_prefix, $prefix, $inc, @newInc);
60    
61      $my_prefix = $ENV{FIGCONFIG_ENV_DIR};      $my_prefix = $ENV{FIGCONFIG_ENV_DIR};
62      open(P, "<$my_prefix/PREFIX");      open(P, "<$my_prefix/PREFIX");
# Line 101  Line 121 
121  #  #
122    
123  our $fig_disk = $ENV{FIG_HOME};  our $fig_disk = $ENV{FIG_HOME};
124    our $env_config_type = $ENV{FIGCONFIG_ENV_CONFIG_TYPE};
125    our $env_config_file = $ENV{FIGCONFIG_ENV_CONFIG_FILE};
126  our $env_name = $ENV{FIGCONFIG_ENV};  our $env_name = $ENV{FIGCONFIG_ENV};
127    our $env_dir = "$ENV{FIGCONFIG_ENV_DIR}";
128  our $env_bin = "$ENV{FIGCONFIG_ENV_DIR}/bin";  our $env_bin = "$ENV{FIGCONFIG_ENV_DIR}/bin";
129  our $env_lib = "$ENV{FIGCONFIG_ENV_DIR}/lib";  our $env_lib = "$ENV{FIGCONFIG_ENV_DIR}/lib";
130  #  #
# Line 111  Line 134 
134  #our $release_bin = "$ENV{FIGCONFIG_RELEASE_DIR}/bin/$ENV{FIGCONFIG_ENV}";  #our $release_bin = "$ENV{FIGCONFIG_RELEASE_DIR}/bin/$ENV{FIGCONFIG_ENV}";
135  #our $release_lib = "$ENV{FIGCONFIG_RELEASE_DIR}/lib/$ENV{FIGCONFIG_ENV}";  #our $release_lib = "$ENV{FIGCONFIG_RELEASE_DIR}/lib/$ENV{FIGCONFIG_ENV}";
136    
137  our $release_bin = "$fig_disk/dist/releases/current/bin/$ENV{FIGCONFIG_ENV}";  our $release_bin = "$fig_disk/dist/releases/current/$ENV{FIGCONFIG_ENV}/bin";
138  our $release_lib = "$fig_disk/dist/releases/current/lib/$ENV{FIGCONFIG_ENV}";  our $release_lib = "$fig_disk/dist/releases/current/$ENV{FIGCONFIG_ENV}/lib";
139    
140  our $fig_bin = "$fig_disk/FIG/bin";  our $fig_bin = "$fig_disk/FIG/bin";
141    
# Line 121  Line 144 
144  #  #
145  our $start_servers = "$fig_disk/bin/start-servers";  our $start_servers = "$fig_disk/bin/start-servers";
146  our $stop_servers = "$fig_disk/bin/stop-servers";  our $stop_servers = "$fig_disk/bin/stop-servers";
147    our $run_perl = "$fig_disk/bin/run_perl";
148    
149  sub configure_std_fig_environment  sub configure_std_fig_environment
150  {  {
# Line 130  Line 154 
154    
155      my $fig = "$fig_disk/FIG";      my $fig = "$fig_disk/FIG";
156      my $data = "$fig/Data";      my $data = "$fig/Data";
157        my $sproutData = "$fig/SproutData";
158    
159      my $hostname = `hostname`;      my $hostname = `hostname`;
160      chomp $hostname;      chomp $hostname;
161    
162      push(@$Config, ["fig_disk", $fig_disk, 1]);      push(@$Config, ["fig_disk", $fig_disk, 1]);
163      push(@$Config, ["blastmast", "$fig_disk/BLASTMAT", 1]);      push(@$Config, ["blastmat", "$fig_disk/BLASTMAT", 1]);
164      push(@$Config, ["fig", $fig, 1]);      push(@$Config, ["fig", $fig, 1]);
165      push(@$Config, ["bin", $fig_bin, 1]);      push(@$Config, ["bin", $fig_bin, 1]);
166        push(@$Config, ["env_config_type", $env_config_type, 1]);
167        if ($env_config_type eq 'config_file')
168        {
169            push(@$Config, ["env_config_file", $env_config_file, 1]);
170            push(@$Config, [{ perl => '&compute_env_values; ', python => '' }]);
171        }
172        else
173        {
174      push(@$Config, ["ext_bin", $env_bin, 1]);      push(@$Config, ["ext_bin", $env_bin, 1]);
175            push(@$Config, ["common_runtime", $env_dir, 1]);
176        }
177        push(@$Config, ["arch", $ENV{FIGCONFIG_ENV}, 1]);
178        push(@$Config, ["var", "$fig/var", 1]);
179      push(@$Config, ["data", $data, 1]);      push(@$Config, ["data", $data, 1]);
180      push(@$Config, ["global", "$data/Global", 1]);      push(@$Config, ["global", "$data/Global", 1]);
181      push(@$Config, ["organisms", "$data/Organisms", 1]);      push(@$Config, ["organisms", "$data/Organisms", 1]);
182      push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);      push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);
183      push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);      push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);
184      push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);      push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);
185      push(@$Config, ["temp_url", "http://$hostname/FIG-Tmp", 1]);      push(@$Config, ["sproutData", $sproutData, 1]);
186      push(@$Config, ["cgi_url", "http://$hostname/FIG", 1]);  
187        my $sandbox;
188        if ($ENV{FIGCONFIG_SANDBOX})
189        {
190            $sandbox = "/$ENV{FIGCONFIG_SANDBOX}";
191        }
192    
193        push(@$Config, ["temp_url", "http://$hostname$sandbox/FIG-Tmp", 1]);
194        push(@$Config, ["cgi_url", "http://$hostname$sandbox/FIG", 1]);
195    
196        #
197        # Add values for a relative base href of temp and CGI pages.  The latter
198        # is used by HHTP.pm to write common page start.  It would make the most
199        # sense to derive the above 2 values from these.  -- GJO
200        #
201    
202        push(@$Config, ["temp_base", "$sandbox/FIG-Tmp/", 1]);
203        push(@$Config, ["cgi_base", "$sandbox/FIG/", 1]);
204    
205        push(@$Config, [ { perl => <<'END' }]);
206    sub compute_env_values
207    {
208        return if defined($FIG_Config::hosttype);
209    
210        my $hosttype = `bash -c 'echo \$HOSTTYPE'`;
211        if ($hosttype eq '')
212        {
213            die "Error retrieving hosttype; bash failed with rc=$?";
214        }
215        chomp $hosttype;
216        open(CF, "<$FIG_Config::env_config_file") or
217            die "Cannot open $FIG_Config::env_config_file: $!";
218        my $found;
219        while (<CF>)
220        {
221            if (/^$hosttype\t(\S+)/)
222            {
223                $found++;
224                $FIG_Config::common_runtime = $1;
225                $FIG_Config::env_bin = "$1/bin";
226                $FIG_Config::hosttype = $hosttype;
227                $found++;
228                last;
229            }
230        }
231        $found or die "Could not find binary directory for hosttype $hosttype in $FIG_Config::env_config_file";
232    }
233    END
234  }  }
235    
236  sub compute_environment  sub compute_environment
# Line 157  Line 241 
241    
242      push(@$Env, ["RTROOT", $ENV{FIG_HOME}, 0]);      push(@$Env, ["RTROOT", $ENV{FIG_HOME}, 0]);
243      push(@$Env, ["RTDIST", "\$RTROOT/dist", 0]);      push(@$Env, ["RTDIST", "\$RTROOT/dist", 0]);
244        push(@$Env, ["RTSITECONFIGDIR", "\$RTROOT/config", 0]);
245      push(@$Env, ["RTARCH", $ENV{FIGCONFIG_ENV}, 0]);      push(@$Env, ["RTARCH", $ENV{FIGCONFIG_ENV}, 0]);
246      push(@$Env, ["RTCURRENT", "`cat \$RTROOT/CURRENT_RELEASE`", 0]);      push(@$Env, ["RTCURRENT", "`cat \$RTROOT/CURRENT_RELEASE`", 0]);
247      push(@$Env, ["FIG_HOME", $ENV{FIG_HOME}, 0]);      push(@$Env, ["FIG_HOME", $ENV{FIG_HOME}, 0]);
# Line 171  Line 256 
256      #      #
257    
258      my @path = ();      my @path = ();
     push(@path, $env_bin);  
259      push(@path, $fig_bin);      push(@path, $fig_bin);
260        if ($env_config_type eq 'dir')
261        {
262            push(@path, $env_bin);
263        }
264      push(@path, "$fig_disk/bin");      push(@path, "$fig_disk/bin");
265    
266      push(@$Env, ["PATH", join(":", @path), 1]);      push(@$Env, ["PATH", join(":", @path), 1]);
267    
268      push(@$Env, ["LD_LIBRARY_PATH", "${env_lib}", 1]);      #
269        # Compute  LD_LIBRARY_PATH.
270        #
271        # Some packages, like mysql, place their shared libs in subdirectories
272        # of the libdir.
273        #
274        # We can only do this if we're configured with an env dir.
275        #
276    
277        if ($env_config_type eq 'dir')
278        {
279            my @ld_path = ($env_lib);
280    
281            my $dh;
282            if (!opendir($dh, $env_lib))
283            {
284                warn "Could not opendir $env_lib: $!";
285            }
286    
287            while ($_ = readdir($dh))
288            {
289                next if /^\./;
290    
291                my $path = "$env_lib/$_";
292                next unless -d $path;
293    
294                #
295                # See if there are any .so's in here.
296                #
297    
298                my @solist = <$path/*.so*>;
299                if (@solist > 0)
300                {
301                    push(@ld_path, $path);
302                }
303            }
304            closedir($dh);
305    
306            #
307            # And if perl is dynamically linked, we need to add the perl core directory
308            # to the path too.
309            #
310    
311            my @coredir = <$env_lib/perl5/*/*/CORE>;
312            if (@coredir)
313            {
314                if ( -f "$coredir[0]/libperl.so" )
315                {
316                    print "Found libperl in $coredir[0]\n";
317                    push(@ld_path, $coredir[0]);
318                }
319            }
320    
321            my $ld_path = join(":", @ld_path);
322            $OtherConfig->{ld_library_path} = $ld_path;
323    
324            push(@$Env, ["LD_LIBRARY_PATH", $ld_path, 1]);
325        }
326    
327        #
328        # If we're configuring with an env dir, we start with our @INC that we
329        # found. Otherwise we just append.
330        #
331    
332        my @perllib;
333        if ($env_config_type eq 'dir')
334        {
335            @perllib = grep({ $_ ne "." } @INC);
336        }
337    
338        push(@perllib,
339             $release_lib,
340             "$release_lib/FigKernelPackages",
341             "$release_lib/WebApplication",
342             "$release_lib/FortyEight",
343             "$release_lib/PPO",
344             "$fig_disk/config");
345    
346        push(@$Env, ["PERL5LIB", join(":", @perllib), 1]);
347  }  }
348    
349  sub configure_python  sub configure_python
# Line 200  Line 366 
366      chomp $py_version;      chomp $py_version;
367      print "Python version $py_version\n";      print "Python version $py_version\n";
368    
369      $OtherConfig->{python_site_path} = "$ENV{FIGCONFIG_ENV_DIR}/lib/python$py_version/site-packages";      #
370        # Python figures this out for us.
371        #$OtherConfig->{python_site_path} = "$ENV{FIGCONFIG_ENV_DIR}/lib/python$py_version/site-packages";
372    
373      my @path = ();      my @path = ();
374      push(@path, $OtherConfig->{python_site_path});      #push(@path, $OtherConfig->{python_site_path});
375      push(@path, "$release_lib");      push(@path, "$release_lib");
376      push(@path, "$fig_disk/config");      push(@path, "$fig_disk/config");
377      push(@$Env, ["PYTHONPATH", join(":", @path), 1]);      push(@$Env, ["PYTHONPATH", join(":", @path), 1]);
# Line 213  Line 381 
381    
382  sub find_in_path  sub find_in_path
383  {  {
384      my($file) = @_;      my($file, @extra) = @_;
385      my(@path) = split(":", $ENV{PATH});      my(@path) = split(":", $ENV{PATH});
386    
387      for my $p (@path)      for my $p (@path, @extra)
388      {      {
389          my $x = "$p/$file";          my $x = "$p/$file";
390          if (-x $x)          if (-x $x)
# Line 237  Line 405 
405      #      #
406      # Special case for the mac.      # Special case for the mac.
407      #      #
408        # RDO 20040603 - don't do this any more; we want to pick up
409        # the python we ship.
410        #
411    
412      if ($ENV{FIGCONFIG_ENV} eq "mac")      if (0 && $ENV{FIGCONFIG_ENV} eq "mac")
413      {      {
414          if ($python = find_in_path("pythonw"))          #
415            # We'd like to use the MacPython that is installed
416            # as pythonw.
417            #
418            if ($python = find_in_path("pythonw", "/usr/local/bin"))
419          {          {
420                $OtherConfig->{python_require_poundbang_env} = 1;
421              return $python;              return $python;
422          }          }
423    
424          #          #
425          # Didn't find it in the path; we require the          # Otherwise, we can live with the regular python.
426          # MacPython build, and that installs into          # Fall thru to the generic case.
         # /usr/local/bin/pythonw by default.  
427          #          #
   
         return "/usr/local/bin/pythonw";  
428      }      }
     else  
     {  
429          #          #
430          # Non-mac, just look in the env dir or the path.          # Non-mac, just look in the env dir or the path.
431          #          #
# Line 262  Line 433 
433          $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";          $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";
434          if (-x $python)          if (-x $python)
435          {          {
436            #
437            # The mac doesn't seem to like the long #! lines, so we'll use poundbang env.
438            #
439            if ($ENV{FIGCONFIG_ENV} =~ /^mac/)
440            {
441                $OtherConfig->{python_require_poundbang_env} = 1;
442            }
443              return $python;              return $python;
444          }          }
445    
446          return find_in_path("python");          return find_in_path("python");
447      }      }
 }  
448    
449  #  #
450  # Find the name of the perl executable we are to use.  # Find the name of the perl executable we are to use.
# Line 276  Line 453 
453  {  {
454      my $perl;      my $perl;
455    
456        if ($env_config_type eq 'config_file')
457        {
458            return $run_perl;
459        }
460    
461      $perl = "$ENV{FIGCONFIG_ENV_DIR}/bin/perl";      $perl = "$ENV{FIGCONFIG_ENV_DIR}/bin/perl";
462      if (-x $perl)      if (-x $perl)
463      {      {
# Line 305  Line 487 
487  if [ -n "\$$name" ] ; then  if [ -n "\$$name" ] ; then
488      DELIM=:      DELIM=:
489  fi  fi
490  $name=\${$name}\${DELIM}$value  $name=$value\${DELIM}\${$name}
491  export $name  export $name
492  END  END
493          }          }
# Line 315  Line 497 
497              print $fh "export $name\n";              print $fh "export $name\n";
498          }          }
499      }      }
500    
501        #
502        # If we're configuring from a config file, add the code to set up the PATH with the
503        # right ext_bin.
504        #
505        if ($env_config_type eq 'config_file')
506        {
507            print $fh "export FIG_ENV_CONFIG_FILE='$env_config_file'\n";
508            print $fh <<'END';
509    env_dir=`awk "\\$1 == \"$HOSTTYPE\" { print \\$2 }" $FIG_ENV_CONFIG_FILE`
510    export PATH=$env_dir/bin:${PATH}
511    END
512        }
513    
514        print $fh "alias rtpath='source \$RTDIST/releases/\$RTCURRENT/ReleaseTools/RTPath.sh'\n";
515  }  }
516    
517  sub write_csh_init  sub write_csh_init
# Line 333  Line 530 
530    
531              print $fh <<END;              print $fh <<END;
532  if (\$?$name) then  if (\$?$name) then
533      setenv $name \${$name}:$value      setenv $name $value:\${$name}
534  else  else
535      setenv $name $value      setenv $name $value
536  endif  endif
# Line 345  Line 542 
542          }          }
543      }      }
544    
545        #
546        # Alias for RT stuff.
547        #
548        print $fh "alias rtpath 'source \$RTDIST/releases/\$RTCURRENT/ReleaseTools/RTPath.csh'\n";
549  }  }
550    
551  sub run_script  sub run_script
# Line 423  Line 624 
624    
625  }  }
626    
627    sub write_run_perl
628    {
629        unlink($run_perl);
630        open(F, ">$run_perl") or die "Cannot write $run_perl: $!";
631    
632        print F "#!/bin/sh\n\n";
633    
634        print F ". $fig_disk/config/fig-user-env.sh\n\n";
635    
636        if ($env_config_type eq 'config_file')
637        {
638            print F <<'END';
639    env_dir=`awk "\\$1 == \"$HOSTTYPE\" { print \\$2 }" $FIG_ENV_CONFIG_FILE`
640    perl="$env_dir/bin/perl"
641    END
642        }
643        else
644        {
645            print F "perl=$env_dir/bin/perl\n";
646        }
647        print F 'exec $perl "$@"' . "\n";
648        close(F);
649    
650    }
651    
652    sub finalize_server_scripts
653    {
654        #
655        # After any environment-specific stuff, call start_services and stop_services.
656        #
657    
658        open(F, ">>$start_servers") or die "Cannot write $start_servers: $!";
659        print F "\n$fig_bin/start_services\n";
660        close(F);
661        chmod(0775, $start_servers);
662    
663        open(F, ">>$stop_servers") or die "Cannot write $stop_servers: $!";
664        print F "\n$fig_bin/stop_services\n";
665        close(F);
666        chmod(0775, $stop_servers);
667    
668    }
669    
670  sub write_config_pm  sub write_config_pm
671  {  {
672      my($fh, $config) = @_;      my($fh, $config) = @_;
# Line 433  Line 677 
677      {      {
678          my($name, $value, $quote) = @$item;          my($name, $value, $quote) = @$item;
679    
680            #
681            # special code for non-var=value items.
682            #
683            if (ref($name) eq 'HASH')
684            {
685                my $l = $name->{perl};
686                if ($l ne '')
687                {
688                    print $fh "$l\n";
689                }
690            }
691            else
692            {
693          my $q = $quote ? '"' : '';          my $q = $quote ? '"' : '';
694          printf $fh "\$%-15s = $q$value$q;\n", $name              printf $fh "\$%-15s = $q$value$q;\n", $name;
695            }
696      }      }
697    
698      print $fh "\n1;\n";      print $fh "\n1;\n";
# Line 449  Line 707 
707          my($name, $value, $quote) = @$item;          my($name, $value, $quote) = @$item;
708    
709          #          #
710            # special code for non-var=value items.
711            #
712            if (ref($name) eq 'HASH')
713            {
714                my $l = $name->{python};
715                if ($l ne '')
716                {
717                    print $fh "$l\n";
718                }
719            }
720            else
721            {
722                #
723          # Ugh. "global" is a keyword in python.          # Ugh. "global" is a keyword in python.
724          #          #
725    
726          $name = "global_dir" if $name eq "global";          $name = "global_dir" if $name eq "global";
727    
728          my $q = $quote ? '"' : '';          my $q = $quote ? '"' : '';
729          printf $fh "%-15s = $q$value$q\n", $name              printf $fh "%-15s = $q$value$q\n", $name;
730            }
731      }      }
732  }  }
733    
# Line 507  Line 779 
779    
780      print $fh "use FIG_Config;\n";      print $fh "use FIG_Config;\n";
781      print $fh "\n";      print $fh "\n";
782        print $fh "#### END tool_hdr ####\n\n"
783  }  }
784    
785  sub write_tool_hdr_python  sub write_tool_hdr_python
# Line 515  Line 788 
788    
789      my $python = find_python();      my $python = find_python();
790    
791        if ($OtherConfig->{python_require_poundbang_env})
792        {
793            print $fh "#!/usr/bin/env $python\n";
794        }
795        else
796        {
797      print $fh "#!$python\n";      print $fh "#!$python\n";
798        }
799      print $fh "\n";      print $fh "\n";
800    
801      print $fh "import sys\n";      print $fh "import sys, os\n";
802    
803    
804      print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";      print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";
805    
806        #
807        # Append the perl path to the environment, for use later with CallPerl.
808        #
809    
810        my $perlpath = join(":", @INC, $release_lib, "$release_lib/FigKernelPackages", "$fig_disk/config");
811        print $fh <<END;
812    if os.getenv("PERL5LIB", "") != "":
813        _delim = ":"
814    else:
815        _delim = ""
816    os.environ["PERL5LIB"] = "$perlpath" + _delim + os.getenv("PERL5LIB", "")
817    
818    END
819    
820      print $fh "# Following block is expanded by switch_to_release to add use lib directives\n";      print $fh "# Following block is expanded by switch_to_release to add use lib directives\n";
821      print $fh "# to point at the correct locations in the release directory.\n";      print $fh "# to point at the correct locations in the release directory.\n";
822      print $fh "#BEGIN switch_to_release generated code\n";      print $fh "#BEGIN switch_to_release generated code\n";
# Line 533  Line 827 
827    
828      print $fh "import FIG_Config\n";      print $fh "import FIG_Config\n";
829      print $fh "\n";      print $fh "\n";
830        print $fh "#### END tool_hdr_py ####\n\n"
831    }
832    
833    sub write_rtconfig
834    {
835        my($fh) = @_;
836    
837        my $python = find_python();
838        my $perl = find_perl();
839    
840        print $fh "RTPYTHON=$python\n";
841        print $fh "RTPERL=$perl\n";
842        print $fh "RTPYTHONPATH=$OtherConfig->{pythonpath}\n";
843    
844        my %seen;
845        my @perlpath;
846        for (@INC, "$fig_disk/config")
847        {
848            next if $seen{$_};
849            push(@perlpath, $_);
850            $seen{$_}++;
851        }
852        my $perlpath = join(":", @perlpath);
853    
854        print $fh "RTPERL5LIB=$perlpath\n";
855    
856        print $fh "RTPYTHONIMPORTS=FIG_Config\n";
857        print $fh "RTPERLIMPORTS=FIG_Config\n";
858        print $fh "RTSETENV=BLASTMAT=$fig_disk/BLASTMAT\n";
859        print $fh "RTSETENV=FIG_HOME=$fig_disk\n";
860        print $fh "#RTLD_LDPATH=$OtherConfig->{ld_library_path}\n";
861  }  }
862    
863  setup_directories("$fig_disk/bin",  setup_directories("$fig_disk/bin",
864                    "$fig_disk/config");                    "$fig_disk/config");
865    
866  setup_server_scripts();  setup_server_scripts();
867    write_run_perl();
868    
869  find_python();  find_python();
870    
# Line 547  Line 872 
872  configure_std_fig_environment();  configure_std_fig_environment();
873  configure_python();  configure_python();
874  configure_environment_specific();  configure_environment_specific();
875    # configure_database();
876    
877    finalize_server_scripts();
878    
879  #  #
880  # Write the shell startup to the figdisk.  # Write the shell startup to the figdisk.
# Line 583  Line 911 
911  write_tool_hdr_python(\*FH);  write_tool_hdr_python(\*FH);
912  close(FH);  close(FH);
913    
914    open(FH, ">$fig_disk/config/RTConfig") or die "Cannot write $fig_disk/config/RTConfig: $!";
915    write_rtconfig(\*FH);
916    close(FH);
917    
918  unshift(@INC, "$ENV{FIGCONFIG_RELEASE_DIR}");  unshift(@INC, "$ENV{FIGCONFIG_RELEASE_DIR}");
919    
920  require FigCommon::SwitchRelease;  require FigCommon::SwitchRelease;
921    
922    #
923    # We need to tweak the current path and PERL5LIB environment to get bootstrapping to
924    # work correctly.
925    #
926    
927    $ENV{PATH} = "$ENV{FIGCONFIG_ENVDIR}/bin:$ENV{PATH}";
928    
929    $ENV{PERL5LIB} = (map { $_->[1] } grep { $_->[0] eq "PERL5LIB"} @$Env)[0];
930    
931  &FigCommon::SwitchRelease::switch_to_release($fig_disk, $ENV{FIGCONFIG_ENV}, $ENV{FIGCONFIG_RELEASE});  &FigCommon::SwitchRelease::switch_to_release($fig_disk, $ENV{FIGCONFIG_ENV}, $ENV{FIGCONFIG_RELEASE});

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.31

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3