From e00ef7f19b44767da74eb866b2b8ecaf3371dacd Mon Sep 17 00:00:00 2001 From: eschnett Date: Sun, 17 Jun 2012 17:29:16 +0000 Subject: Correct errors in handling optional capabilities git-svn-id: http://svn.cactuscode.org/flesh/trunk@4835 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/force-rebuild | 2 +- lib/sbin/ConfigurationParser.pl | 56 +++++++++++++++++++++++++++++++++ lib/sbin/CreateConfigurationBindings.pl | 32 ++----------------- 3 files changed, 59 insertions(+), 31 deletions(-) (limited to 'lib') diff --git a/lib/make/force-rebuild b/lib/make/force-rebuild index eb36a6f2..aebdb9fb 100644 --- a/lib/make/force-rebuild +++ b/lib/make/force-rebuild @@ -37,4 +37,4 @@ 12 Jan 2011: Add PROVIDES/REQUIRES clauses to scheduler 20 Jan 2011: Generate prototypes for scheduled functions 27 Oct 2011: Optimize CCTK_ARGUMENTS for grid functions in Fortran - +17 Jun 2012: Correct error in handling optional dependencies 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"; -- cgit v1.2.3