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

Annotation of /FigCommon/bootstrap.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (view) (download) (as text)

1 : olson 1.1 #
2 :     # FIG bootstrap script.
3 :     #
4 :     # Control is passed here from the toplevel configure (or dists/releases/install depending
5 :     # on how far we've gotten in the process).
6 :     #
7 :     # The configure has set the following environment variables for our use:
8 :     #
9 :     # FIG_HOME Root of the FIGdisk tree we're setting up
10 :     # FIGCONFIG_ENV Name of the environment we're configuring for
11 :     # FIGCONFIG_ENV_DIR Directory in which the binary install tree for $FIGCONFIG_ENV lives
12 :     # FIGCONFIG_RELEASE Release number we're configuring
13 :     # FIGCONFIG_RELEASE_DIR Directory in which that release lives
14 :     #
15 :     # Important note: perl system libraries may not be available when this
16 :     # script is running, if the FIGCONFIG_ENV_DIR is different than it was
17 :     # when the binaries were created. Part of the task of this
18 :     # script is to recognize this case and configure the process
19 :     # environment correctly so that the post-install process as
20 :     # handled by the Makefiles can use perl properly, without concern for paths.
21 :     #
22 :    
23 :     #
24 :     # Look into the FIGCONFIG_ENV_DIR for the PREFIX that this
25 :     # environment was compiled on. If that directory is different
26 :     # than the one we're currently using, rewrite @INC accordingly.
27 :     #
28 :     # We put this into a BEGIN block so that we can later use "use"
29 :     # without worrying about paths.
30 :     #
31 :     # We also set the $perlenv_override to true if we've done this,
32 :     # so we can insert these fixes into the perl tool header.
33 :     #
34 :    
35 :     BEGIN {
36 :    
37 : olson 1.3 print "Here in the perl bootstrap. inc is:\n" . join("\n", @INC), "\n";
38 : olson 1.1
39 :     my $my_prefix, $prefix, $inc, @newInc;
40 :    
41 :     $my_prefix = $ENV{FIGCONFIG_ENV_DIR};
42 :     open(P, "<$my_prefix/PREFIX");
43 :     $prefix = <P>;
44 :     chomp $prefix;
45 :    
46 :    
47 :     # print "Prefix is $prefix myprefix=$my_prefix\n";
48 :    
49 :     if ($prefix ne $my_prefix)
50 :     {
51 :     @newInc = ();
52 :     for $inc (@INC)
53 :     {
54 :     $inc =~ s,^$prefix,$my_prefix,;
55 :     push(@newInc, $inc);
56 :     }
57 :    
58 :     $::perlenv_override = 1;
59 : olson 1.3 @INC = @newInc;
60 : olson 1.1 }
61 :     }
62 :    
63 :    
64 :     use FileHandle;
65 :     use strict;
66 :    
67 :     #
68 :     # Environment definition
69 :     #
70 :     # This list contains triples
71 :     # ($name, $value, $appendFlag). $name is the name of the
72 :     # variable; $value is the value to set, and $appendFlag
73 :     # is nonzero if we need to append this value to an existing
74 :     # environment variable.
75 :     #
76 :    
77 :     our $Env = [];
78 :    
79 :     #
80 :     # FIG configuration information.
81 :     # This list contains tuples [$name, $value, $quote]
82 :     # which are to be set in the FIG_Config modules for
83 :     # both python and perl. $quote is 1 for things that need
84 :     # to be quoted, 0 otherwise.
85 :     #
86 :     our $Config = [];
87 :    
88 :     #
89 :     # Other key/value pairs of stuff we may need to pass
90 :     # to and from the environment-specific configuration modules.
91 :     #
92 :     # Known keys:
93 :     #
94 :     # pythonpath
95 :     #
96 :    
97 :     our $OtherConfig = {};
98 :    
99 :     #
100 :     # Cache values of the various places we may be installing things.
101 :     #
102 :    
103 :     our $fig_disk = $ENV{FIG_HOME};
104 :     our $env_name = $ENV{FIGCONFIG_ENV};
105 : olson 1.7 our $env_dir = "$ENV{FIGCONFIG_ENV_DIR}";
106 : olson 1.1 our $env_bin = "$ENV{FIGCONFIG_ENV_DIR}/bin";
107 :     our $env_lib = "$ENV{FIGCONFIG_ENV_DIR}/lib";
108 : olson 1.2 #
109 :     # We are moving to use a symlink in dist/releases/current for these.
110 :     # This symlink is managed by switch_to_release.
111 :     #
112 :     #our $release_bin = "$ENV{FIGCONFIG_RELEASE_DIR}/bin/$ENV{FIGCONFIG_ENV}";
113 :     #our $release_lib = "$ENV{FIGCONFIG_RELEASE_DIR}/lib/$ENV{FIGCONFIG_ENV}";
114 :    
115 : olson 1.8 our $release_bin = "$fig_disk/dist/releases/current/$ENV{FIGCONFIG_ENV}/bin";
116 :     our $release_lib = "$fig_disk/dist/releases/current/$ENV{FIGCONFIG_ENV}/lib";
117 : olson 1.2
118 :     our $fig_bin = "$fig_disk/FIG/bin";
119 : olson 1.1
120 :     #
121 :     # Location of start/stop servers scripts.
122 :     #
123 :     our $start_servers = "$fig_disk/bin/start-servers";
124 :     our $stop_servers = "$fig_disk/bin/stop-servers";
125 :    
126 :     sub configure_std_fig_environment
127 :     {
128 :     #
129 :     # Populate the Config with the usual stuff we need in FIG_Config.pm.
130 :     #
131 :    
132 :     my $fig = "$fig_disk/FIG";
133 :     my $data = "$fig/Data";
134 : olson 1.21 my $sproutData = "$fig/SproutData";
135 : olson 1.1
136 :     my $hostname = `hostname`;
137 :     chomp $hostname;
138 :    
139 :     push(@$Config, ["fig_disk", $fig_disk, 1]);
140 : olson 1.6 push(@$Config, ["blastmat", "$fig_disk/BLASTMAT", 1]);
141 : olson 1.1 push(@$Config, ["fig", $fig, 1]);
142 : olson 1.2 push(@$Config, ["bin", $fig_bin, 1]);
143 : olson 1.1 push(@$Config, ["ext_bin", $env_bin, 1]);
144 : olson 1.18 push(@$Config, ["common_runtime", $env_dir, 1]);
145 :     push(@$Config, ["arch", $ENV{FIGCONFIG_ENV}, 1]);
146 : olson 1.22 push(@$Config, ["var", "$fig/var", 1]);
147 : olson 1.1 push(@$Config, ["data", $data, 1]);
148 :     push(@$Config, ["global", "$data/Global", 1]);
149 :     push(@$Config, ["organisms", "$data/Organisms", 1]);
150 :     push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);
151 :     push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);
152 :     push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);
153 : olson 1.21 push(@$Config, ["sproutData", $sproutData, 1]);
154 : olson 1.11
155 :     my $sandbox;
156 :     if ($ENV{FIGCONFIG_SANDBOX})
157 :     {
158 :     $sandbox = "/$ENV{FIGCONFIG_SANDBOX}";
159 :     }
160 :    
161 :     push(@$Config, ["temp_url", "http://$hostname$sandbox/FIG-Tmp", 1]);
162 :     push(@$Config, ["cgi_url", "http://$hostname$sandbox/FIG", 1]);
163 : golsen 1.9
164 :     #
165 :     # Add values for a relative base href of temp and CGI pages. The latter
166 :     # is used by HHTP.pm to write common page start. It would make the most
167 :     # sense to derive the above 2 values from these. -- GJO
168 :     #
169 :    
170 : olson 1.11 push(@$Config, ["temp_base", "$sandbox/FIG-Tmp/", 1]);
171 :     push(@$Config, ["cgi_base", "$sandbox/FIG/", 1]);
172 : olson 1.1 }
173 :    
174 :     sub compute_environment
175 :     {
176 :     #
177 :     # ReleaseTools configuration.
178 :     #
179 :    
180 :     push(@$Env, ["RTROOT", $ENV{FIG_HOME}, 0]);
181 :     push(@$Env, ["RTDIST", "\$RTROOT/dist", 0]);
182 : olson 1.23 push(@$Env, ["RTSITECONFIGDIR", "\$RTROOT/config", 0]);
183 : olson 1.1 push(@$Env, ["RTARCH", $ENV{FIGCONFIG_ENV}, 0]);
184 : olson 1.2 push(@$Env, ["RTCURRENT", "`cat \$RTROOT/CURRENT_RELEASE`", 0]);
185 : olson 1.1 push(@$Env, ["FIG_HOME", $ENV{FIG_HOME}, 0]);
186 :    
187 :     push(@$Env, ["BLASTMAT", "$ENV{FIG_HOME}/BLASTMAT", 0]);
188 :    
189 :     #
190 :     # Determine the path to use.
191 :     #
192 :     # This includes the path into the particular release we're configuring for,
193 :     # and to the environment's bin directory.
194 :     #
195 :    
196 :     my @path = ();
197 : olson 1.24 push(@path, $fig_bin);
198 : olson 1.1 push(@path, $env_bin);
199 :     push(@path, "$fig_disk/bin");
200 :    
201 :     push(@$Env, ["PATH", join(":", @path), 1]);
202 :    
203 : olson 1.2 push(@$Env, ["LD_LIBRARY_PATH", "${env_lib}", 1]);
204 : olson 1.11
205 : olson 1.23 my @perllib = grep({ $_ ne "." } @INC,
206 :     $release_lib,
207 :     "$release_lib/FigKernelPackages",
208 :     "$fig_disk/config");
209 : olson 1.12
210 :     push(@$Env, ["PERL5LIB", join(":", @perllib), 1]);
211 : olson 1.1 }
212 :    
213 :     sub configure_python
214 :     {
215 :     #
216 :     # Determine the PYTHONPATH we're to use.
217 :     #
218 :     # Right now, we don't compute a replacement for the system path,
219 :     # but we're likely going to require that *if* python is
220 :     # distributed with the environment. We're currently not doing that.
221 :     #
222 :     # So we just need to point to any python packages in the release,
223 :     # and to packages that were installed in the environment dir.
224 :     #
225 :    
226 :     my $python = find_python();
227 :     print "Found python at $python\n";
228 :    
229 :     my $py_version = `$python -c 'import sys; print "%d.%d" % (sys.version_info[:2])'`;
230 :     chomp $py_version;
231 :     print "Python version $py_version\n";
232 :    
233 : olson 1.23 #
234 :     # Python figures this out for us.
235 :     #$OtherConfig->{python_site_path} = "$ENV{FIGCONFIG_ENV_DIR}/lib/python$py_version/site-packages";
236 : olson 1.2
237 : olson 1.1 my @path = ();
238 : olson 1.23 #push(@path, $OtherConfig->{python_site_path});
239 : olson 1.2 push(@path, "$release_lib");
240 : olson 1.1 push(@path, "$fig_disk/config");
241 :     push(@$Env, ["PYTHONPATH", join(":", @path), 1]);
242 :    
243 :     $OtherConfig->{pythonpath} = join(":", @path);
244 :     }
245 :    
246 :     sub find_in_path
247 :     {
248 : olson 1.5 my($file, @extra) = @_;
249 : olson 1.1 my(@path) = split(":", $ENV{PATH});
250 :    
251 : olson 1.5 for my $p (@path, @extra)
252 : olson 1.1 {
253 :     my $x = "$p/$file";
254 :     if (-x $x)
255 :     {
256 :     return $x;
257 :     }
258 :     }
259 :     return undef;
260 :     }
261 :    
262 :     #
263 :     # Find the name of the python executable we are to use.
264 :     #
265 :     sub find_python
266 :     {
267 :     my $python;
268 :    
269 :     #
270 :     # Special case for the mac.
271 :     #
272 : olson 1.11 # RDO 20040603 - don't do this any more; we want to pick up
273 :     # the python we ship.
274 :     #
275 : olson 1.1
276 : olson 1.11 if (0 && $ENV{FIGCONFIG_ENV} eq "mac")
277 : olson 1.1 {
278 : olson 1.7 #
279 :     # We'd like to use the MacPython that is installed
280 :     # as pythonw.
281 :     #
282 :     if ($python = find_in_path("pythonw", "/usr/local/bin"))
283 : olson 1.1 {
284 : olson 1.7 $OtherConfig->{python_require_poundbang_env} = 1;
285 : olson 1.1 return $python;
286 :     }
287 :    
288 :     #
289 : olson 1.7 # Otherwise, we can live with the regular python.
290 :     # Fall thru to the generic case.
291 : olson 1.1 #
292 : olson 1.7 }
293 :     #
294 :     # Non-mac, just look in the env dir or the path.
295 :     #
296 : olson 1.1
297 : olson 1.7 $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";
298 :     if (-x $python)
299 :     {
300 : olson 1.13 #
301 :     # The mac doesn't seem to like the long #! lines, so we'll use poundbang env.
302 :     #
303 : olson 1.15 if ($ENV{FIGCONFIG_ENV} =~ /^mac/)
304 : olson 1.13 {
305 :     $OtherConfig->{python_require_poundbang_env} = 1;
306 :     }
307 : olson 1.7 return $python;
308 : olson 1.1 }
309 :    
310 : olson 1.7 return find_in_path("python");
311 : olson 1.1 }
312 :    
313 :     #
314 :     # Find the name of the perl executable we are to use.
315 :     #
316 :     sub find_perl
317 :     {
318 :     my $perl;
319 :    
320 :     $perl = "$ENV{FIGCONFIG_ENV_DIR}/bin/perl";
321 :     if (-x $perl)
322 :     {
323 :     return $perl;
324 :     }
325 :    
326 :     warn "We did not find a perl executable in the SEED distribution; some modules may not be found\n";
327 :     return find_in_path("perl");
328 :     }
329 :    
330 :     sub write_bash_init
331 :     {
332 :     my($fh, $env) = @_;
333 :    
334 :     foreach my $item (@$env)
335 :     {
336 :     my($name, $value, $append) = @$item;
337 :    
338 :     if ($append)
339 :     {
340 :     #
341 :     # Write code to detect if the value is set, and act accordingly.
342 :     #
343 :    
344 :     print $fh <<END;
345 :     DELIM=
346 :     if [ -n "\$$name" ] ; then
347 :     DELIM=:
348 :     fi
349 : olson 1.10 $name=$value\${DELIM}\${$name}
350 : olson 1.1 export $name
351 :     END
352 :     }
353 :     else
354 :     {
355 :     print $fh "$name=\"$value\"\n";
356 :     print $fh "export $name\n";
357 :     }
358 :     }
359 : olson 1.20 print $fh "alias rtpath='source \$RTDIST/releases/\$RTCURRENT/ReleaseTools/RTPath.sh'\n";
360 : olson 1.1 }
361 :    
362 :     sub write_csh_init
363 :     {
364 :     my($fh, $env) = @_;
365 :    
366 :     foreach my $item (@$env)
367 :     {
368 :     my($name, $value, $append) = @$item;
369 :    
370 :     if ($append)
371 :     {
372 :     #
373 :     # Write code to detect if the value is set, and act accordingly.
374 :     #
375 :    
376 :     print $fh <<END;
377 :     if (\$?$name) then
378 : olson 1.10 setenv $name $value:\${$name}
379 : olson 1.1 else
380 :     setenv $name $value
381 :     endif
382 :     END
383 :     }
384 :     else
385 :     {
386 :     print $fh "setenv $name \"$value\"\n";
387 :     }
388 :     }
389 :    
390 : olson 1.20 #
391 :     # Alias for RT stuff.
392 :     #
393 :     print $fh "alias rtpath 'source \$RTDIST/releases/\$RTCURRENT/ReleaseTools/RTPath.csh'\n";
394 : olson 1.1 }
395 :    
396 :     sub run_script
397 :     {
398 :     my($script) = @_;
399 :    
400 :    
401 :     unless (my $ret = do $script)
402 :     {
403 :     if ($@)
404 :     {
405 :     warn "Error parsing $script: $@\n";
406 :     }
407 :     elsif (!defined($ret))
408 :     {
409 :     warn "Couldn't do $script: $!\n";
410 :     }
411 :     else
412 :     {
413 :     warn "Counldn't run $script\n";
414 :     }
415 :     }
416 :    
417 :    
418 :     }
419 :    
420 :     sub configure_environment_specific
421 :     {
422 :     my $env_script = $ENV{FIGCONFIG_ENV_CONFIG};
423 :    
424 :     if (! -f $env_script)
425 :     {
426 :     warn "No environment-specific configuration file $env_script found, skipping\n";
427 :     return;
428 :     }
429 :    
430 :     run_script($env_script);
431 :     }
432 :    
433 :     #
434 :     # Create any directories that might be missing.
435 :     #
436 :    
437 :     sub setup_directories
438 :     {
439 :     my(@needed) = @_;
440 :    
441 :     for my $dir (@needed)
442 :     {
443 :     if (! -d $dir)
444 :     {
445 :     mkdir($dir) or warn "Could not create $dir: $!\n";
446 :     }
447 :     }
448 :     }
449 :    
450 :     sub setup_server_scripts
451 :     {
452 :     #
453 :     # Remove any start/stop servers scripts we might have, and write the stub
454 :     # start.
455 :     #
456 :    
457 :     unlink($start_servers);
458 :     unlink($stop_servers);
459 :    
460 :     open(F, ">$start_servers") or die "Cannot write $start_servers: $!";
461 :     print F "#!/bin/sh\n\n";
462 :     close(F);
463 :     chmod(0775, $start_servers);
464 :    
465 :     open(F, ">$stop_servers") or die "Cannot write $stop_servers: $!";
466 :     print F "#!/bin/sh\n\n";
467 :     close(F);
468 :     chmod(0775, $stop_servers);
469 :    
470 :     }
471 :    
472 : olson 1.7 sub finalize_server_scripts
473 :     {
474 :     #
475 :     # After any environment-specific stuff, call start_services and stop_services.
476 :     #
477 :    
478 :     open(F, ">>$start_servers") or die "Cannot write $start_servers: $!";
479 :     print F "\n$fig_bin/start_services\n";
480 :     close(F);
481 :     chmod(0775, $start_servers);
482 :    
483 :     open(F, ">>$stop_servers") or die "Cannot write $stop_servers: $!";
484 :     print F "\n$fig_bin/stop_services\n";
485 :     close(F);
486 :     chmod(0775, $stop_servers);
487 :    
488 :     }
489 :    
490 : olson 1.1 sub write_config_pm
491 :     {
492 :     my($fh, $config) = @_;
493 :    
494 :     print $fh "package FIG_Config;\n\n";
495 :    
496 :     foreach my $item (@$config)
497 :     {
498 :     my($name, $value, $quote) = @$item;
499 :    
500 :     my $q = $quote ? '"' : '';
501 :     printf $fh "\$%-15s = $q$value$q;\n", $name
502 :     }
503 :    
504 :     print $fh "\n1;\n";
505 :     }
506 :    
507 :     sub write_config_py
508 :     {
509 :     my($fh, $config) = @_;
510 :    
511 :     foreach my $item (@$config)
512 :     {
513 :     my($name, $value, $quote) = @$item;
514 :    
515 :     #
516 :     # Ugh. "global" is a keyword in python.
517 :     #
518 :    
519 :     $name = "global_dir" if $name eq "global";
520 :    
521 :     my $q = $quote ? '"' : '';
522 :     printf $fh "%-15s = $q$value$q\n", $name
523 :     }
524 :     }
525 :    
526 :     sub write_tool_hdr_perl
527 :     {
528 :     my($fh) = @_;
529 :    
530 :     my $perl = find_perl();
531 :    
532 :     print $fh "#!$perl\n";
533 :     print $fh "\n";
534 :    
535 :     if ($::perlenv_override)
536 :     {
537 :     #
538 :     # Write the tool header BEGIN block to reset the environment.
539 :     #
540 :    
541 :     print $fh "BEGIN {\n";
542 :     print $fh " \@INC = qw(\n";
543 :     for my $inc (@INC)
544 :     {
545 :     next if $inc eq '.';
546 :     print $fh "\t$inc\n";
547 :     }
548 : olson 1.2 print $fh ");\n";
549 : olson 1.1 print $fh "}\n";
550 :     }
551 :    
552 :     print $fh "use Data::Dumper;\n";
553 :     print $fh "use Carp;\n";
554 :    
555 : olson 1.2 #
556 :     # We generate a comment here that gets expanded by switch_to_release
557 :     # This is part of the effort in making the environment bootstrapping
558 :     # code independent of releases.
559 :     #
560 :    
561 :     #print $fh "use lib \"$release_lib\";\n";
562 :     #print $fh "use lib \"$release_lib/FigKernelPackages\";\n";
563 :    
564 :     print $fh "# Following block is expanded by switch_to_release to add use lib directives\n";
565 :     print $fh "# to point at the correct locations in the release directory.\n";
566 :     print $fh "#BEGIN switch_to_release generated code\n";
567 :     print $fh "#END switch_to_release generated code\n";
568 :     print $fh "\n";
569 :    
570 : olson 1.1 print $fh "use lib \"$fig_disk/config\";\n";
571 :    
572 :     print $fh "use FIG_Config;\n";
573 :     print $fh "\n";
574 : olson 1.11 print $fh "#### END tool_hdr ####\n\n"
575 : olson 1.1 }
576 :    
577 :     sub write_tool_hdr_python
578 :     {
579 :     my($fh) = @_;
580 :    
581 :     my $python = find_python();
582 :    
583 : olson 1.4 if ($OtherConfig->{python_require_poundbang_env})
584 :     {
585 :     print $fh "#!/usr/bin/env $python\n";
586 :     }
587 :     else
588 :     {
589 :     print $fh "#!$python\n";
590 :     }
591 : olson 1.1 print $fh "\n";
592 :    
593 : olson 1.11 print $fh "import sys, os\n";
594 : olson 1.2
595 :    
596 :     print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";
597 :    
598 : olson 1.11 #
599 :     # Append the perl path to the environment, for use later with CallPerl.
600 :     #
601 :    
602 : olson 1.23 my $perlpath = join(":", @INC, $release_lib, "$release_lib/FigKernelPackages", "$fig_disk/config");
603 : olson 1.11 print $fh <<END;
604 :     if os.getenv("PERL5LIB", "") != "":
605 :     _delim = ":"
606 :     else:
607 :     _delim = ""
608 :     os.environ["PERL5LIB"] = "$perlpath" + _delim + os.getenv("PERL5LIB", "")
609 :    
610 :     END
611 :    
612 : olson 1.2 print $fh "# Following block is expanded by switch_to_release to add use lib directives\n";
613 :     print $fh "# to point at the correct locations in the release directory.\n";
614 :     print $fh "#BEGIN switch_to_release generated code\n";
615 :     print $fh "#END switch_to_release generated code\n";
616 :     print $fh "\n";
617 :    
618 :     print $fh "sys.path.append('$fig_disk/config')\n";
619 :    
620 : olson 1.1 print $fh "import FIG_Config\n";
621 :     print $fh "\n";
622 : olson 1.11 print $fh "#### END tool_hdr_py ####\n\n"
623 : olson 1.1 }
624 :    
625 : olson 1.23 sub write_rtconfig
626 :     {
627 :     my($fh) = @_;
628 :    
629 :     my $python = find_python();
630 :     my $perl = find_perl();
631 :    
632 :     print $fh "RTPYTHON=$python\n";
633 :     print $fh "RTPERL=$perl\n";
634 :     print $fh "RTPYTHONPATH=$OtherConfig->{pythonpath}\n";
635 :    
636 : olson 1.25 my %seen;
637 :     my @perlpath;
638 :     for (@INC, "$fig_disk/config")
639 :     {
640 :     next if $seen{$_};
641 :     push(@perlpath, $_);
642 :     $seen{$_}++;
643 :     }
644 :     my $perlpath = join(":", @perlpath);
645 : olson 1.23
646 :     print $fh "RTPERL5LIB=$perlpath\n";
647 :    
648 :     print $fh "RTPYTHONIMPORTS=FIG_Config\n";
649 :     print $fh "RTPERLIMPORTS=FIG_Config\n";
650 : olson 1.25 print $fh "RTSETENV=BLASTMAT=$fig_disk/BLASTMAT\n";
651 :     print $fh "RTSETENV=FIG_HOME=$fig_disk\n";
652 : olson 1.23 }
653 :    
654 : olson 1.1 setup_directories("$fig_disk/bin",
655 :     "$fig_disk/config");
656 :    
657 :     setup_server_scripts();
658 :    
659 :    
660 :     find_python();
661 :    
662 :     compute_environment();
663 :     configure_std_fig_environment();
664 :     configure_python();
665 :     configure_environment_specific();
666 : olson 1.19 # configure_database();
667 : olson 1.7
668 :     finalize_server_scripts();
669 : olson 1.1
670 :     #
671 :     # Write the shell startup to the figdisk.
672 :     #
673 :     open(FH, ">$fig_disk/config/fig-user-env.sh") or die "Cannot write $fig_disk/config/fig-user-env.sh: $!";
674 :     write_bash_init(\*FH, $Env);
675 :     close(FH);
676 :    
677 :     open(FH, ">$fig_disk/config/fig-user-env.csh") or die "Cannot write $fig_disk/config/fig-user-env.csh: $!";
678 :     write_csh_init(\*FH, $Env);
679 :     close(FH);
680 :    
681 :     #
682 :     # Write the FIG_Config file.
683 :     #
684 :    
685 :     open(FH, ">$fig_disk/config/FIG_Config.pm") or die "Cannot write $fig_disk/config/FIG_Config.pm: $!";
686 :     write_config_pm(\*FH, $Config);
687 :     close(FH);
688 :    
689 :     open(FH, ">$fig_disk/config/FIG_Config.py") or die "Cannot write $fig_disk/config/FIG_Config.py: $!";
690 :     write_config_py(\*FH, $Config);
691 :     close(FH);
692 :    
693 :     #
694 :     # Write the tool headers
695 :     #
696 :    
697 : olson 1.2 open(FH, ">$fig_disk/config/base_tool_hdr") or die "Cannot write $fig_disk/config/tool_hdr: $!";
698 : olson 1.1 write_tool_hdr_perl(\*FH);
699 :     close(FH);
700 :    
701 : olson 1.2 open(FH, ">$fig_disk/config/base_tool_hdr_py") or die "Cannot write $fig_disk/config/tool_hdr_py: $!";
702 : olson 1.1 write_tool_hdr_python(\*FH);
703 :     close(FH);
704 :    
705 : olson 1.23 open(FH, ">$fig_disk/config/RTConfig") or die "Cannot write $fig_disk/config/RTConfig: $!";
706 :     write_rtconfig(\*FH);
707 :     close(FH);
708 :    
709 : olson 1.2 unshift(@INC, "$ENV{FIGCONFIG_RELEASE_DIR}");
710 :    
711 :     require FigCommon::SwitchRelease;
712 : olson 1.1
713 : olson 1.16 #
714 :     # We need to tweak the current path and PERL5LIB environment to get bootstrapping to
715 :     # work correctly.
716 :     #
717 :    
718 :     $ENV{PATH} = "$ENV{FIGCONFIG_ENVDIR}/bin:$ENV{PATH}";
719 :    
720 : olson 1.17 $ENV{PERL5LIB} = (map { $_->[1] } grep { $_->[0] eq "PERL5LIB"} @$Env)[0];
721 : olson 1.16
722 : olson 1.2 &FigCommon::SwitchRelease::switch_to_release($fig_disk, $ENV{FIGCONFIG_ENV}, $ENV{FIGCONFIG_RELEASE});

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3