diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-11-21 04:40:32 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-11-21 04:40:32 +0000 |
commit | 35319b632668f2f9604fe175af937a7d3ba3e3fb (patch) | |
tree | 18bb5c4561e3ffd132a4fad4d44028ef412a63da /lib/sbin/ConfigScriptParser.pl | |
parent | 8067154285e2db16b977dfc3a5296a85f7ca2e0b (diff) |
Correct handling of newline characters and spaces when writing the
configuration bindings.
When reading the configuration settings from the output of the
configuration scripts (that provide capabilities), new lines were lost
in certain circumstances. This lead to makefile fragments like
PETSC_DIR = /usr/local/apps/petscPETSC_ARCH = linux
which are obviously incorrect (since these should be two lines, not
one), although this does not lead to errors or warnings.
This patch makes sure that all configuration settings have newline
characters appended or blanks prepended as they are concatenated into
the internal database (ConfigScriptParser.pl). When the database is
read out, the strings can just be printed to the file
(CreateConfigurationBindings.pl).
While doing this, this patch also removes some superfluous blanks and
newline characters from the output of the configuration settings.
This patch also removes a perl idiosyncracy when appending newline
characters to a string. It changes code like "#endif" . "\n" to
"#endif\n".
Tested on Mac OS and Red Hat Linux.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4199 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/ConfigScriptParser.pl')
-rw-r--r-- | lib/sbin/ConfigScriptParser.pl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/sbin/ConfigScriptParser.pl b/lib/sbin/ConfigScriptParser.pl index c0ef6788..1b88a5e8 100644 --- a/lib/sbin/ConfigScriptParser.pl +++ b/lib/sbin/ConfigScriptParser.pl @@ -50,7 +50,7 @@ sub ParseConfigScript chomp $line; while($line !~ m/^\s*END\s+DEFINE\s*/i) { - $cfg->{"\U$thorn $provides\E DEFINE"} .= $line; + $cfg->{"\U$thorn $provides\E DEFINE"} .= $line . "\n"; $line_number++; $line = $data[$line_number]; chomp $line; @@ -77,7 +77,7 @@ sub ParseConfigScript chomp $line; while($line !~ m/^\s*END\s+MESSAGE\s*/i) { - $cfg->{"\U$thorn $provides\E MESSAGE"} .= " " . $line . "\n"; + $cfg->{"\U$thorn $provides\E MESSAGE"} .= $line . "\n"; $line_number++; $line = $data[$line_number]; chomp $line; @@ -88,11 +88,9 @@ sub ParseConfigScript $line_number++; $line = $data[$line_number]; chomp $line; - $cfg->{"\U$thorn $provides\E MAKE_DEFINITION"} .= "\n" - if defined $cfg->{"\U$thorn $provides\E MAKE_DEFINITION"}; while($line !~ m/^\s*END\s+MAKE_DEFINITION\s*/i) { - $cfg->{"\U$thorn $provides\E MAKE_DEFINITION"} .= $line; + $cfg->{"\U$thorn $provides\E MAKE_DEFINITION"} .= $line . "\n"; $line_number++; $line = $data[$line_number]; chomp $line; @@ -105,7 +103,7 @@ sub ParseConfigScript chomp $line; while($line !~ m/^\s*END\s+MAKE_DEPENDENCY\s*/i) { - $cfg->{"\U$thorn $provides\E MAKE_DEPENDENCY"} .= $line; + $cfg->{"\U$thorn $provides\E MAKE_DEPENDENCY"} .= $line . "\n"; $line_number++; $line = $data[$line_number]; chomp $line; @@ -113,15 +111,15 @@ sub ParseConfigScript } elsif($line =~ m/^\s*INCLUDE_DIRECTORY\s+(.*)$/i) { - $cfg->{"\U$thorn $provides\E INCLUDE_DIRECTORY"} .= $1 . ' '; + $cfg->{"\U$thorn $provides\E INCLUDE_DIRECTORY"} .= ' ' . $1; } elsif($line =~ m/^\s*LIBRARY_DIRECTORY\s+(.*)$/i) { - $cfg->{"\U$thorn $provides\E LIBRARY_DIRECTORY"} .= $1 . ' '; + $cfg->{"\U$thorn $provides\E LIBRARY_DIRECTORY"} .= ' ' . $1; } elsif($line =~ m/^\s*LIBRARY\s+(.*)$/i) { - $cfg->{"\U$thorn $provides\E LIBRARY"} .= $1 . ' '; + $cfg->{"\U$thorn $provides\E LIBRARY"} .= ' ' . $1; } else { |