summaryrefslogtreecommitdiff
path: root/lib/sbin/checkout.pl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sbin/checkout.pl')
-rw-r--r--lib/sbin/checkout.pl500
1 files changed, 221 insertions, 279 deletions
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 = <STDIN>;
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(<MODULES>)
- {
- 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 = <STDIN>;
- 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(<MODULES>)
+ {
+ 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 = <STDIN>;
+ if ($range =~ /^h/i)
+ {
+ &print_help();
+ }
+ elsif ($range =~ /^q/i)
+ {
+ print "\n\n";
+ exit(0);
+ }
+ elsif ($range =~ /^c/i)
+ {
+ print "Arrangement required: ";
+ $arrname = <STDIN>;
+ &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 = <STDIN>;
- &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(<MODULES>)
+ $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 = <STDIN>;
- 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(<MODULES>)
+ {
+ 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 = <STDIN>;
+ 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 = <STDIN>;
+ &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 = <STDIN>;
- &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(<LISTS>)
{
- print "\nLists in thornlist directory: \n";
- open(LISTS, "ls thornlists |");
-
- while(<LISTS>)
- {
- 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 (<MODULES>)
@@ -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 = <MODULES>;
- close(MODULES);
-
- return !$?;
-
-}
+#sub RepositoryExists
+#{
+# my($repository) = @_;
+# my @dummy;
+#
+# open(MODULES,"cvs -d $_[0] co -s |");
+# @dummy = <MODULES>;
+# close(MODULES);
+#
+# return !$?;
+#
+#}