summaryrefslogtreecommitdiff
path: root/lib/sbin/ConfigurationParser.pl
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2004-08-27 03:20:39 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2004-08-27 03:20:39 +0000
commitae1087d19f3f5fa38beebe3513c911b3f66fe355 (patch)
tree7fca87834110699068c6f5c9fa29b60b091baeae /lib/sbin/ConfigurationParser.pl
parent0f32894d78d29b9d205ecfe4ee319a0f9112abee (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/ConfigurationParser.pl')
-rw-r--r--lib/sbin/ConfigurationParser.pl40
1 files changed, 25 insertions, 15 deletions
diff --git a/lib/sbin/ConfigurationParser.pl b/lib/sbin/ConfigurationParser.pl
index dd6b48a9..346b4c75 100644
--- a/lib/sbin/ConfigurationParser.pl
+++ b/lib/sbin/ConfigurationParser.pl
@@ -44,7 +44,7 @@ sub CreateConfigurationDatabase
# if ($cfg{"\U$thorn\E REQUIRES"});
# }
- $cfg->{"\U$thorn\E USES THORNS"} = '';
+ $cfg{"\U$thorn\E USES THORNS"} = '';
# verify that all required thorns are there in the ThornList
next if (! $cfg{"\U$thorn\E REQUIRES THORNS"});
@@ -136,7 +136,7 @@ sub ParseConfigurationCCL
my($config_dir, $thorn, $cfg, $thorns, $filename) = @_;
my(@data);
my($line_number, $line);
- my($provides, $script, $lang);
+ my($provides, $script, $lang, $options);
my($optional, $define);
# Initialise some stuff to prevent perl -w from complaining.
@@ -157,19 +157,23 @@ sub ParseConfigurationCCL
if($line =~ m/^\s*PROVIDES\s*/i)
{
$lang = $script = '';
- ($provides, $script, $lang, $line_number) = &ParseProvidesBlock($line_number, \@data);
+ ($provides, $script, $lang, $options, $line_number) = &ParseProvidesBlock($line_number, \@data);
$cfg->{"\U$thorn\E PROVIDES"} .= "$provides ";
- $cfg->{"\U$thorn\E PROVIDES \U$provides\E SCRIPT"} = $script;
- $cfg->{"\U$thorn\E PROVIDES \U$provides\E LANG"} = $lang;
-
- if ($script)
+ if($script)
{
- print "Running configuration script '$script'\n";
-
- $cfg = &ParseConfigScript($config_dir, $provides, $lang, $script,
- $thorn, $cfg, $thorns, $filename);
- print "\n";
+ $cfg->{"\U$thorn\E PROVIDES \U$provides\E SCRIPT"} = "$thorns->{$thorn}/$script";
}
+ $cfg->{"\U$thorn\E PROVIDES \U$provides\E LANG"} = $lang;
+ $cfg->{"\U$thorn\E PROVIDES \U$provides\E OPTIONS"} = $options;
+
+# if ($script)
+# {
+# print "Running configuration script '$script'\n";
+#
+# &ParseConfigScript($config_dir, $provides, $lang, $script,
+# $thorn, $cfg);
+# print "\n";
+# }
next;
}
@@ -215,11 +219,12 @@ sub ParseConfigurationCCL
sub ParseProvidesBlock
{
my ($line_number, $data) = @_;
- my ($provides, $script, $lang);
+ my ($provides, $script, $lang, $options);
$provides = "";
$script = "";
$lang = "";
+ $options = [];
$data->[$line_number] =~ m/^\s*PROVIDES\s*(.*)/i;
@@ -230,7 +235,7 @@ sub ParseProvidesBlock
{
&CST_error (0, "Error parsing provides block line '$data->[$line_number]'.".
'Missing { at start of block');
- $line_number++ while($data[$line_number] !~ m:\s*\}\s*:);
+ $line_number++ while($data->[$line_number] !~ m:\s*\}\s*:);
}
else
{
@@ -247,6 +252,11 @@ sub ParseProvidesBlock
$lang = $1;
next;
}
+ elsif($data->[$line_number] =~ m/^\s*OPTIONS[^\s]*\s*(.*)$/i)
+ {
+ push(@$options, split(' ',$1));
+ next;
+ }
elsif($data->[$line_number] =~ m:\s*\}\s*:)
{
# do nothing.
@@ -259,7 +269,7 @@ sub ParseProvidesBlock
}
}
- return ($provides, $script, $lang, $line_number);
+ return ($provides, $script, $lang, $options, $line_number);
}