From d10236ce62feabc2a9fd8eec58d8f0a90a43447e Mon Sep 17 00:00:00 2001 From: goodale Date: Wed, 18 Aug 2004 16:10:58 +0000 Subject: Trying to bring the condiguration stuff up to standard. Now should be consistent with docs (once I update those), plus prints out messages output by scripts. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3845 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/ConfigScriptParser.pl | 32 ++++++++++++++++++++++++-------- lib/sbin/ConfigurationParser.pl | 11 ++++++++--- lib/sbin/CreateConfigurationBindings.pl | 12 ++++++------ 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/lib/sbin/ConfigScriptParser.pl b/lib/sbin/ConfigScriptParser.pl index a2a23ff2..457b17ce 100644 --- a/lib/sbin/ConfigScriptParser.pl +++ b/lib/sbin/ConfigScriptParser.pl @@ -38,60 +38,74 @@ sub ParseConfigScript for($line_number = 0; $line_number < @data; $line_number++) { $line = $data[$line_number]; + + chomp $line; + # Parse the line if($line =~ m/^\s*BEGIN\s+DEFINE\s*/i) { $line_number++; $line = $data[$line_number]; + chomp $line; while($line !~ m/^\s*END\s+DEFINE\s*/i) { $cfg->{"\U$thorn $provides\E DEFINE"} .= $line; $line_number++; $line = $data[$line_number]; + chomp $line; + } } elsif($line =~ m/^\s*BEGIN\s+ERROR\s*/i) { $line_number++; $line = $data[$line_number]; + chomp $line; while($line !~ m/^\s*END\s+ERROR\s*/i) { - $cfg->{"\U$thorn $provides\E ERROR"} .= $line; + $cfg->{"\U$thorn $provides\E ERROR"} .= $line . "\n"; $line_number++; $line = $data[$line_number]; + chomp $line; } } elsif($line =~ m/^\s*BEGIN\s+MESSAGE\s*/i) { $line_number++; $line = $data[$line_number]; + chomp $line; while($line !~ m/^\s*END\s+MESSAGE\s*/i) { - $cfg->{"\U$thorn $provides\E MESSAGE"} .= $line; + $cfg->{"\U$thorn $provides\E MESSAGE"} .= " " . $line . "\n"; $line_number++; $line = $data[$line_number]; + chomp $line; } } - elsif($line =~ m/^\s*BEGIN\s+DEFINITION\s*/i) + elsif($line =~ m/^\s*BEGIN\s+MAKE_DEFINITION\s*/i) { $line_number++; $line = $data[$line_number]; - while($line !~ m/^\s*END\s+DEFINITION\s*/i) + chomp $line; + while($line !~ m/^\s*END\s+MAKE_DEFINITION\s*/i) { - $cfg->{"\U$thorn $provides\E DEFINITION"} .= $line; + $cfg->{"\U$thorn $provides\E MAKE_DEFINITION"} .= $line; $line_number++; $line = $data[$line_number]; + chomp $line; } } - elsif($line =~ m/^\s*BEGIN\s+DEPENDENCY\s*/i) + elsif($line =~ m/^\s*BEGIN\s+MAKE_DEPENDENCY\s*/i) { $line_number++; $line = $data[$line_number]; - while($line !~ m/^\s*END\s+DEPENDENCY\s*/i) + chomp $line; + while($line !~ m/^\s*END\s+MAKE_DEPENDENCY\s*/i) { - $cfg->{"\U$thorn $provides\E DEPENDENCY"} .= $line; + $cfg->{"\U$thorn $provides\E MAKE_DEPENDENCY"} .= $line; $line_number++; $line = $data[$line_number]; + chomp $line; } } elsif($line =~ m/^\s*INCLUDE_DIRECTORY[^\s]*\s*(.*)$/i) @@ -116,6 +130,8 @@ sub ParseConfigScript $error_msg = $error_msg ? " Error message: '$error_msg'" : ' (no error message)'; + print $cfg->{"\U$thorn $provides\E MESSAGE"}; + $msg = "Configuration script for thorn $thorn "; &CST_error (0, $msg . "returned exit code $exit_value\n$error_msg") if ($exit_value); diff --git a/lib/sbin/ConfigurationParser.pl b/lib/sbin/ConfigurationParser.pl index 24be9eec..dd6b48a9 100644 --- a/lib/sbin/ConfigurationParser.pl +++ b/lib/sbin/ConfigurationParser.pl @@ -162,9 +162,14 @@ sub ParseConfigurationCCL $cfg->{"\U$thorn\E PROVIDES \U$provides\E SCRIPT"} = $script; $cfg->{"\U$thorn\E PROVIDES \U$provides\E LANG"} = $lang; - $cfg = &ParseConfigScript($config_dir, $provides, $lang, $script, - $thorn, $cfg, $thorns, $filename) - if ($script ne ''); + if ($script) + { + print "Running configuration script '$script'\n"; + + $cfg = &ParseConfigScript($config_dir, $provides, $lang, $script, + $thorn, $cfg, $thorns, $filename); + print "\n"; + } next; } diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl index 886cbd03..3a04a219 100644 --- a/lib/sbin/CreateConfigurationBindings.pl +++ b/lib/sbin/CreateConfigurationBindings.pl @@ -93,15 +93,15 @@ sub CreateConfigurationBindings { &WriteFile("include/\U$providedcap\E.h",\$cfg->{"\U$thorn $providedcap\E DEFINE"}); } - if ( $cfg->{"\U$thorn $providedcap\E DEFINITION"} ) + if ( $cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"} ) { - $codedef = $cfg->{"\U$thorn $providedcap\E DEFINITION"}; - &WriteFile("$bindings_dir/Configuration/make.\U$providedcap\E.defn",\$cfg->{"\U$thorn $providedcap\E DEFINITION"}); + $codedef = $cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"}; + &WriteFile("$bindings_dir/Configuration/make.\U$providedcap\E.defn",\$cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"}); } - if ( $cfg->{"\U$thorn $providedcap\E DEPENDENCY"} ) + if ( $cfg->{"\U$thorn $providedcap\E MAKE_DEPENDENCY"} ) { - $codedep = $cfg->{"\U$thorn $providedcap\E DEPENDENCY"}; - &WriteFile("$bindings_dir/Configuration/make.\U$providedcap\E.deps",\$cfg->{"\U$thorn $providedcap\E DEPENDENCY"}); + $codedep = $cfg->{"\U$thorn $providedcap\E MAKE_DEPENDENCY"}; + &WriteFile("$bindings_dir/Configuration/make.\U$providedcap\E.deps",\$cfg->{"\U$thorn $providedcap\E MAKE_DEPENDENCY"}); } if ( $cfg->{"\U$thorn $providedcap\E INCLUDE_DIRECTORY"} ) { -- cgit v1.2.3