From fdeb58dacfa4cb436378ef8ad0e15953d731c42a Mon Sep 17 00:00:00 2001 From: ikelley Date: Mon, 19 Aug 2002 18:39:34 +0000 Subject: added support for -thorns= and -arrangements= (comma separated lists), should not effect current behaviour git-svn-id: http://svn.cactuscode.org/flesh/trunk@2968 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/ThornList.pl | 52 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sbin/ThornList.pl b/lib/sbin/ThornList.pl index 0503f108..f4e9f48f 100644 --- a/lib/sbin/ThornList.pl +++ b/lib/sbin/ThornList.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# use vars qw($arrangements_dir $arrangements $thorns $h $help $thornlist); + #/*@@ # @file ThornList.pl # @date March 2001 @@ -18,32 +20,65 @@ if ($h || $help) { print < ThornList.pl <-- -Either creates a stripped down thornlist of all thorns in the arrangments directory, or prints out the full paths to each thorn on a single line +Either creates a stripped down thornlist of all thorns in the arrangments directory, or prints out the full paths to each thorn on a single line. It can also take a combination of arrangements and thorns and will print them all out as a thornlist. Usage: -\t\$ perl -s ThornList.pl -arrangements_dir=/home/ikelley/Cactus/WaveToyC_Dev/arrangements > allthorns.th -\t\$ perl -s ThornList.pl -arrangements_dir=/home/ikelley/Cactus/WaveToyC_Dev/arrangements -thornlist=allthorns.th +\t\$ perl -s ThornList.pl -arrangements_dir=/tmp/Cactus/arrangements > allthorns.th +\t\$ perl -s ThornList.pl -arrangements_dir=/tmp/Cactus/arrangements -thornlist=allthorns.th +\t\$ perl -s ThornList.pl -arrangements_dir=/tmp/Cactus/arrangements -thorns="CactusBase/Boundary CactusBase/IOBasic" -arrangements="CactusTest" EOC exit 0; } +my $start_directory = `pwd`; +chomp ($start_directory); + +my @thorns; +my @arrangements; + + if (! defined $arrangements_dir) { die "\nArrangements directory not defined (-arrangments_dir)"; -} elsif ($arrangments_dir !~ /\/$/) { +} elsif ($arrangements_dir !~ /\/$/) { $arrangements_dir .= '/'; } + +# if we are being passed in the arrangements or thorns manually +if ($arrangements =~ /\w/ || $thorns =~ /\w/) { + if (defined $arrangements) { + @arrangements = split/,/, $arrangements; + + foreach my $arrangement (@arrangements) + { + @thorns = &FindDirectories("$arrangements_dir$arrangement"); + + foreach my $thorn (@thorns) { + print "\n$arrangement/$thorn" if ($thorn ne "doc"); + } + } + } + + if (defined $thorns) { + @thorns = split/,/, $thorns; + + foreach my $thorn (@thorns) { + print "\n$thorn"; + } + } + +} # if we are building a thornlist from thorns in $arrangements_dir -if (! defined $thornlist) +elsif (! defined $thornlist) { @arrangements = &FindDirectories($arrangements_dir); - foreach $arrangement (@arrangements) + foreach my $arrangement (@arrangements) { @thorns = &FindDirectories("$arrangements_dir$arrangement"); - foreach $thorn (@thorns) { + foreach my $thorn (@thorns) { print "\n$arrangement/$thorn" if ($thorn ne "doc"); } } @@ -52,7 +87,7 @@ if (! defined $thornlist) # for use by the ThornGuide makefile else { - $thorn_paths = ""; + my $thorn_paths = ""; open (THORNLIST, "<$thornlist") || die "\nCannot open thornlist ($thornlist): $!"; @@ -87,6 +122,7 @@ else sub FindDirectories { my (@good_directories); + my $name; chdir ("$start_directory") || die "\nCannot chdir to $start_directory: $!"; -- cgit v1.2.3