summaryrefslogtreecommitdiff
path: root/lib/sbin
diff options
context:
space:
mode:
authoreschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-06-17 17:29:16 +0000
committereschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-06-17 17:29:16 +0000
commite00ef7f19b44767da74eb866b2b8ecaf3371dacd (patch)
tree73aafad408234ce903756b73f9daae57e2011b9c /lib/sbin
parent251653b5b4d169b03027373bffdc68aa2d58433d (diff)
Correct errors in handling optional capabilities
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4835 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r--lib/sbin/ConfigurationParser.pl56
-rw-r--r--lib/sbin/CreateConfigurationBindings.pl32
2 files changed, 58 insertions, 30 deletions
diff --git a/lib/sbin/ConfigurationParser.pl b/lib/sbin/ConfigurationParser.pl
index c9e1dcb7..533ecde0 100644
--- a/lib/sbin/ConfigurationParser.pl
+++ b/lib/sbin/ConfigurationParser.pl
@@ -73,6 +73,34 @@ sub CreateConfigurationDatabase
$cfg{"\U$thorn\E USES THORNS"} .= $cfg{"\U$thorn\E REQUIRES THORNS"} . ' ';
}
+ # Turn optional capabilities into required capabilities, if the
+ # capability is provided. This way we don't have to treat required
+ # and optional requirements differently.
+ my %providedcaps;
+ foreach my $thorn (sort keys %thorns)
+ {
+ if ($cfg{"\U$thorn\E PROVIDES"})
+ {
+ foreach my $providedcap (split (' ', $cfg{"\U$thorn\E PROVIDES"}))
+ {
+ $providedcaps{$providedcap} = 1;
+ }
+ }
+ }
+ foreach my $thorn (sort keys %thorns)
+ {
+ if ($cfg{"\U$thorn\E OPTIONAL"})
+ {
+ foreach my $optionalcap (split (' ', $cfg{"\U$thorn\E OPTIONAL"}))
+ {
+ if ($providedcaps{$optionalcap})
+ {
+ $cfg{"\U$thorn\E REQUIRES"} .= "$optionalcap ";
+ }
+ }
+ }
+ }
+
foreach my $thorn (sort keys %thorns)
{
# verify that all required capabilities are there in the ThornList
@@ -130,6 +158,34 @@ sub CreateConfigurationDatabase
&CST_error(0, $message);
}
+ # Turn optional capabilities into required capabilities, if the
+ # capability is provided. This way we don't have to treat required
+ # and optional requirements differently.
+ my %providedcaps;
+ foreach my $thorn (sort keys %thorns)
+ {
+ if ($cfg{"\U$thorn\E PROVIDES"})
+ {
+ foreach my $providedcap (split (' ', $cfg{"\U$thorn\E PROVIDES"}))
+ {
+ $providedcaps{$providedcap} = 1;
+ }
+ }
+ }
+ foreach my $thorn (sort keys %thorns)
+ {
+ if ($cfg{"\U$thorn\E OPTIONAL"})
+ {
+ foreach my $optionalcap (split (' ', $cfg{"\U$thorn\E OPTIONAL"}))
+ {
+ if ($providedcaps{$optionalcap})
+ {
+ $cfg{"\U$thorn\E REQUIRES"} .= " $optionalcap";
+ }
+ }
+ }
+ }
+
return \%cfg;
}
diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl
index 7eceb6ed..0d8ea53b 100644
--- a/lib/sbin/CreateConfigurationBindings.pl
+++ b/lib/sbin/CreateConfigurationBindings.pl
@@ -59,34 +59,6 @@ sub CreateConfigurationBindings
mkdir('Thorns', 0755) || die "Unable to create Thorns directory";
}
- # Turn optional capabilities into required capabilities, if the
- # capability is provided. This way we don't have to treat required
- # and optional requirements differently.
- my %providedcaps;
- foreach my $thorn (sort keys %thorns)
- {
- if ($cfg->{"\U$thorn\E PROVIDES"})
- {
- foreach my $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"}))
- {
- $providedcaps{$providedcap} = 1;
- }
- }
- }
- foreach my $thorn (sort keys %thorns)
- {
- if ($cfg->{"\U$thorn\E OPTIONAL"})
- {
- foreach my $optionalcap (split (' ', $cfg->{"\U$thorn\E OPTIONAL"}))
- {
- if ($providedcaps{$optionalcap})
- {
- $cfg->{"\U$thorn\E REQUIRES"} .= "$optionalcap ";
- }
- }
- }
- }
-
# These strings go directly into the Cactus executable
my $linkerflagdirs = '';
my $linkerflaglibs = '';
@@ -202,7 +174,7 @@ sub CreateConfigurationBindings
}
}
- if ($cfg->{"\U$thorn\E REQUIRES"} || $cfg->{"\U$thorn\E OPTIONAL"})
+ if ($cfg->{"\U$thorn\E REQUIRES"})
{
# write everything to file
# (write the files even if they are empty)
@@ -242,7 +214,7 @@ sub CreateConfigurationBindings
$temp = '';
foreach $thorn (sort keys %thorns)
{
- if ($cfg->{"\U$thorn\E REQUIRES"} || $cfg->{"\U$thorn\E OPTIONAL"})
+ if ($cfg->{"\U$thorn\E REQUIRES"})
{
$temp .= "#ifdef THORN_IS_$thorn\n";
$temp .= "#include \"../Configuration/Thorns/cctki_$thorn.h\"\n";