From 6c935b075c92c86a7c97b2ad40ca15525a3e3e9b Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 5 May 2004 15:44:03 +0000 Subject: Fixed cases where chdir('..') was used which caused problems with symlinks. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3691 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/CVSUpdate.pl | 32 +-- lib/sbin/CheckoutUtils.pl | 369 ++++++++++++++-------------------- lib/sbin/MakeUtils.pl | 103 +++++----- lib/sbin/checkout.pl | 500 ++++++++++++++++++++-------------------------- 4 files changed, 430 insertions(+), 574 deletions(-) (limited to 'lib') diff --git a/lib/sbin/CVSUpdate.pl b/lib/sbin/CVSUpdate.pl index fea04c81..60177f87 100644 --- a/lib/sbin/CVSUpdate.pl +++ b/lib/sbin/CVSUpdate.pl @@ -2,10 +2,10 @@ # @file CVSUpdate.pl # @date Tue Nov 21 2000 # @author Gabrielle Allen -# @desc +# @desc # Updates Cactus checkout # (avoids problems with different versions of cvs client) -# @enddesc +# @enddesc # @version $Header$ #@@*/ @@ -44,32 +44,33 @@ if ($debug) if (!$debug) { open (CS, "$command |"); - while () - { + while () + { print ; } close (CS); } -($package_dir, $thornlist) = @ARGV; +($arrangement_dir, $thornlist) = @ARGV; if ($thornlist =~ /^$/) { - %info = &buildthorns($package_dir,"thorns"); + %info = &buildthorns($arrangement_dir,"thorns"); } else { %info = &ReadThornlist($thornlist); } -$current_dir = `pwd`; -chdir $package_dir; +$home = `pwd`; +chomp ($home); foreach $thorn (sort keys %info) { - if( ! -d "$thorn/CVS") { print "Ignoring $thorn - no CVS directory\n"; next; } - chdir $thorn; + + chdir ("$arrangement_dir/$thorn") || + die "Cannot change to thorn directory '$arrangement_dir/$thorn'\n"; print("\nUpdating $thorn\n"); $command = "cvs $cvs_ops update $cvs_update_ops $cvs_symbolic_name"; if($debug) @@ -85,21 +86,20 @@ foreach $thorn (sort keys %info) open (FILE, ") { - print; + print; } } } if (!$debug) { open (CS, "$command |"); - while () - { + while () + { print ; - } + } } - chdir "../.."; } -chdir $current_dir; + chdir $home) || die "Cannot change back to Cactus home directory '$home'\n"; exit; diff --git a/lib/sbin/CheckoutUtils.pl b/lib/sbin/CheckoutUtils.pl index 2fc6aa5b..aafca665 100644 --- a/lib/sbin/CheckoutUtils.pl +++ b/lib/sbin/CheckoutUtils.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl -s +#! /usr/bin/perl -s # #/*@@ # @file CheckoutUtils.pl @@ -8,7 +8,7 @@ # Installer for Thorns from ThornList # @enddesc # @version $Header$ -# @@*/ +# @@*/ sub CheckoutThornList { @@ -25,15 +25,15 @@ sub CheckoutThornList # Get CVS options $cvs_options = &CVSOptions; - + # Parse the ThornList %thorns = &ParseThornList($thornlist,$fleshpath,$tag); # Checkout the thorns - if (chdir "arrangements") + if (chdir ('arrangements')) { &GetThorns($fleshpath,$cvs_options,$tag,%thorns); - chdir $mydir; + chdir ($mydir); } else { @@ -48,17 +48,11 @@ sub CheckoutThornList #/*@@ # @routine Repository exists -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Check that the CVS repository is actually there -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub RepositoryExists @@ -84,17 +78,11 @@ sub RepositoryExists #/*@@ # @routine ParseCVSPasswordFile -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Read in .cvspass if it is there -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub ParseCVSPasswordFile @@ -131,17 +119,11 @@ sub ParseCVSPasswordFile #/*@@ # @routine AddCVSPasswordFile -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # If the checkout is anonymous add any needed passwords to .cvspass -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub AddCVSPasswordFile @@ -177,7 +159,7 @@ sub AddCVSPasswordFile if ($rep !~ /$rep2\b/) { print CVSPASS "$rep2 $anon_pass\n"; - } + } if ($rep !~ /$rep3\b/) { print CVSPASS "$rep3 $anon_pass\n"; @@ -195,18 +177,12 @@ sub AddCVSPasswordFile #/*@@ # @routine StripSpaces -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Remove spaces at start and end of word ... there's probably # a much easier way to do this -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub StripSpaces @@ -222,17 +198,11 @@ sub StripSpaces #/*@@ # @routine LoginRepository -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Login to a repository with chosen username -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub LoginRepository @@ -242,10 +212,10 @@ sub LoginRepository $command = "cvs -d $repository login |"; - if ($debug != 1) + if ($debug != 1) { open(CVSLOGIN,$command); - while () + while () { print $_; } @@ -262,17 +232,11 @@ sub LoginRepository #/*@@ # @routine GetThorns -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Check out the thorns from CVS -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub GetThorns @@ -285,22 +249,22 @@ sub GetThorns { if ($thorns{"$th"} ne $fleshrep) { - print " WARNING: Mixing stable and developmental repositories\n"; - print " Flesh: <$fleshrep>\n"; - print " $th: <$thorns{\"$th\"}>\n\n"; - print " Continue? (h)elp, y)es, n)o) [yes] : "; - if (defined $defaults) - { - print "\n"; - } - else - { - $answer = ; - } - if ($answer =~ /^n/i) - { - DIE("Leaving GetCactus script"); - } + print " WARNING: Mixing stable and developmental repositories\n"; + print " Flesh: <$fleshrep>\n"; + print " $th: <$thorns{\"$th\"}>\n\n"; + print " Continue? (h)elp, y)es, n)o) [yes] : "; + if (defined $defaults) + { + print "\n"; + } + else + { + $answer = ; + } + if ($answer =~ /^n/i) + { + DIE("Leaving GetCactus script"); + } } } @@ -314,72 +278,72 @@ sub GetThorns @rep = &ParseCVSPasswordFile; foreach (@rep) { - # Strip optional port specification from entries in .cvspass - # assume that user names never have a '/' - s|:(\d+)?/|:/|; + # Strip optional port specification from entries in .cvspass + # assume that user names never have a '/' + s|:(\d+)?/|:/|; } $rep = join(" ",@rep); if ($rep !~ $thorns{"$th"}) { - print "\n No login for CVS repository \n $thorns{\"$th\"}\n\n"; - do - { - print " Action: (q)uit, l)ogin, h)elp) [login] : "; - $answer = if (! defined $defaults); - if ($answer =~ /^q/i) - { - DIE("Leaving GetCactus script"); - } - elsif ($answer =~ /^h/i) - { - &OtherRepositoriesHelp(); - } - else - { - &LoginRepository($thorns{"$th"}); - } - } while ($answer =~ /^h/i); - + print "\n No login for CVS repository \n $thorns{\"$th\"}\n\n"; + do + { + print " Action: (q)uit, l)ogin, h)elp) [login] : "; + $answer = if (! defined $defaults); + if ($answer =~ /^q/i) + { + DIE("Leaving GetCactus script"); + } + elsif ($answer =~ /^h/i) + { + &OtherRepositoriesHelp(); + } + else + { + &LoginRepository($thorns{"$th"}); + } + } while ($answer =~ /^h/i); + } } # Checkout or update - if (-e $th) + if (-e $th) { print "\n Thorn already installed ... no overwrite\n"; print "\n Do you want to update $th [no] : "; $answer = ; if ($answer =~ /y/i) { - print " Updating $th\n"; - $command_up = "cvs $cvs_options -d $thorns{\"$th\"} update -d $tag $th |"; - print " (CVS repository: $thorns{\"$th\"})\n"; - open(REP,"<$th/CVS/Root") || DIE("No CVS files for $th"); - $installedrep = ; - close(REP); - chomp $installedrep; - if ($thorns{"$th"} !~ m:^$installedrep$:) - { - print " WARNING: Installed $th from different repository\n"; - print " ($installedrep)\n"; - } - else - { - if ($debug != 1) - { - open(CVSCO,$command_up); - while () - { - print $_; - } - close CVSCO; - } - else - { - print "\n DEBUG: $command_up\n\n"; - } - } + print " Updating $th\n"; + $command_up = "cvs $cvs_options -d $thorns{\"$th\"} update -d $tag $th |"; + print " (CVS repository: $thorns{\"$th\"})\n"; + open(REP,"<$th/CVS/Root") || DIE("No CVS files for $th"); + $installedrep = ; + close(REP); + chomp $installedrep; + if ($thorns{"$th"} !~ m:^$installedrep$:) + { + print " WARNING: Installed $th from different repository\n"; + print " ($installedrep)\n"; + } + else + { + if ($debug != 1) + { + open(CVSCO,$command_up); + while () + { + print $_; + } + close CVSCO; + } + else + { + print "\n DEBUG: $command_up\n\n"; + } + } } } else @@ -389,47 +353,40 @@ sub GetThorns $arrangement = $th; $arrangement =~ s:/[^/]*$::; $command_co_arr = "cvs $cvs_options -d $thorns{\"$th\"} co $tag $arrangement/README 2> /dev/null |"; - # (discard stderr because it is annoying when looking for a potential + # (discard stderr because it is annoying when looking for a potential # arragment README) if ($debug != 1) { - # Check that the repository exists - DIE("Repository $thorns{\"$th\"} not found \n Are you connected to the network?\n Is the repository name spelt right in your thornlist file?") if (!&RepositoryExists($thorns{"$th"})); - - open(CVSCO,$command_co_arr); - while () - { - print $_; - } - open(CVSCO,$command_co); - while () - { - print $_; - } + # Check that the repository exists + DIE("Repository $thorns{\"$th\"} not found \n Are you connected to the network?\n Is the repository name spelt right in your thornlist file?") if (!&RepositoryExists($thorns{"$th"})); + + open(CVSCO,$command_co_arr); + while () + { + print $_; + } + open(CVSCO,$command_co); + while () + { + print $_; + } } else { - print "\n DEBUG: $command_co\n\n"; + print "\n DEBUG: $command_co\n\n"; } } } - chdir "../.."; } #/*@@ # @routine CVSOptions -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Get options to be passed to CVS -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub CVSOptions @@ -442,11 +399,11 @@ sub CVSOptions $verbose = "no" if ((defined $defaults) && (! defined $verbose)); print "Verbose checkout (y)es, n)o, h)elp) [no] : "; - if (! defined $verbose) + if (! defined $verbose) { - $answer = - } - else + $answer = + } + else { $answer = $verbose; print "$answer\n"; @@ -469,7 +426,7 @@ sub CVSOptions return $cvs_options; } -sub VerboseCheckoutHelp +sub VerboseCheckoutHelp { print "\n\n"; print " CactusCode CVS checkout options\n"; @@ -487,17 +444,11 @@ sub VerboseCheckoutHelp #/*@@ # @routine GetCactusDir -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Get directory for Cactus installation -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub GetCactusDir @@ -507,22 +458,22 @@ sub GetCactusDir print "\n Directory for Cactus installation [$mydir] : "; - if (defined $install) + if (defined $install) { print " $install\n"; } $install = "" if ((defined $defaults) && (! defined $install)); - if (! $install) + if (! $install) { $install = ; } - if ($install =~ /^$/) + if ($install =~ /^$/) { $install = $mydir; - } + } chomp($install); @@ -538,17 +489,11 @@ sub GetCactusDir #/*@@ # @routine GetThornList -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Get the full path of the thorn list -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub GetThornList @@ -580,17 +525,11 @@ sub GetThornList #/*@@ # @routine ParseThornList -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Read the thorn names and repositories from the thorn list -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub ParseThornList @@ -619,17 +558,17 @@ sub ParseThornList { if (m:^\s*\!*\s*$endstring:) { - $parfile = 0; - &WriteParameterFile($filename,$parfiledata); - next; + $parfile = 0; + &WriteParameterFile($filename,$parfiledata); + next; } else { - if (m:^\s*\#(.*)$:) - { - $parfiledata .= "$1\n"; - next; - } + if (m:^\s*\#(.*)$:) + { + $parfiledata .= "$1\n"; + next; + } } } @@ -642,8 +581,8 @@ sub ParseThornList { $directive = &StripSpaces($1); $value = &StripSpaces($2); - - # Global directives + + # Global directives if ($directive =~ "DESC") { $description = $value; @@ -677,7 +616,7 @@ sub ParseThornList } elsif ($directive =~ "PARAMETER_FILE") { - $value =~ m:([\w._]*)\s*<<\s*(\w*)\s*$:; + $value =~ m:([\w._]*)\s*<<\s*(\w*)\s*$:; $parfile = 1; $filename = $1; $endstring = $2; @@ -716,17 +655,11 @@ sub ParseThornList #/*@@ # @routine DIE -# @date Sat Mar 11 15:31:55 CET 2000 +# @date Sat Mar 11 15:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Tidy up and die -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub DIE @@ -739,17 +672,11 @@ sub DIE #/*@@ # @routine WriteParameterFile -# @date Sun Apr 2 21:31:55 CET 2000 +# @date Sun Apr 2 21:31:55 CET 2000 # @author Gabrielle Allen -# @desc +# @desc # Write parameter file -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub WriteParameterFile @@ -771,11 +698,8 @@ sub WriteParameterFile } open(FILE,">$filename") || DIE("Could not open $filename"); - print FILE $data; - close(FILE); - } sub GetFleshPath @@ -790,7 +714,6 @@ sub GetFleshPath } return $path; - } diff --git a/lib/sbin/MakeUtils.pl b/lib/sbin/MakeUtils.pl index 6ac35c25..01be21c9 100644 --- a/lib/sbin/MakeUtils.pl +++ b/lib/sbin/MakeUtils.pl @@ -2,9 +2,9 @@ # @file MakeUtils.pl # @date July 1999 # @author Tom Goodale -# @desc +# @desc # Utility perl routines needed by the Makefile. -# @enddesc +# @enddesc # @version $Header$ #@@*/ @@ -13,9 +13,9 @@ # @routine buildthorns # @date Tue Jan 19 14:02:07 1999 # @author Tom Goodale -# @desc +# @desc # Creates an compiled ThornList -# @enddesc +# @enddesc # @version $Id$ #@@*/ @@ -24,11 +24,14 @@ sub buildthorns my($arrangement_dir,$choice) = @_; my(@arrangements); my(%info); + my($home); + $home = `pwd`; + chomp ($home); chdir $arrangement_dir || die "Can't change directory to $arrangement_dir\n"; open(ARRANGEMENTS, "ls|"); - + while() { chomp; @@ -39,61 +42,61 @@ sub buildthorns next if (m:~$:); next if (m:\.bak$:i); next if (m:^\.:); - + # Just pick directories if( -d $_) { push (@arrangements, $_); } } - + close ARRANGEMENTS; - + if ($choice =~ "thorns") { - + foreach $arrangement (@arrangements) { chdir $arrangement; - + open(THORNLIST, "ls|"); - + while() { - chomp; - - # Ignore CVS and backup stuff - next if (m:^CVS$:); - next if (m:^\#:); - next if (m:~$:); - next if (m:\.bak$:i); - next if (m:^\.:); - - # Allow each arrangement to have a documentation directory. - next if (m:^doc$:); - - # Just pick directories - if( -d $_) - { - push(@total_list, "$arrangement/$_"); - } + chomp; + + # Ignore CVS and backup stuff + next if (m:^CVS$:); + next if (m:^\#:); + next if (m:~$:); + next if (m:\.bak$:i); + next if (m:^\.:); + + # Allow each arrangement to have a documentation directory. + next if (m:^doc$:); + + # Just pick directories + if( -d $_) + { + push(@total_list, "$arrangement/$_"); + } } - chdir ".."; + chdir ($arrangement_dir) || die "Can't change directory to $arrangement_dir\n"; } - + } else { @total_list = @arrangements; } - + if($choice =~ "thorns") { foreach $thorn (@total_list) { if( -r "$thorn/interface.ccl" && -r "$thorn/param.ccl") { - $info{$thorn} = &ThornInfo($thorn); + $info{$thorn} = &ThornInfo($thorn); } # print "$thorn \# $info{$thorn}\n"; } @@ -106,7 +109,7 @@ sub buildthorns } } - chdir ".."; + chdir ($home) || die "Cannot change back to Cactus home directory\n"; return %info; } @@ -115,15 +118,9 @@ sub buildthorns # @routine ThornInfo # @date Sun Oct 17 15:57:44 1999 # @author Tom Goodale -# @desc +# @desc # Determines some info about a thorn. -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# @enddesc #@@*/ sub ThornInfo { @@ -209,18 +206,12 @@ sub ThornInfo #/*@@ # @routine ThornInfo -# @date Wed Sep 5 14:04:07 CEST 2001 -# @author Ian Kelley -# @desc +# @date Wed Sep 5 14:04:07 CEST 2001 +# @author Ian Kelley +# @desc # Reads in a thornlist and returns the arrangements/thorns, -# strips out all the comments/etc. -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory -# +# strips out all the comments/etc. +# @enddesc #@@*/ sub ReadThornlist { @@ -228,15 +219,15 @@ sub ReadThornlist my (@temp); my (%tl); - open (TL, "$thornlist") + open (TL, "$thornlist") || die "\nCannot open thornlist ($thornlist) for reading: $!"; - while () + while () { next if m:^!.*:; s/(.*?)#.*/\1/; # read up to the first "#" s/\s+//g; # replace any spaces with nothing - if (/\w+/) + if (/\w+/) { push @temp, $_; # add to array if something is left } @@ -249,5 +240,5 @@ sub ReadThornlist return %tl; } - + 1; diff --git a/lib/sbin/checkout.pl b/lib/sbin/checkout.pl index ab3ed874..88e2d157 100644 --- a/lib/sbin/checkout.pl +++ b/lib/sbin/checkout.pl @@ -2,13 +2,13 @@ # @file checkout.pl # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc +# @desc +# +# @enddesc #@@*/ # /usr/bin/perl -s -# These options are only local to this file, while they should be global to +# These options are only local to this file, while they should be global to # subroutines in CheckoutUtils.pl as well. Please fix. $cvs_ops="-z6 -q"; $cvs_checkout_ops="-P"; @@ -42,11 +42,10 @@ $rep = join(" ",@rep); &AddCVSPasswordFile($rep); while (!$finish) -{ - +{ print "Checkout thornlist, arrangements or individual thorns.\n "; print "tl)thornlist, arr)angements, t)horns, q)uit, h)elp : [arr] "; - + $which = ; if ($which =~ /^q/i) @@ -66,10 +65,9 @@ while (!$finish) &get_thorns(); } else - { + { &get_arrangements(); } - } print "\n All done!\n\n"; @@ -80,101 +78,97 @@ exit; # @routine get_arrangements # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub get_arrangements -{ - my(%info); - my($arrangement); - print "\n You already have arrangements: \n\n"; - - %info = &buildthorns("arrangements/","arrangements"); - - foreach $arrangement (sort keys %info) - { - print "$arrangement "; - } +{ + my(%info); + my($arrangement, $home); - print "\n\n Arrangements listed in modules file: \n"; + print "\n You already have arrangements: \n\n"; - open(MODULES,"cvs co -s | "); - - $count = 0; - while() - { - if (/(\w*)\s*ARRANGEMENT(.*)?/) - { - $count++; - $name{$count} = "$1"; - $devlev{$count} = "$2"; - } - } - - - for ($i=1; $i<$count+1;$i++) - { - $extra = ""; - if ($devlev{$i} == 2) - { - $extra = "(dev)"; - } - print " [$i] $name{$i} $extra\n"; - } - - print "\n"; - - print "Checkout arrangements h)elp, q)uit, c)ustom, range [1-$count] : "; + %info = &buildthorns("arrangements/","arrangements"); - # Goto target arrangement directory - chdir arrangements || die "Could not find arrangements directory"; + foreach $arrangement (sort keys %info) + { + print "$arrangement "; + } - $range = ; - if ($range =~ /^h/i) - { - &print_help(); - } - elsif ($range =~ /^q/i) + print "\n\n Arrangements listed in modules file: \n"; + + open(MODULES,"cvs co -s | "); + + $count = 0; + while() + { + if (/(\w*)\s*ARRANGEMENT(.*)?/) { - print "\n\n"; - exit(0); + $count++; + $name{$count} = "$1"; + $devlev{$count} = "$2"; } - elsif ($range =~ /^c/i) + } + + + for ($i=1; $i<$count+1;$i++) + { + $extra = $devlev{$i} == 2 ? '(dev)' : ''; + print " [$i] $name{$i} $extra\n"; + } + + print "\n"; + + print "Checkout arrangements h)elp, q)uit, c)ustom, range [1-$count] : "; + + # Goto target arrangement directory + $home = `pwd`; + chomp $home; + chdir ('arrangements') || die "Could not find arrangements directory"; + + $range = ; + if ($range =~ /^h/i) + { + &print_help(); + } + elsif ($range =~ /^q/i) + { + print "\n\n"; + exit(0); + } + elsif ($range =~ /^c/i) + { + print "Arrangement required: "; + $arrname = ; + &CheckOut($arrname); + } + elsif ($range =~ /^\s*$/) + { + $range = "1-$count"; + } + + while ($range =~/^([0-9]+(?:-[0-9]+)?),?/) + { + $range = $'; + $1 =~ /^([0-9]*)(-[0-9]*)?$/; + $first = $1; + if (!$2) { - print "Arrangement required: "; - $arrname = ; - &CheckOut($arrname); + $last=$1 } - elsif ($range =~ /^\s*$/) + else { - $range = "1-$count"; + $2=~/-([0-9]*)/; $last=$1 } - while ($range =~/^([0-9]+(?:-[0-9]+)?),?/) + for ($i=$first; $i<$last+1; $i++) { - $range = $'; - $1 =~ /^([0-9]*)(-[0-9]*)?$/; - $first = $1; - if (!$2) - {$last=$1} - else - {$2=~/-([0-9]*)/; $last=$1} - - for ($i=$first; $i<$last+1; $i++) - { - &CheckOut($name{$i}); - } + &CheckOut($name{$i}); } + } - chdir("..") || die "Could not go back to Cactus home directory\n"; - + chdir($home) || die "Could not go back to Cactus home directory\n"; } @@ -183,120 +177,116 @@ sub get_arrangements # @routine get_thorns # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub get_thorns { - my(%info); - my($thorn); - - print "\nYou already have thorns: "; - - %info = &buildthorns("arrangements/","thorns"); - - $last_arr = ""; - foreach $thorn (sort keys %info) - { - # Parse of the arrangement name - $thorn =~ m:(.*)/(.*):; - $this_arr = $1; - $this_tho = $2; - if ($last_arr ne $this_arr) - { - print "\n\n$this_arr:\n"; - print " $this_tho "; - } - else - { - print "$this_tho "; - } - $last_arr = $this_arr; - } + my(%info); + my($thorn, $home); + + print "\nYou already have thorns: "; - print "\n\nThorns listed in the modules file: \n"; + %info = &buildthorns("arrangements/","thorns"); - open(MODULES,"cvs -q co -s | "); - - $count = 0; - while() + $last_arr = ""; + foreach $thorn (sort keys %info) + { + # Parse of the arrangement name + $thorn =~ m:(.*)/(.*):; + $this_arr = $1; + $this_tho = $2; + if ($last_arr ne $this_arr) { - if (/(\w*\/?\w*)\s*THORN([^\s])\s/) - { - $count++; - $name{$count} = "$1"; - $devlev{$count} = "$2"; - } + print "\n\n$this_arr:\n"; + print " $this_tho "; } - - - for ($i=1; $i<$count+1;$i++) + else { - $extra = ""; - if ($devlev{$i} == "2") - { - $extra = "(dev)"; - } - print " [$i] $name{$i} $extra\n"; + print "$this_tho "; } - - print "\n"; - - print "Checkout thorns h)elp, q)uit, c)ustom, range [1-$count] : "; - - # Goto target arrangement directory - chdir arrangements || die "Could not find arrangements directory\n"; + $last_arr = $this_arr; + } - $range = ; - print "\n"; + print "\n\nThorns listed in the modules file: \n"; - if ($range =~ /^h/i) - { - &print_help(); - } - elsif ($range =~ /^q$/i) + open(MODULES,"cvs -q co -s | "); + + $count = 0; + while() + { + if (/(\w*\/?\w*)\s*THORN([^\s])\s/) { - print "\n\n"; - exit(0); + $count++; + $name{$count} = "$1"; + $devlev{$count} = "$2"; } - elsif ($range =~ /^c/i) + } + + + for ($i=1; $i<$count+1;$i++) + { + $extra = $devlev{$i} == 2 ? '(dev)' : ''; + print " [$i] $name{$i} $extra\n"; + } + + print "\n"; + + print "Checkout thorns h)elp, q)uit, c)ustom, range [1-$count] : "; + + # Goto target arrangement directory + $home = `pwd`; + chomp $home; + chdir ('arrangements') || die "Could not find arrangements directory\n"; + + $range = ; + print "\n"; + + if ($range =~ /^h/i) + { + &print_help(); + } + elsif ($range =~ /^q$/i) + { + print "\n\n"; + exit(0); + } + elsif ($range =~ /^c/i) + { + print "Arrangement/Thorn required: "; + $thornname = ; + &CheckOut($thornname); + } + elsif ($range =~ /^\s*$/) + { + $range = "1-$count"; + } + + while ($range =~/^([0-9]+(?:-[0-9]+)?),?/) + { + $range = $'; + $1 =~ /^([0-9]*)(-[0-9]*)?$/; + $first = $1; + if (!$2) { - print "Arrangement/Thorn required: "; - $thornname = ; - &CheckOut($thornname); + $last=$1 } - elsif ($range =~ /^\s*$/) + else { - $range = "1-$count"; + $2=~/-([0-9]*)/; $last=$1 } - while ($range =~/^([0-9]+(?:-[0-9]+)?),?/) + for ($i=$first; $i<$last+1; $i++) { - $range = $'; - $1 =~ /^([0-9]*)(-[0-9]*)?$/; - $first = $1; - if (!$2) - {$last=$1} - else - {$2=~/-([0-9]*)/; $last=$1} - - for ($i=$first; $i<$last+1; $i++) - { - $arrangement = $name{$i}; - $arrangement =~ s:/[^/]*$::; - &CheckOutREADME("$arrangement/README"); - &CheckOut($name{$i}); - } + $arrangement = $name{$i}; + $arrangement =~ s:/[^/]*$::; + &CheckOutREADME("$arrangement/README"); + &CheckOut($name{$i}); } + } - chdir ("..") || die "Could not return to Cactus home directory\n"; + chdir($home) || die "Could not go back to Cactus home directory\n"; } @@ -306,15 +296,9 @@ sub get_thorns # @routine get_thornlist # @date Sat Jul 13 16:38:52 2000 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub get_thornlist { @@ -322,71 +306,53 @@ sub get_thornlist { print "\nThorn List directory \"thornlists\" not found\n\n"; return; - } - else + } + + $thornlist = 0; + while (!$thornlist) { - $thornlist = 0; - while (!$thornlist) + print "\nLists in thornlist directory: \n"; + open(LISTS, "ls thornlists |"); + + while() { - print "\nLists in thornlist directory: \n"; - open(LISTS, "ls thornlists |"); - - while() - { - print " $_"; - } - close LISTS; - print "\nChoose ThornList : "; - - $thornlist = <>; - print "\n"; - chomp($thornlist); - if (!-e "thornlists/$thornlist") - { - $thornlist = 0; - } + print " $_"; } - &CheckoutThornList("thornlists/$thornlist"); + close LISTS; + print "\nChoose ThornList : "; + + $thornlist = <>; + print "\n"; + chomp($thornlist); + $thornlist = 0 if (!-e "thornlists/$thornlist"); } + &CheckoutThornList("thornlists/$thornlist"); } #/*@@ # @routine print_help # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub print_help -{ - - print "\nTo select arrangements or thorns for checking out from CVS, give\n"; - print "a comma separated list with the numbers of the thorns/arrangements.\n"; - print "Ranges can also be given, using a hyphen.\n"; - print "For example, to checkout thorns/arrangements 1,2,4,6,7,9 use:\n\n"; - print " 1-2,4,6-7,9\n\n"; +{ + print "\nTo select arrangements or thorns for checking out from CVS, give\n"; + print "a comma separated list with the numbers of the thorns/arrangements.\n"; + print "Ranges can also be given, using a hyphen.\n"; + print "For example, to checkout thorns/arrangements 1,2,4,6,7,9 use:\n\n"; + print " 1-2,4,6-7,9\n\n"; } #/*@@ # @routine Checkout # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub CheckOut { @@ -409,15 +375,9 @@ sub CheckOut # @routine CheckoutREADME # @date Sat Jul 20 16:38:52 2000 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub CheckOutREADME { @@ -433,42 +393,29 @@ sub CheckOutREADME # @routine PrintInfo # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub PrintInfo { print "\n"; print "Type \"help\" at any prompt for a description on how\nto use this script\n\n"; print "________________________________________________________________________\n\n"; -} +} #/*@@ # @routine CVSFound # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ sub CVSFound { - my($foundit); - + $foundif = 0; open(MODULES,"cvs -v | "); while () @@ -476,6 +423,7 @@ sub CVSFound if (/Concurrent Versions System/) { $foundit = 1; + break; } } close(MODULES); @@ -488,25 +436,19 @@ sub CVSFound # @routine RepositoryExists # @date Sat Jul 3 16:38:52 1999 # @author Gabrielle Allen -# @desc -# -# @enddesc -# @calls -# @calledby -# @history -# -# @endhistory +# @desc # +# @enddesc #@@*/ -sub RepositoryExists -{ - my($repository) = @_; - my @dummy; - - open(MODULES,"cvs -d $_[0] co -s |"); - @dummy = ; - close(MODULES); - - return !$?; - -} +#sub RepositoryExists +#{ +# my($repository) = @_; +# my @dummy; +# +# open(MODULES,"cvs -d $_[0] co -s |"); +# @dummy = ; +# close(MODULES); +# +# return !$?; +# +#} -- cgit v1.2.3