summaryrefslogtreecommitdiff
path: root/lib/sbin/ThornList.pl
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-04-19 20:37:24 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-04-19 20:37:24 +0000
commit9e1b474c14866d13c20cd77ae71b0badd63846a0 (patch)
treef169e62196211a33246d756132451cd8ac5baefc /lib/sbin/ThornList.pl
parent1f4495ae416afa3218575056fd72d8dac55bef18 (diff)
New version of script for creating ThornGuide from Ian Kelley
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2730 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/ThornList.pl')
-rw-r--r--lib/sbin/ThornList.pl111
1 files changed, 111 insertions, 0 deletions
diff --git a/lib/sbin/ThornList.pl b/lib/sbin/ThornList.pl
new file mode 100644
index 00000000..dd7a55d4
--- /dev/null
+++ b/lib/sbin/ThornList.pl
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+
+#/*@@
+# @file ThornList.pl
+# @date March 2001
+# @author Ian Kelley
+# @desc
+# 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
+#
+# Used primary by the ThornGuide Makefile
+# @enddesc
+# @version
+#@@*/
+
+# give help
+if ($h || $help) {
+ print <<EOC;
+--> 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
+
+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
+EOC
+
+exit 0;
+}
+
+if (! defined $arrangements_dir) {
+ die "\nArrangements directory not defined (-arrangments_dir)";
+} elsif ($arrangments_dir !~ /\/$/) {
+ $arrangements_dir .= '/';
+}
+
+# if we are building a thornlist from thorns in $arrangements_dir
+if (! defined $thornlist)
+{
+ @arrangements = &FindDirectories($arrangements_dir);
+
+ foreach $arrangement (@arrangements)
+ {
+ @thorns = &FindDirectories("$arrangements_dir$arrangement");
+
+ foreach $thorn (@thorns) {
+ print "\n$arrangement/$thorn";
+ }
+ }
+}
+# if we are printing all the thorn directories on one line
+# for use by the ThornGuide makefile
+else
+{
+ $thorn_paths = "";
+
+ open (THORNLIST, "<$thornlist") || die "\nCannot open thornlist ($thornlist): $!";
+
+ while (<THORNLIST>)
+ {
+ next if /\s*?\!/; # bypass any directives
+ s/(.*?)#.*/\1/; # read up to the first "#"
+ s/\s+//g; # replace any spaces with nothing
+
+ next if ! /\w/; # nothing on this line?
+
+ $thorn_paths .= "$arrangements_dir$_ ";
+
+ }
+
+ close (THORNLIST);
+
+ print $thorn_paths;
+}
+## END: MAIN ##
+
+#/*@@
+# @routine FindDirectories
+# @date Sun Mar 3 01:54:37 CET 2002
+# @author Ian Kelley
+# @desc
+# Grabs all directories within a given directory, minus the ones created by CVS
+# @enddesc
+# @version
+#@@*/
+
+sub FindDirectories
+{
+ my (@good_directories);
+
+ chdir ("$start_directory") || die "\nCannot chdir to $start_directory: $!";
+
+ chdir("$_[0]") || die "\nCannot change directory to $_[0] : $!";
+
+ open(LS, "ls -F|");
+
+ while(chomp($name = <LS>))
+ {
+ next if (! -d $name);
+ if (($name ne "History/") && ($name ne "CVS/"))
+ {
+ $name =~ s#/##;
+ push(@good_directories, $name);
+ }
+ }
+
+ close(LS);
+
+ chdir ($start_directory);
+ return (@good_directories);
+} ## END :Find_Directories: