Mike --
Can you explain what this does?
On Aug 11, 2009, at 4:28 AM, <mi...@osl.iu.edu> wrote:
Author: miked
Date: 2009-08-11 04:28:03 EDT (Tue, 11 Aug 2009)
New Revision: 1306
URL: https://svn.open-mpi.org/trac/mtt/changeset/1306
Log:
added poor-man-inifile-preprocessor
Text files modified:
trunk/client/mtt | 3 +++
trunk/lib/MTT/INI.pm | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
Modified: trunk/client/mtt
=
=
=
=
=
=
=
=
======================================================================
--- trunk/client/mtt (original)
+++ trunk/client/mtt 2009-08-11 04:28:03 EDT (Tue, 11 Aug 2009)
@@ -652,6 +652,9 @@
# Expand all the "include_section" parameters
$unfiltered = MTT::INI::ExpandIncludeSections($unfiltered);
+ # Expand all the "%PREDEFINED_VARS%" parameters
+ $unfiltered = MTT::INI::ExpandPredefinedVars($unfiltered);
+
# Keep an unfiltered version of the ini file for error
checking
my $filtered = dclone($unfiltered);
Modified: trunk/lib/MTT/INI.pm
=
=
=
=
=
=
=
=
======================================================================
--- trunk/lib/MTT/INI.pm (original)
+++ trunk/lib/MTT/INI.pm 2009-08-11 04:28:03 EDT (Tue, 11 Aug
2009)
@@ -275,6 +275,30 @@
return $ini;
}
+sub ExpandPredefinedVars {
+ my($ini) = @_;
+
+ foreach my $section ($ini->Sections) {
+ foreach my $parameter ($ini->Parameters($section)) {
+ my $val = $ini->val($section, $parameter);
+ if ( $val =~ /%INI_SECTION_NAME%/i ) {
+ my $sect = $section;
+ $sect =~ s/test run://gi;
+ $sect =~ s/test build://gi;
+ $sect =~ s/test get://gi;
+ $sect =~ s/mpi get://gi;
+ $sect =~ s/mpi install://gi;
+ $sect =~ s/mpi details://gi;
+ $sect =~ s/reporter://gi;
+ $val =~ s/%INI_SECTION_NAME%/$sect/g;
+ $ini->delval($section, $parameter);
+ $ini->newval($section, $parameter,
$val);
+ }
+ }
+ }
+ return $ini;
+}
+
# Worker subroutine for recursive ExpandIncludeSections
sub _expand_include_sections {
my($ini, $section) = @_;
_______________________________________________
mtt-svn mailing list
mtt-...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/mtt-svn
--
Jeff Squyres
jsquy...@cisco.com