From 6d69e664eb7335cbb8962a23e08053df6573c234 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Thu, 15 Jul 2010 10:28:12 +0000 Subject: [PATCH] Add option -c to support reading subsys hierarchies directly from etics. --- org.glite.lb/generate-properties.pl | 40 +++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/org.glite.lb/generate-properties.pl b/org.glite.lb/generate-properties.pl index e51d4fd..8f88f8a 100644 --- a/org.glite.lb/generate-properties.pl +++ b/org.glite.lb/generate-properties.pl @@ -26,17 +26,18 @@ if ($TMPDIR eq "") {$TMPDIR="/tmp";} $usage = qq{ -usage: $0 [-p] -a|module.name [module.name ...] +usage: $0 [-p] -a|module.name [module.name ...]|-c configuration [configuration ...] -h Display this help -p Single line output for Etics web interface -a Process all subdirectories in . rather than getting lists + -c Download subsystem configurations from Etics and parse dependencies }; if ($#ARGV < 0) {die $usage}; -getopts('pha'); +getopts('phac'); if (defined $opt_h) {die $usage}; if (defined $opt_p) { @@ -96,7 +97,38 @@ if (defined $opt_a) { # All subdirectories } } } -else { # Listed subsystems +else { +if (defined $opt_c) { # Configurations + my $output = ""; + while ($subsys = shift) { + $module = $subsys; + $module =~ s/_[a-zA-Z]*_.*//; + $module =~ s/glite-/glite\./; + $module =~ s/gridsite-/gridsite\./; + system("etics-configuration prepare -o $TMPDIR/subsys.INI.$$.tmp -c $subsys org.$module"); + open FILE, "$TMPDIR/subsys.INI.$$.tmp" or die $!; + $hierarchy = 0; + while (my $line = ) { + if ($line =~ /^\[Hierarchy\]/) { $hierarchy = 1; } + else { + if ($line =~ /^\[.*\]/) { $hierarchy = 0; } + else { + if ($hierarchy eq 1) { + $line =~ /^(\S*)\s*=\s*(\S*)$/; + unless ($1 eq "") { + $output = $output . "$pair_separator_front$1.DEFAULT$eq_separator$2$pair_separator_back"; + } + } + } + } + } + close FILE, + system("rm -f $TMPDIR/subsys.INI.$$.tmp"); + } + print $output; +} +else { +# Listed subsystems while ($module = shift) { chomp($module); #Clean possible trailing '/' (even multiple occurrences :-) from module name @@ -110,6 +142,6 @@ else { # Listed subsystems GetDefault ($m); } } -} +} } if (defined $opt_p) { printf "\n"; } -- 1.8.2.3