diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-08-27 03:20:39 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-08-27 03:20:39 +0000 |
commit | ae1087d19f3f5fa38beebe3513c911b3f66fe355 (patch) | |
tree | 7fca87834110699068c6f5c9fa29b60b091baeae /lib/sbin/ProcessConfiguration.pl | |
parent | 0f32894d78d29b9d205ecfe4ee319a0f9112abee (diff) |
Added tracking of options for thorn configuration scripts. Now a thorn
may specify
OPTIONS a b c
in a PROVIDES block in its configuration.ccl and these options will be
tracked and stored in the configuration's config-info file.
The config-info file, and any options file specified on the command line
are now used to setup the environment before a configuration script is
run by the CST.
Note that the only options stored to the config-info file by the CST are ones
specified in the configuration.ccl files, and configuration scripts are
invoked each time the CST is run, so any option used by a thorn's configuration
script MUST be mentioned in the configuration.ccl file to be remembered the
next time the CST is invoked.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3855 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/ProcessConfiguration.pl')
-rw-r--r-- | lib/sbin/ProcessConfiguration.pl | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/lib/sbin/ProcessConfiguration.pl b/lib/sbin/ProcessConfiguration.pl index 4be4f7d3..d0a1e898 100644 --- a/lib/sbin/ProcessConfiguration.pl +++ b/lib/sbin/ProcessConfiguration.pl @@ -38,6 +38,105 @@ sub SplitThorns } } +#/*@@ +# @routine ProcessConfiguration +# @date Thu Aug 26 22:09:26 2004 +# @author Tom Goodale +# @desc +# Runs all the configuration scripts belonging to thorns. +# Has to setup the environment correctly, and as a result +# modifies the config-info file for future reference. +# @enddesc +# @calls +# @calledby +# @history +# +# @endhistory +# +#@@*/ +sub ProcessConfiguration +{ + my($config_dir,$config_database, $thorns, $config_file) = @_; + + my $thorn; + my $provides; + my @allowed_opts; + + # Find the master list of allowed options + foreach $thorn (sort keys %thorns) + { +# print "DEBUG: Thorn $thorn\n"; + + foreach $provides (split(' ',$config_database->{"\U$thorn\E PROVIDES"})) + { +# print "DEBUG: Provides $provides\n"; + + if(@{$config_database->{"\U$thorn\E PROVIDES \U$provides\E OPTIONS"}} != 0) + { +# print "DEBUG: $thorn provides $provides with options\n"; + push(@allowed_opts, @{$config_database->{"\U$thorn\E PROVIDES \U$provides\E OPTIONS"}}); + } + } + } + +# print "DEBUG: allowed options are @allowed_opts\n"; + + # Now get all the configuration options. + my $env; + my $optfile; + my $configinfo; + my $headers; + + ($configinfo,$headers) = ParseConfigInfo($config_file); + if($ENV{"options"}) + { + $optfile = ParseOptionsFile($ENV{"options"}) + } + else + { + $optfile = {}; + } + + $env = GetOptionsFromEnv(\%ENV, \@allowed_opts); + + my $modified = AmalgamateOptions($env,$optfile,$configinfo,\@allowed_opts); + + # Write a new config-info file if anything has changed + if($modified) + { + WriteNewConfigInfo($config_file,$headers,$configinfo); + } + + # Now setup the environment + # FIXME: Would like to restrict this to just the @allowed_opts, but then + # flesh configuration options like MPI or arch specific ones like + # IRIX_BITS would not be propogated 8-( + + foreach $option (keys %$configinfo) + { + $ENV{$option} = $configinfo->{$option}; + } + + # Ok, can now run the configuration scripts. + + foreach $thorn (sort keys %thorns) + { + foreach $provides (split(' ',$config_database->{"\U$thorn\E PROVIDES"})) + { + my $script = $config_database->{"\U$thorn\E PROVIDES \U$provides\E SCRIPT"}; + my $lang = $config_database->{"\U$thorn\E PROVIDES \U$provides\E LANG"}; + + if ($script) + { + print "Running configuration script '$script'\n"; + + &ParseConfigScript($config_dir, $provides, $lang, $script, + $thorn, $config_database); + print "\n"; + } + } + } +} 1; |