root/juggler/tags/1.1_dr_2/cvs-gather.pl

Revision 10310, 34.6 kB (checked in by patrickh, 6 years ago)

Update to version 0.1.6.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/env perl
2
3 # ************** <auto-copyright.pl BEGIN do not edit this line> **************
4 #
5 # Doozer++ is (C) Copyright 2000, 2001 by Iowa State University
6 #
7 # Original Author:
8 #   Patrick Hartling
9 #
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Library General Public
12 # License as published by the Free Software Foundation; either
13 # version 2 of the License, or (at your option) any later version.
14 #
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 # Library General Public License for more details.
19 #
20 # You should have received a copy of the GNU Library General Public
21 # License along with this library; if not, write to the
22 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 # Boston, MA 02111-1307, USA.
24 #
25 # *************** <auto-copyright.pl END do not edit this line> ***************
26
27 # cvs-gather.pl,v 1.21 2002/08/16 21:17:57 patrickh Exp
28
29 use 5.005;
30
31 use Cwd qw(chdir getcwd);
32 use File::Basename;
33 use File::Path;
34 use Getopt::Long;
35 use Pod::Usage;
36
37 use strict 'vars';
38 use vars qw($indent $log_file $full_path $debug_level);
39 use vars qw($CRITICAL_LVL $WARNING_LVL $CONFIG_LVL $STATE_LVL $VERB_LVL
40             $HVERB_LVL $HEX_LVL);
41
42 # Subroutine prototypes.
43 sub printVersion();
44 sub parse($$);
45 sub parseModule($$$;$);
46 sub handleInclude($$$);
47 sub expandWildcardLine($$);
48 sub expandWildcards($$$$$);
49 sub doOverride($$);
50 sub overrideValue($$$);
51 sub checkoutModules($);
52 sub updateModule($$$$);
53 sub checkoutModule($$$$$$$);
54 sub runCvsCommand($);
55 sub modifyCvsEntries($$);
56 sub expandEnvVars($);
57 sub printDebug($@);
58 sub nextSpinnerFrame($);
59
60 # *********************************************************************
61 # Here is the version for this script!
62
63 my $VERSION = '0.1.6';
64 # *********************************************************************
65
66 my $cfg_file      = '';
67 my $help          = 0;
68 my $print_version = 0;
69 my $verbose       = 0;
70 my $entry_mod     = 0;
71 my $force_install = 0;
72 my $manual        = 0;
73
74 my (@limit_modules) = ();
75 my (@overrides)     = ();
76 my (%cmd_overrides) = ();
77
78 $CRITICAL_LVL = 0;
79 $WARNING_LVL  = 1;
80 $CONFIG_LVL   = 2;
81 $STATE_LVL    = 3;
82 $VERB_LVL     = 4;
83 $HVERB_LVL    = 5;
84 $HEX_LVL      = 6;
85
86 $debug_level = $CRITICAL_LVL;
87 GetOptions('cfg=s' => \$cfg_file, 'help' => \$help, 'override=s' => \@overrides,
88            'debug=i' => \$debug_level, 'set=s' => \%cmd_overrides,
89            'version' => \$print_version, 'verbose' => \$verbose,
90            'entry-mod' => \$entry_mod, 'force-install' => \$force_install,
91            'target=s' => \@limit_modules, 'manual' => \$manual)
92    or pod2usage(2);
93
94 # Print the help output and exit if --help was on the command line.
95 pod2usage(1) if $help;
96 pod2usage(-exitstatus => 0, -verbose => 2) if $manual;
97
98 # Print the version number and exit if --version was on the command line.
99 printVersion() && exit(0) if $print_version;
100
101 # If we are doing verbose output and the user did not change the debug level,
102 # then we push the debug level up to the max.
103 $debug_level = $HVERB_LVL if $verbose && $debug_level <= $CRITICAL_LVL;
104
105 if ( ! $cfg_file )
106 {
107    if ( -r "Gatherrc" )
108    {
109       $cfg_file = 'Gatherrc';
110    }
111    elsif ( -r ".gatherrc" )
112    {
113       $cfg_file = '.gatherrc';
114    }
115    else
116    {
117       $cfg_file = "$ENV{'HOME'}/.gatherrc";
118    }
119 }
120
121 $log_file = "gather.log";
122 open(LOG_FILE, "> $log_file")
123    or warn "WARNING: Could not create log file $log_file: $!\n";
124
125 my (%orig_modules) = ();
126 parse("$cfg_file", \%orig_modules) or die "ERROR: Failed to parse $cfg_file\n";
127 my %override_modules = %orig_modules;
128
129 if ( $#overrides == -1 )
130 {
131    if ( -r ".gatherrc-override" )
132    {
133       push(@overrides, '.gatherrc-override');
134    }
135    elsif ( -r "$ENV{'HOME'}/.gatherrc-override" )
136    {
137       push(@overrides, "$ENV{'HOME'}/.gatherrc-override");
138    }
139 }
140
141 my $override = '';
142 foreach $override ( @overrides )
143 {
144    if ( open(OVERRIDE, "$override") )
145    {
146       my $line;
147       while ( $line = <OVERRIDE> )
148       {
149          chomp($line);
150
151          # Strip comments.
152          $line =~ s/#.*$//;
153
154          # Skip blank lines.
155          next if $line =~ /^\s*$/;
156
157          # The current line has at least one wildcard.
158          if ( $line =~ /\*/ )
159          {
160             if ( $line !~ /\*\./ )
161             {
162                warn "ERROR: Invalid wildcard use at $override:$.\n";
163             }
164             else
165             {
166                my(@override_lines) = expandWildcardLine("$line",
167                                                         \%orig_modules);
168
169                foreach ( @override_lines )
170                {
171                   doOverride("$_", \%override_modules);
172                }
173             }
174          }
175          # The current line has no wildcards.
176          else
177          {
178             doOverride("$line", \%override_modules);
179          }
180       }
181
182       close(OVERRIDE);
183    }
184    else
185    {
186       warn "WARNING: Could not open override file $override: $!\n";
187    }
188 }
189
190 my $key;
191 foreach $key ( keys(%cmd_overrides) )
192 {
193    # This is needed because expandWildcardLine() and doOverride() expect to
194    # see something of the form "<key> = <value>".
195    my $line = "$key = $cmd_overrides{$key}";
196
197    # The current line has at least one wildcard.
198    if ( $key =~ /\*/ )
199    {
200       if ( $key !~ /\*\./ )
201       {
202          warn "ERROR: Invalid wildcard use at $override:$.\n";
203       }
204       else
205       {
206          my(@override_lines) = expandWildcardLine("$line", \%orig_modules);
207
208          foreach ( @override_lines )
209          {
210             doOverride("$_", \%override_modules);
211          }
212       }
213    }
214    # The current line has no wildcards.
215    else
216    {
217       doOverride("$line", \%override_modules);
218    }
219 }
220
221 my (%targeted_modules) = ();
222
223 if ( $#limit_modules == -1 )
224 {
225    %targeted_modules = %override_modules;
226 }
227 else
228 {
229    foreach ( @limit_modules )
230    {
231       if ( ! defined($override_modules{"$_"}) )
232       {
233          warn "WARNING: Trying to target unknown module '$_'\n";
234          next;
235       }
236
237       $targeted_modules{"$_"} = $override_modules{"$_"};
238    }
239 }
240
241 checkoutModules(\%targeted_modules);
242 exit 0;
243
244 # -----------------------------------------------------------------------------
245 # Subroutines follow.
246 # -----------------------------------------------------------------------------
247
248 sub printVersion ()
249 {
250    print "$VERSION\n";
251
252    return 1;
253 }
254
255 sub parse ($$)
256 {
257    my $file       = shift;
258    my $module_ref = shift;
259
260    my $status = 1;
261
262    open(INPUT, "$file") or die "ERROR: Could not open $file: $!\n";
263
264    my $cfg_data = '';
265    while ( <INPUT> )
266    {
267       $cfg_data .= $_;
268    }
269    close(INPUT);
270
271    $cfg_data =~ s|/\*.*?\*/||gs; # Strip out C-style comments
272    $cfg_data =~ s/#.*$//gm;      # Strip out shell-style comments
273    $cfg_data =~ s|//.*$||gm;     # Strip out C++-style comments
274
275    my $mod_count = 0;
276    while ( $cfg_data =~ /\s*(\w.*?\w?)\s*{\s*(.*?)\s*}\s*;\s*/s )
277    {
278       my $module_name = "$1";
279       my $module_body = "$2";
280       $cfg_data       = $';
281
282       $indent = 0;
283       print "Loading $module_name from $file ...\n";
284       my $parse_stat = parseModule("$module_body", "$module_name", $module_ref);
285       return 0 if $parse_stat == -1;
286       $mod_count++
287    }
288
289    warn "WARNING: Nothing happened which probably means a parse error\n"
290       unless $mod_count > 0;
291
292    return $status;
293 }
294
295 sub parseModule ($$$;$)
296 {
297    my $module_body = shift;
298    my $module_name = shift;
299    my $module_ref  = shift;
300    my $in_module   = shift || 0;
301
302    print " " x $indent, "Parsing $module_name\n";
303
304    my $status = 1;
305
306    # Ensure that all of these are initialized just for safety's sake.
307    $$module_ref{"$module_name"}{'CVSROOT'} = '';
308    $$module_ref{"$module_name"}{'Module'}  = [];
309    $$module_ref{"$module_name"}{'Date'}    = '';
310    $$module_ref{"$module_name"}{'Tag'}     = '';
311    $$module_ref{"$module_name"}{'Path'}    = '.';
312
313    # Initialize this module's dependency hash with an anonymous hash
314    # reference.
315    $$module_ref{"$module_name"}{'deps'} = {};
316
317    while ( "$module_body" ne "" && $status == 1 )
318    {
319       printDebug $HEX_LVL, ">" x 78, "\nNew module body:\n$module_body\n",
320                            "<" x 78, "\n";
321
322       SWITCH:
323       {
324          # Matched an include.
325          if ( $module_body =~ /^(s?include\s+(.+?);)/s )
326          {
327             my $inc_string = "$1";
328             my $inc_file   = "$2";
329
330             $indent += 4;
331             $status = handleInclude("$inc_string", "$inc_file", \$module_body);
332             $indent -= 4;
333
334             last SWITCH;
335          }
336
337          if ( $module_body =~ /^CVSROOT:\s+(\S+?)\s*;/s )
338          {
339             $$module_ref{"$module_name"}{'CVSROOT'} = "$1";
340             $module_body = $';
341             last SWITCH;
342          }
343
344          if ( $module_body =~ /^Module:\s+(.+?)\s*;/s )
345          {
346             my $temp = "$1";
347             $module_body = $';
348
349             my($cvs_module_name, $install_name) = ('', '');
350
351             if ( $temp =~ /^(.+?)\s*\[(.*)\]\s*$/ )
352             {
353                $cvs_module_name = "$1";
354                $install_name    = "$2";
355             }
356             else
357             {
358                $cvs_module_name = "$temp";
359             }
360
361             push(@{$$module_ref{"$module_name"}{'Module'}},
362                  {$cvs_module_name => $install_name});
363             last SWITCH;
364          }
365
366          # Matched a tag/branch setting for this module.
367          if ( $module_body =~ /^Tag:\s+(\S+?)\s*;/s )
368          {
369             $$module_ref{"$module_name"}{'Tag'}  = "$1";
370             $module_body = $';
371             last SWITCH;
372          }
373
374          # Matched a date setting for this module.
375          if ( $module_body =~ /^Date:\s+(.+?)\s*;/s )
376          {
377             $$module_ref{"$module_name"}{'Date'}  = "$1";
378             $module_body = $';
379             last SWITCH;
380          }
381
382          # Matched a path setting for this module.
383          if ( $module_body =~ /^Path:\s+(.+?)\s*;/s )
384          {
385             my $path = "$1";
386             expandEnvVars(\$path);
387             $$module_ref{"$module_name"}{'Path'}  = "$path";
388             $module_body   = $';
389             last SWITCH;
390          }
391
392          # Matched the beginning of a sub-module.
393          if ( $module_body =~ /^(\w.*?\w?)\s*{\s*(.*)/s )
394          {
395             $indent += 4;
396             ($module_body = parseModule("$2", "$1",
397                                         $$module_ref{"$module_name"}{'deps'},
398                                         1))
399                or return 0;
400             $indent -= 4;
401             print " " x $indent, "Returning to $module_name\n";
402             last SWITCH;
403          }
404
405          # We have reached the end of the module.
406          if ( $module_body =~ /^}/ && $in_module )
407          {
408             print " " x $indent, "Finished parsing $module_name\n";
409             return $';
410          }
411
412          warn "Parse error in the following:\n$module_body\n";
413          $status = -1;
414       }
415
416       $module_body =~ s/^\s+(\S*)/$1/s;
417    }
418
419    return $status;
420 }
421
422 sub handleInclude ($$$)
423 {
424    my $inc_string = shift;
425    my $inc_file   = shift;
426    my $text_ref   = shift;
427
428    my $sinclude = 1 if $inc_string =~ /^sinclude/;
429
430    my $status = 1;
431
432    expandEnvVars(\$inc_file);
433
434    if ( open(INC_FILE, "$inc_file") )
435    {
436       my $loaded_body = '';
437       while ( <INC_FILE> )
438       {
439          $loaded_body .= $_;
440       }
441       close(INC_FILE);
442
443       $$text_ref =~ s/\Q$inc_string\E/$loaded_body/s;
444    }
445    else
446    {
447       warn "WARNING: Failed to load $inc_file: $!\n" unless $sinclude;
448       $$text_ref =~ s/\Q$inc_string\E//s;
449       $status = 0;
450    }
451
452    return $status;
453 }
454
455 sub expandWildcardLine ($$)
456 {
457    my $line       = shift;
458    my $module_ref = shift;
459
460    my (@expanded_lines) = ();
461
462    my ($path, $value) = split(/\s*=\s*/, "$line");
463    my (@path_arr)     = split(/\./, "$path");
464
465    local $full_path = "$path";
466
467    if ( $#path_arr < 1 )
468    {
469       warn "ERROR: Invalid hierarchy in $line ($override:$.)\n";
470    }
471    else
472    {
473       my (@modules) = ();
474
475       if ( "$path_arr[0]" eq "*" )
476       {
477          @modules = keys(%$module_ref);
478       }
479       else
480       {
481          $modules[0] = $path_arr[0];
482       }
483
484       my $module;
485       foreach $module ( @modules )
486       {
487          my (@work_arr) = @path_arr;
488          $work_arr[0] = "$module";
489          my $work_path = "$full_path";
490          $work_path =~ s/^\*/$module/;
491
492          expandWildcards(\@work_arr, $module_ref, $value, \@expanded_lines,
493                          $work_path);
494       }
495    }
496
497    return @expanded_lines;
498 }
499
500 sub expandWildcards ($$$$$)
501 {
502    my $path_ref       = shift;
503    my $module_ref     = shift;
504    my $override_value = shift;
505    my $lines_ref      = shift;
506    my $work_path      = shift;
507
508    my $current_value = shift(@$path_ref);
509    printDebug $VERB_LVL, "current_value: $current_value\n";
510
511    if ( "$current_value" eq "*" )
512    {
513       die "This should never happen!\n";
514    }
515    else
516    {
517       # A wildcard in this position (<Module>.*) must always indicate a
518       # project dependency.
519       if ( $$path_ref[0] && $$path_ref[0] eq "*" )
520       {
521          my (@temp_arr) = ();
522          my ($dep_name, $new_path);
523
524          shift(@$path_ref);
525          my $save_path = $work_path;
526          printDebug $VERB_LVL, "Unexpanded Path: $work_path\n";
527
528          foreach $dep_name ( keys(%{$$module_ref{"$current_value"}{'deps'}}) )
529          {
530             printDebug $VERB_LVL, "Dep: $dep_name\n";
531             @temp_arr = @$path_ref;
532             unshift(@temp_arr, "$dep_name");
533             printDebug $HVERB_LVL, "path_arr: @$path_ref\n";
534             printDebug $HVERB_LVL, "temp_arr: @temp_arr\n";
535
536             $work_path =~ s/\*/$dep_name/;
537             printDebug $VERB_LVL, "New Path: $work_path\n";
538
539             expandWildcards(\@temp_arr, $$module_ref{"$current_value"}{'deps'},
540                             $override_value, $lines_ref, $work_path);
541             $work_path = $save_path;
542          }
543
544          # If the above expansion gave us <Module>.<Setting>, we now have
545          # only <Setting> which is meaningless.
546          # XXX: It seems like this should not be necessary, but it may be the
547          # result of using a different array reference in the recursive calls.
548          shift(@$path_ref) if $#$path_ref == 0;
549       }
550       elsif ( defined($$module_ref{"$current_value"}) )
551       {
552          printDebug $STATE_LVL, "Matched $current_value\n";
553          printDebug $VERB_LVL, "Checking for $$path_ref[0] in $current_value\n";
554
555          # We have reached the end of the recursion.
556          if ( defined($$module_ref{"$current_value"}{$$path_ref[0]}) )
557          {
558             printDebug $STATE_LVL,
559                        "Adding line '$work_path = $override_value'\n";
560             push(@$lines_ref, "$work_path = $override_value");
561          }
562          elsif ( defined($$module_ref{"$current_value"}{'deps'}{$$path_ref[0]}) )
563          {
564             printDebug $STATE_LVL, "Matched dependency $$path_ref[0]\n";
565             expandWildcards($path_ref, $$module_ref{"$current_value"}{'deps'},
566                             $override_value, $lines_ref, $work_path);
567          }
568          else
569          {
570             warn "WARNING: $work_path not found!\n";
571          }
572       }
573       else
574       {
575          warn "WARNING: $work_path not found!\n";
576       }
577    }
578 }
579
580 sub doOverride ($$)
581 {
582    my $line       = shift;
583    my $module_ref = shift;
584
585    my ($path, $value) = split(/\s*=\s*/, "$line");
586    my (@path_arr)     = split(/\./, "$path");
587
588    if ( $#path_arr < 1 )
589    {
590       warn "ERROR: Invalid hierarchy in $line ($override:$.)\n";
591    }
592    else
593    {
594       local $full_path = "$path";
595       overrideValue(\@path_arr, $module_ref, "$value");
596    }
597 }
598
599 sub overrideValue ($$$)
600 {
601    my $path_ref       = shift;
602    my $module_ref     = shift;
603    my $override_value = shift;
604
605    my $current_value = shift(@$path_ref);
606
607    if ( defined($$module_ref{"$current_value"}) )
608    {
609 #      print "Matched $current_value\n";
610 #      print "Checking for ", $$path_ref[0], " in $current_value\n";
611
612       # We have reached the end of the recursion.
613       if ( defined($$module_ref{"$current_value"}{$$path_ref[0]}) )
614       {
615          if ( $$path_ref[0] eq "Module" )
616          {
617             my $module_list = "$override_value";
618             $module_list =~ s/;/ /g;
619
620             my(@modules)       = split(/;/, "$module_list");
621             my(@mod_overrides) = ();
622
623             my $mod;
624             foreach $mod ( @modules )
625             {
626                my($module_name, $install_name) = ('', '');
627
628                if ( $mod =~ /^\s*(.+?)\s*\[(.*)\]\s*$/ )
629                {
630                   $module_name  = "$1";
631                   $install_name = "$2";
632                }
633                else
634                {
635                   $module_name = "$mod";
636                }
637
638                push(@mod_overrides, {$module_name => $install_name});
639             }
640
641             print "Overriding $full_path with $module_list\n";
642             $$module_ref{"$current_value"}{'Module'} = \@mod_overrides;
643          }
644          elsif ( $$path_ref[0] eq "Path" )
645          {
646             my $new_path = "$override_value";
647             expandEnvVars(\$new_path);
648
649             print "Overriding $full_path with $new_path\n";
650             $$module_ref{"$current_value"}{'Path'} = "$new_path";
651          }
652          else
653          {
654             print "Overriding $full_path with $override_value\n";
655             $$module_ref{"$current_value"}{$$path_ref[0]} = "$override_value";
656          }
657       }
658       elsif ( defined($$module_ref{"$current_value"}{'deps'}{$$path_ref[0]}) )
659       {
660 #         print "Matched dependency $$path_ref[0]\n";
661          overrideValue($path_ref, $$module_ref{"$current_value"}{'deps'},
662                        $override_value);
663       }
664       else
665       {
666          warn "WARNING: $full_path not found!\n";
667       }
668    }
669    else
670    {
671       warn "WARNING: $full_path not found!\n";
672    }
673 }
674
675 sub checkoutModules ($)
676 {
677    my $mod_ref = shift;
678
679    my $mod_name;
680    foreach $mod_name ( keys(%$mod_ref) )
681    {
682       my $module = '';
683       foreach $module ( @{$$mod_ref{"$mod_name"}{'Module'}} )
684       {
685          my($cvs_module_name, $install_name) = each(%$module);
686
687          if ( defined($$mod_ref{"$mod_name"}{'CVSROOT'}) && $cvs_module_name )
688          {
689             # If a module is already checked out, update it instead of doing
690             # a new checkout.
691             if ( ($install_name &&
692                     -d "$$mod_ref{$mod_name}{'Path'}/$install_name") ||
693                  -d "$$mod_ref{$mod_name}{'Path'}/$cvs_module_name" )
694             {
695                updateModule("$mod_name", $$mod_ref{"$mod_name"}{'Path'},
696                             "$cvs_module_name", "$install_name");
697             }
698             else
699             {
700                printDebug $VERB_LVL, "$mod_name --> ",
701                           "$$mod_ref{$mod_name}{'CVSROOT'} ",
702                           "$$mod_ref{$mod_name}{'Tag'} ",
703                           "$$mod_ref{$mod_name}{'Date'} ",
704                           "$cvs_module_name (to $$mod_ref{$mod_name}{'Path'}";
705                printDebug $VERB_LVL, "/$install_name" if $install_name;
706                printDebug $VERB_LVL, ")\n";
707
708                checkoutModule($mod_name, $$mod_ref{"$mod_name"}{'CVSROOT'},
709                               $$mod_ref{"$mod_name"}{'Tag'},
710                               $$mod_ref{"$mod_name"}{'Date'},
711                               "$cvs_module_name",
712                               $$mod_ref{"$mod_name"}{'Path'},
713                               "$install_name");
714             }
715          }
716       }
717
718       checkoutModules($$mod_ref{"$mod_name"}{'deps'});
719    }
720 }
721
722 sub updateModule ($$$$)
723 {
724    my $name         = shift;
725    my $path         = shift;
726    my $cvs_module   = shift;
727    my $install_name = shift;
728
729    my $module = ("$install_name" ne "") ? "$install_name" : "$cvs_module";
730
731    print "Updating $name ($module) in $path ...\n";
732
733    my $cur_dir = getcwd();
734    chdir("$path") if "$path" ne "" && "$path" ne ".";
735
736    my $status;
737
738    if ( chdir("$module") )
739    {
740       $status = runCvsCommand('cvs update');
741    }
742    else
743    {
744       warn "WARNING: Update of $module in $path failed: $!\n";
745       $status =  0;
746    }
747
748    chdir("$cur_dir");
749    print "Done\n";
750
751    return $status;
752 }
753
754 sub checkoutModule ($$$$$$$)
755 {
756    my $name         = shift;
757    my $cvsroot      = shift;
758    my $tag          = shift;
759    my $date         = shift;
760    my $cvs_module   = shift;
761    my $path         = shift;
762    my $install_name = shift;
763
764    if ( "$cvsroot" ne "" && "$cvs_module" ne "" )
765    {
766       print LOG_FILE "Checking out $cvs_module from $cvsroot ...\n";
767       my $cmd_line = "cvs -d $cvsroot checkout ";
768
769       $cmd_line .= "-r $tag " if $tag && "$tag" ne "HEAD";
770       $cmd_line .= "-D \"$date\" " if $date;
771
772       $cmd_line .= "$cvs_module";
773       print "Checking out source for $name: $cvs_module -- please wait ...\n";
774       print LOG_FILE "$cmd_line\n";
775       my $cwd = getcwd();
776
777       # The name for the temporary checkout directory.
778       my $temp_checkout_dir = "$cwd/temp.$$";
779
780       # Create the temporary directory for the initial module checkout.
781       # If it already exists, just use it.
782       if ( -d "$temp_checkout_dir" || mkdir("$temp_checkout_dir", 0700) )
783       {
784          chdir("$temp_checkout_dir")
785             or warn "WARNING: Could not chdir to $temp_checkout_dir: $!\n";
786       }
787       # If the temporary directory creation failed, we'll just fall back on
788       # the current working directory.
789       else
790       {
791          $temp_checkout_dir = "$cwd";
792       }
793
794       runCvsCommand("$cmd_line");
795
796       chdir("$cwd");
797       mkdir("$path", 0755) unless -d "$path";
798       chdir("$path") if $path;
799
800       # This is the full path to the directory where the checked-out module
801       # will be placed after being downloaded.
802       my $inst_dir = getcwd();
803
804       # We have an alternate installation name that the actual path to the
805       # checked-out module.
806       if ( $install_name )
807       {
808          print "    Moving $cvs_module to $install_name ...\n";
809          
810