ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/scramcli
Revision: 1.29
Committed: Mon Jan 21 15:39:47 2002 UTC (23 years, 4 months ago) by sashby
Branch: MAIN
Changes since 1.28: +7 -5 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 sashby 1.26 # -*-perl-*-
2 sashby 1.2 #===========================================================================#
3 sashby 1.15 # NAME: scramcli #
4 sashby 1.2 #===========================================================================#
5     # DATE: Mon May 28 11:36:18 2001 #
6     # AUTHOR: C. Williams #
7     # MAINTAINER: Shaun Ashby #
8     #===========================================================================#
9     # DESCRIPTION: The main scram program (NOTE: this is wrapped at runtime to #
10     # set up the path to the SCRAM Perl modules). #
11 sashby 1.15 # #
12 sashby 1.2 #===========================================================================#
13    
14 sashby 1.29 # Verbose mode:
15     &local_verbose("MAIN",@ARGV);
16    
17 sashby 1.19 $main::bold = "";
18     $main::normal = "";
19     $main::line = "-"x80;
20     $main::lookupobject = "";
21 sashby 1.15
22 sashby 1.10 # Test whether the output from SCRAM is being redirected, or
23     # not (prevents escape signals from being printed to STDOUT if
24 sashby 1.25 # STDOUT is redirected to a file or piped):
25 sashby 1.11 if ( -t STDIN && -t STDOUT )
26     {
27     $bold = "\033[1m";
28     $normal = "\033[0m";
29     }
30    
31 sashby 1.2 # Allowed main and dev commands:
32 sashby 1.13 @allowed_commands=qw(project build install version list remove arch setup runtime setroot db tool url);
33 sashby 1.18 @dev_cmds=qw(devtest devint align);
34 hpw 1.1
35 sashby 1.2 # Check for prerequisites:
36     prerequisitecheck();
37     # Check for version consistency:
38 hpw 1.1 versioncheck();
39    
40 sashby 1.28
41 sashby 1.2 # Parse arguments (look for "-verbose" or "-arch" then shift):
42     while ( $ARGV[0] =~ /^-/)
43     {
44     if ( $ARGV[0] eq "-verbose" )
45     {
46 sashby 1.27 # Enable verbose for main as well, by default when -verbose mode selected:
47     $ENV{'SCRAMDEBUG'} = 1;
48 sashby 1.2 shift @ARGV;
49     # If no argument (i.e. class to activate "verbose" for) do nothing:
50     if (defined ($ARGV[0]))
51     {
52 sashby 1.21 print "Verbose mode for $ARGV[0] switched ".$bold."ON".$normal."\n" ;
53 sashby 1.2 scrambasics()->classverbose($ARGV[0],1);
54     }
55     }
56     elsif ( $ARGV[0] eq "-arch" )
57     {
58     shift @ARGV;
59     $ENV{SCRAM_ARCH}=$ARGV[0];
60     scrambasics()->arch($ARGV[0]);
61     }
62     else
63     {
64     error("Unknown option $ARGV[0]");
65     }
66     shift @ARGV;
67     }
68    
69     # Shift args to get input command:
70 hpw 1.1 $inputcmd=shift;
71     $found='false';
72     $rv=0;
73     $self={};
74    
75 sashby 1.2 # Check that input command is defined, and then
76     # run a scram subroutine for the command or show
77     # some help:
78     if ( $inputcmd ne "" )
79     {
80     foreach $command ( (@allowed_commands,@dev_cmds) )
81     {
82     if ( $command =~ /^$inputcmd/i)
83     {
84     # Deal with a help request
85     do
86     {
87     helpheader($command);
88     &{"help_".$command};
89     exit;
90     } if $ARGV[0] =~ /help/i;
91     $rv=&$command;
92     $found='true';
93     last;
94     }
95     }
96     }
97    
98     if ( ! ( $found =~ /true/ ) )
99     {
100     helpheader('Recognised Commands');
101     foreach $command ( @allowed_commands )
102     {
103     print " $bold scram ".$command.$normal."\n";
104     }
105     print "\n";
106     print "Help on individual commands available through\n\n";
107     print "$bold scram".$normal." command$bold help $normal\n\n";
108    
109     print "\nOptions:\n";
110     print "--------\n";
111     print $bold."-verbose ".$normal."Class : Activate the verbose ".
112     "function on the specified class";
113     print "\n\n";
114     print $bold."-arch ".$normal."architecture : Set the architecture id ".
115     "to that specified";
116     print "\n\n";
117     }
118 hpw 1.1
119 sashby 1.2 # Exit with exit status of subroutine
120     # that was executed in line 80:
121 hpw 1.1 exit $rv;
122 sashby 1.2
123    
124    
125    
126 sashby 1.21
127    
128    
129    
130    
131 sashby 1.2 ######################################################################################
132     ## Subroutine definitions ##
133     ######################################################################################
134    
135     sub error
136     {
137     ###############################################################
138     # error(string) #
139     ###############################################################
140     # modified : Mon May 28 11:26:47 2001 / SFA #
141     # params : Error messsage string #
142     # : #
143     # : #
144     # : #
145     # function : Exit with an error string. #
146     # : #
147     # : #
148     ###############################################################
149     my $string=shift;
150 sashby 1.28 &local_verbose("error",@ARGV);
151    
152 sashby 1.5 print "\n","scram : ".$string."\n";
153     exit (1);
154 sashby 1.2 }
155    
156     sub prerequisitecheck
157     {
158     ###############################################################
159     # prerequisitecheck() #
160     ###############################################################
161     # modified : Mon May 28 11:26:52 2001 / SFA #
162     # params : None. #
163     # : #
164     # : #
165     # : #
166     # function : Check for prerequisite programs. #
167 sashby 1.9 # : Don't bother checking for shell: too much hassle.#
168     # : (and doesn't work outside of HEPiX scheme) #
169 sashby 1.2 ###############################################################
170     my $reqdmake="gmake";
171 sashby 1.28 &local_verbose("prerequisitecheck",@ARGV);
172 sashby 1.9 # We must have gmake. Use "which" to get the gmake command
173     # ("whereis" doesn't work on SunOS):
174 sashby 1.2 chomp(($makeprog)=(`which gmake` =~ /.*\/(\w+)/));
175     # Now test that requirements are satisfied:
176 sashby 1.9 if ( $makeprog eq "$reqdmake" )
177 sashby 1.2 {
178     return (0);
179     }
180     else
181     {
182     print "It appears that you do not have all prerequisite","\n";
183     print "programs. To run SCRAM, you must have:","\n";
184     print "\n";
185     print " - GNU make (gmake)","\n";
186     print "\n";
187 sashby 1.9 print "Please make sure that this program is present.","\n\n";
188 sashby 1.2 exit (1);
189     }
190     }
191    
192     sub versioncheck
193     {
194     ###############################################################
195     # versioncheck(version) #
196     ###############################################################
197     # modified : Mon May 28 11:27:06 2001 / SFA #
198     # params : version (optional) #
199     # : #
200     # : #
201     # : #
202     # function : Check for scram version info. #
203     # : #
204     # : #
205     ###############################################################
206     my $version;
207 sashby 1.28 &local_verbose("versioncheck",@ARGV);
208 sashby 1.2
209     if ( @_ )
210     {
211     $version=shift;
212     }
213     else
214     {
215     # -- get version from local area
216     if ( ! localtop_find() )
217     {
218 hpw 1.1 LoadEnvFile();
219     my $versionfile=$ENV{LOCALTOP}."/$ENV{projconfigdir}/scram_version";
220 sashby 1.2 if ( -f $versionfile )
221     {
222     open (VERSION, "<".$versionfile);
223 hpw 1.1 $version=<VERSION>;
224     chomp $version;
225 sashby 1.2 }
226 hpw 1.1 }
227 sashby 1.2 }
228     if ( defined $version )
229     {
230     scrambasics()->spawnversion($version,@ARGV);
231     }
232     }
233    
234    
235     sub _processcmds
236     {
237     ###############################################################
238     # _processcmds(handlercoderef,refarrayofallowedcommands, #
239     # refarrayofactualcommands, #
240     # arrayofsubroutinestringstocall) #
241     # #
242     ###############################################################
243     # modified : Mon May 28 11:27:12 2001 / SFA #
244     # params : #
245     # : #
246     # : #
247     # : #
248     # function : #
249     # : #
250     # : #
251     ###############################################################
252 sashby 1.28 &local_verbose("_processcmds",@ARGV);
253    
254 sashby 1.2 my $optionhandler=shift;
255     my $allowed_commands=shift;
256     my $cmds=shift;
257     my @subs=@_;
258     my $found=0;
259    
260     # make a string from the subcommand levels
261     my $substring="";
262     if ( @subs )
263     {
264     $substring= join '_', @subs;
265     $substring=$substring."_";
266     }
267    
268     # Process options
269     if (defined ${$cmds}[0])
270     {
271     while ( ${$cmds}[0] =~ /^-/)
272     {
273     &{$optionhandler}( ${$cmds}[0],$cmds);
274     }
275 hpw 1.1
276 sashby 1.2 my $inputcmd=shift @{$cmds};
277     if ( $inputcmd ne "" )
278     {
279     foreach $command ( @{$allowed_commands} )
280     {
281     if ( $command =~ /^$inputcmd/i)
282     {
283     # Deal with a help request
284     if ( ( defined $$cmds[0]) && $$cmds[0] =~ /help/i )
285     {
286     &helpheader($command,@subs);
287     &{"help_".$substring.$command}; exit;
288     }
289     else
290     {
291     &{$substring.$command}(@{$cmds});
292     $found=1;
293     last;
294     }
295     }
296     }
297     }
298     }
299    
300     if ( ! $found )
301     {
302     &{$substring."error"}(@subs);
303 hpw 1.1 }
304 sashby 1.2 return $found;
305     }
306    
307    
308     sub help_build
309     {
310     ###############################################################
311     # help_build() #
312     ###############################################################
313     # modified : Mon May 28 11:27:23 2001 / SFA #
314     # params : #
315     # : #
316     # : #
317     # : #
318     # function : Show help for the scram build command #
319     # : #
320     # : #
321     ###############################################################
322 sashby 1.28 &local_verbose("help_build",@ARGV);
323    
324 sashby 1.2 print <<ENDTEXT;
325     Information for building binaries and libraries.
326    
327     Subcommands:
328    
329     scram (b)uild lib/bin
330    
331     Command is run from the src directory.
332    
333     ENDTEXT
334 sashby 1.6 # Also run "build" dir because this will run "gmake help":
335     &build();
336 sashby 1.2 }
337    
338    
339     sub align
340     {
341     ###############################################################
342     # align() #
343     ###############################################################
344     # modified : Mon May 28 11:27:27 2001 / SFA #
345     # params : #
346     # : #
347     # : #
348     # : #
349     # function : #
350     # : #
351     # : #
352     ###############################################################
353 sashby 1.28 &local_verbose("align",@ARGV);
354 sashby 1.2 _localarea()->align();
355     }
356    
357     sub build
358     {
359     ###############################################################
360     # build() #
361     ###############################################################
362     # modified : Mon May 28 11:27:34 2001 / SFA #
363     # params : #
364     # : #
365     # : #
366     # : #
367     # function : Compile project. #
368     # : #
369     # : #
370     ###############################################################
371 sashby 1.28 &local_verbose("build",@ARGV);
372 sashby 1.2
373     # is this a based or free release?
374     FullEnvInit();
375     use BuildSystem::BuildSetup;
376     $ENV{MAKETARGETS}=join ' ',@ARGV;
377    
378     # -- set the runtime environment
379     my $toolrt=scrambasics()->toolruntime(_localarea());
380     $toolrt->sethash(\%Env);
381    
382     # -- set up the builder
383     my $bs=BuildSystem::BuildSetup->new(toolbox());
384     $rv=$bs->BuildSetup($ENV{THISDIR},@ARGV);
385     $rv;
386     }
387    
388     sub project
389     {
390     ###############################################################
391     # project() #
392     ###############################################################
393     # modified : Mon May 28 11:27:38 2001 / SFA #
394     # params : #
395     # : #
396     # : #
397     # : #
398     # function : Set up a project area. #
399     # : #
400     # : #
401     ###############################################################
402 sashby 1.28 &local_verbose("project",@ARGV);
403    
404 sashby 1.2 my @args=@ARGV;
405    
406     my $devareaname="";
407     use Cwd;
408     my $installarea=cwd();
409 sashby 1.19
410 sashby 1.2 # process options
411     while ( $args[0] =~ "^-" )
412     {
413     if ( $args[0] =~ /-n/ )
414     {
415     shift @args;
416     $devareaname=shift @args;
417     }
418     elsif ( $args[0] =~ /-d/ ) #installation area directory
419     {
420     shift @args;
421     $installarea=$args[0];
422     if ( ! -d $installarea )
423     {
424     error("$installarea does not exist");
425     }
426     shift @args;
427     }
428     else
429     {
430     error("Unknown option $args[0] to project command");
431     }
432     }
433    
434     # -- check what arguments have been passed
435     if ( $#args <0 || $#args>1 )
436     {
437 sashby 1.5 error("\"scram project help\" for usage info.");
438 sashby 1.2 }
439     my $area; #somewhere to store the area object when we have it
440    
441     if ( ( $#args == 0 ) && ($args[0] =~ /:/) )
442     {
443     # -- must be a url to bootstrap from
444 sashby 1.7 print "Bootstrapping using ",$args[0],"\n";
445 sashby 1.2 $area=scrambasics()->project($args[0], $installarea,
446     $devareaname);
447 sashby 1.7 print "Setting up tools in project area","\n";
448 sashby 1.19
449 sashby 1.21 # Need to set the sitename for the setup process:
450     if (defined ($area))
451     {
452     # We have an area so we can invoke method:
453     $ENV{'SITENAME'} = $area->sitename();
454 sashby 1.22 $ENV{'PROJECTDIR'} = $area->location();
455 sashby 1.21 }
456    
457 sashby 1.19 # Initialize the lookup table:
458     use Scram::AutoToolSetup;
459     $lookupobject = Scram::AutoToolSetup->new();
460    
461     # Now run the full setup for the area:
462 sashby 1.2 scrambasics()->setuptoolsinarea($area);
463     }
464     elsif ( $#args >0 )
465     {
466     # -- get the release area
467     print "Getting release area....","\n";
468     my $relarea=scrambasics()->scramprojectdb()->getarea(@args);
469     if ( ! defined $relarea )
470     {
471     error("Unknown project @args");
472     }
473    
474     # -- we need to spawn the correct scram version to handle it:
475     unshift @ARGV, "project";
476     print "Checking SCRAM version....","\n";
477     versioncheck($relarea->scramversion());
478 hpw 1.1
479 sashby 1.2 # -- need to create a satellite area:
480     print "Creating satellite area....","\n";
481     $area=scrambasics()->satellite(@args,$installarea, $devareaname);
482     }
483     else
484     {
485 sashby 1.5 error("\"scram project help\" for usage info.");
486 sashby 1.2 }
487     #
488     # Now create the directories specified in the interface
489     # There should be some better mechanism - TODO
490     #
491     print "Creating directories....","\n";
492     chdir $area->location();
493     foreach $key ( keys %ENV )
494     {
495     if ( $key =~ /^INT/ )
496     {
497     AddDir::adddir($ENV{$key});
498     }
499     }
500 sashby 1.5 # Final message
501 sashby 1.2 print "\n\nInstallation procedure complete.\n";
502     print "Installation Located at:\n\n\t\t".$bold.$area->location().$normal."\n\n";
503     }
504    
505    
506     sub scrambasics
507     {
508     ###############################################################
509     # scrambasics() #
510     ###############################################################
511     # modified : Mon May 28 11:27:44 2001 / SFA #
512     # params : #
513     # : #
514     # : #
515     # : #
516     # function : #
517     # : #
518     # : #
519     ###############################################################
520 sashby 1.28 &local_verbose("scrambasics",@ARGV);
521    
522 sashby 1.2 require Scram::ScramFunctions;
523     if ( ! defined $scramobj )
524     {
525     environmentinit();
526     $scramobj=Scram::ScramFunctions->new();
527     $scramobj->arch($ENV{SCRAM_ARCH});
528     }
529     return $scramobj;
530     }
531    
532     sub url
533     {
534     ###############################################################
535     # url() #
536     ###############################################################
537     # modified : Mon May 28 11:27:48 2001 / SFA #
538     # params : #
539     # : #
540     # : #
541     # : #
542     # function : #
543     # : #
544     # : #
545     ###############################################################
546 sashby 1.28 &local_verbose("url",@ARGV);
547    
548 sashby 1.2 @_=@ARGV;
549     localtop();
550     environmentinit();
551     my @allowed_cmds=qw(get);
552     _processcmds("_tooloptions", \@allowed_cmds, \@_, ("url"));
553     }
554    
555     sub url_get
556     {
557     ###############################################################
558     # url_get() #
559     ###############################################################
560     # modified : Mon May 28 11:27:52 2001 / SFA #
561     # params : #
562     # : #
563     # : #
564     # : #
565     # function : #
566     # : #
567     # : #
568     ###############################################################
569 sashby 1.28 &local_verbose("url_get",@ARGV);
570    
571 sashby 1.2 my $url=shift;
572     my $area=_localarea();
573    
574     ($uurl,$file)=scrambasics()->webget($area,$url);
575 hpw 1.1 print "$file\n";
576 sashby 1.2 }
577 hpw 1.1
578 sashby 1.2 sub help_url
579     {
580     ###############################################################
581     # help_url() #
582     ###############################################################
583     # modified : Mon May 28 11:28:06 2001 / SFA #
584     # params : #
585     # : #
586     # : #
587     # : #
588     # function : Show help for the scram url command. #
589     # : #
590     # : #
591     ###############################################################
592 sashby 1.28 &local_verbose("help_url",@ARGV);
593    
594 sashby 1.2 print <<ENDTEXT;
595 hpw 1.1 URL information.
596 sashby 1.2
597     Subcommands:
598    
599 hpw 1.1 scram url get
600    
601     ENDTEXT
602 sashby 1.2 }
603 hpw 1.1
604 sashby 1.2 sub help_url_get
605     {
606     ###############################################################
607     # help_url_get() #
608     ###############################################################
609     # modified : Mon May 28 11:28:11 2001 / SFA #
610     # params : #
611     # : #
612     # : #
613     # : #
614     # function : Show help for the scram url get command. #
615     # : #
616     # : #
617     ###############################################################
618 sashby 1.28 &local_verbose("help_url_get",@ARGV);
619    
620 sashby 1.2 print <<ENDTEXT;
621 hpw 1.1 Description:
622     Return the location of the local copy of the specified url
623     Usage :
624     scram url get url
625    
626     ENDTEXT
627 sashby 1.2 }
628 hpw 1.1
629     # ------------ tool command --------------------------------------------
630 sashby 1.2 sub tool
631     {
632     ###############################################################
633     # tool() #
634     ###############################################################
635     # modified : Mon May 28 11:28:16 2001 / SFA #
636     # params : #
637     # : #
638     # : #
639     # : #
640     # function : #
641     # : #
642     # : #
643     ###############################################################
644 sashby 1.28 &local_verbose("tool",@ARGV);
645    
646 sashby 1.2 @_=@ARGV;
647     localtop();
648     environmentinit();
649     my @allowed_cmds=qw(info list default setup);
650     _processcmds("_tooloptions", \@allowed_cmds, \@_, ("tool"));
651     }
652    
653     sub tool_error
654     {
655     ###############################################################
656     # tool_error(error_string) #
657     ###############################################################
658     # modified : Mon May 28 11:28:20 2001 / SFA #
659     # params : Error message string. #
660     # : #
661     # : #
662     # : #
663     # function : Show an error message for tool command. #
664     # : #
665     # : #
666     ###############################################################
667 sashby 1.28 &local_verbose("tool_error",@ARGV);
668    
669 sashby 1.2 error("Unknown tool subcommand : @_");
670     }
671    
672     sub tool_default
673     {
674     ###############################################################
675     # tool_default() #
676     ###############################################################
677     # modified : Mon May 28 11:28:24 2001 / SFA #
678     # params : #
679     # : #
680     # : #
681     # : #
682     # function : #
683     # : #
684     # : #
685     ###############################################################
686 sashby 1.28 &local_verbose("tool_default",@ARGV);
687    
688 sashby 1.2 if ( $#_ != 1 )
689     {
690     error("\"scram tool default help\" for usage information");
691     }
692     my $tool=shift;
693     my $version=shift;
694     print "Setting default version of $tool to $version\n";
695     # -- adjust the toolbox
696     toolbox()->setdefault($tool,$version);
697     }
698    
699     sub tool_list
700     {
701     ###############################################################
702     # tool_list() #
703     ###############################################################
704     # modified : Mon May 28 11:28:27 2001 / SFA #
705     # params : #
706     # : #
707     # : #
708     # : #
709     # function : List the tools defined in toolbox. #
710     # : #
711     # : #
712     ###############################################################
713 sashby 1.28 &local_verbose("tool_list",@ARGV);
714    
715 sashby 1.2 my $area=_localarea();
716     my $locationstring="Tool list for location ".$area->location();
717     my $length=length($locationstring);
718    
719 sashby 1.14 print "\n",$locationstring,"\n";
720 sashby 1.2 print "+"x $length;
721     print "\n";
722     print "\n";
723    
724     foreach $t ( toolbox()->tools() )
725     {
726     my $vers=join / /, toolbox()->versions($t);
727 sashby 1.14 print " ".$t." ".$vers." (default=".toolbox()->defaultversion($t).")\n";
728 sashby 1.2 }
729 sashby 1.14 print "\n";
730 sashby 1.2 }
731    
732     sub tool_info
733     {
734     ###############################################################
735     # tool_info() #
736     ###############################################################
737     # modified : Mon May 28 11:28:30 2001 / SFA #
738     # params : #
739     # : #
740     # : #
741     # : #
742     # function : Show info for available tools. #
743     # : #
744     # : #
745     ###############################################################
746 sashby 1.28 &local_verbose("tool_info",@ARGV);
747    
748 sashby 1.2 my $project=shift;
749     my $area=_localarea();
750     my $locationstring="Tool info as configured in location ".$area->location();
751     my $length=length($locationstring);
752    
753     print $locationstring,"\n";
754     print "+"x $length;
755     print "\n";
756     print "\n";
757    
758     my @tools=toolbox()->gettool($project,@_);
759     foreach $t ( @tools )
760     {
761     if ( defined $t )
762     {
763     print "Name : ".$t->name();
764     print "\n";
765     print "Version : ".$t->version();
766     print "\n";
767     print "Docfile : ".$t->url();
768     print "\n";
769     print "+"x20;
770     print "\n";
771     @features=$t->features();
772     foreach $ft ( @features )
773     {
774     @vals=$t->getfeature($ft);
775     foreach $v ( @vals )
776     {
777 hpw 1.1 print $ft. "=$v\n";
778 sashby 1.2 }
779     }
780     }
781 sashby 1.8 else
782     {
783     print "Tool $t is not defined for this project area.","\n";
784     }
785 sashby 1.2 }
786     }
787 hpw 1.1
788 sashby 1.2 sub tool_setup
789     {
790     ###############################################################
791     # tool_setup() #
792     ###############################################################
793     # modified : Mon May 28 11:28:35 2001 / SFA #
794     # params : #
795     # : #
796     # : #
797     # : #
798     # function : #
799     # : #
800     # : #
801     ###############################################################
802 sashby 1.28 &local_verbose("tool_setup",@ARGV);
803    
804 sashby 1.2 print "Please use scram setup command\n";
805     }
806    
807     sub _tooloptions
808     {
809     ###############################################################
810     # _tooloptions(error_string) #
811     ###############################################################
812     # modified : Mon May 28 11:28:38 2001 / SFA #
813     # params : Error message string. #
814     # : #
815     # : #
816     # : #
817     # function : #
818     # : #
819     # : #
820     ###############################################################
821 sashby 1.28 &local_verbose("_tooloptions",@ARGV);
822    
823 sashby 1.2 error("No Options defined for tool subcommand");
824     }
825    
826     sub help_tool
827     {
828     ###############################################################
829     # help_tool() #
830     ###############################################################
831     # modified : Mon May 28 11:28:41 2001 / SFA #
832     # params : #
833     # : #
834     # : #
835     # : #
836     # function : Show help for tool command. #
837     # : #
838     # : #
839     ###############################################################
840 sashby 1.28 &local_verbose("help_tool",@ARGV);
841    
842 sashby 1.2 print <<ENDTEXT;
843 hpw 1.1 Manage the tools in the scram area that define the areas environment.
844 sashby 1.2 tool subcommands:
845    
846 hpw 1.1 list
847     info tool_name
848     default tool_name tool_version
849    
850     ENDTEXT
851 sashby 1.2 }
852 hpw 1.1
853 sashby 1.2 sub help_tool_info
854     {
855     ###############################################################
856     # help_tool_info() #
857     ###############################################################
858     # modified : Mon May 28 11:28:45 2001 / SFA #
859     # params : #
860     # : #
861     # : #
862     # : #
863     # function : Show help for tool info command. #
864     # : #
865     # : #
866     ###############################################################
867 sashby 1.28 &local_verbose("help_tool_info",@ARGV);
868    
869 sashby 1.2 print <<ENDTEXT;
870 hpw 1.1 Description:
871     Print out information on the specified tool in the current area
872     configuration.
873     Usage :
874     scram tool info tool_name [tool_version]
875    
876     ENDTEXT
877 sashby 1.2 }
878 hpw 1.1
879 sashby 1.2 sub help_tool_list
880     {
881     ###############################################################
882     # help_tool_list() #
883     ###############################################################
884     # modified : Mon May 28 11:28:50 2001 / SFA #
885     # params : #
886     # : #
887     # : #
888     # : #
889     # function : Show help for tool info command. #
890     # : #
891     # : #
892     ###############################################################
893 sashby 1.28 &local_verbose("help_tool_list",@ARGV);
894    
895 sashby 1.2 print <<ENDTEXT;
896 hpw 1.1 Description:
897     List of currently configured tools available in ther current scram
898     area
899     Usage :
900     scram tool list
901    
902     ENDTEXT
903 sashby 1.2 }
904 hpw 1.1
905 sashby 1.2 sub help_tool_default
906     {
907     ###############################################################
908     # help_tool_default() #
909     ###############################################################
910     # modified : Mon May 28 11:28:54 2001 / SFA #
911     # params : #
912     # : #
913     # : #
914     # : #
915     # function : #
916     # : #
917     # : #
918     ###############################################################
919 sashby 1.28 &local_verbose("help_tool_default",@ARGV);
920    
921 sashby 1.2 print <<ENDTEXT;
922 hpw 1.1 Description:
923     Change the default version of a tool to be used in the area
924     Usage :
925     scram tool default tool_name tool_version
926    
927     ENDTEXT
928 sashby 1.2 }
929 hpw 1.1
930     # ----------------------------------------------------------------------
931 sashby 1.2 sub _requirements
932     {
933     ###############################################################
934     # _requirements() #
935     ###############################################################
936     # modified : Mon May 28 11:28:59 2001 / SFA #
937     # params : #
938     # : #
939     # : #
940     # : #
941     # function : #
942     # : #
943     # : #
944     ###############################################################
945 sashby 1.28 &local_verbose("_requirements",@ARGV);
946    
947 sashby 1.2 if ( ! defined $reqsobj )
948     {
949     localtop();
950     my $area=_localarea();
951     scrambasics()->arearequirements($area);
952     }
953     return $reqsobj;
954     }
955    
956     sub _allprojectinitsearcher
957     {
958     ###############################################################
959     # _allprojectinitsearcher() #
960     ###############################################################
961     # modified : Mon May 28 11:29:03 2001 / SFA #
962     # params : #
963     # : #
964     # : #
965     # : #
966     # function : #
967     # : #
968     # : #
969     ###############################################################
970 sashby 1.28 &local_verbose("_allprojectinitsearcher",@ARGV);
971    
972 sashby 1.2 my $search=_projsearcher();
973     foreach $proj ( _scramprojdb()->list() )
974     {
975     $search->addproject($$proj[0],$$proj[1]);
976     }
977     }
978    
979     sub _projsearcher
980     {
981     ###############################################################
982     # _projsearcher() #
983     ###############################################################
984     # modified : Mon May 28 11:29:05 2001 / SFA #
985     # params : #
986     # : #
987     # : #
988     # : #
989     # function : #
990     # : #
991     # : #
992     ###############################################################
993 sashby 1.28 &local_verbose("_projsearcher",@ARGV);
994    
995 sashby 1.2 if ( ! defined $self->{projsearcher} )
996     {
997     require Scram::ProjectSearcher;
998     $self->{projsearcher}=Scram::ProjectSearcher->new(_scramprojdb());
999     }
1000     return $self->{projsearcher};
1001     }
1002    
1003     sub _scramprojdb
1004     {
1005     ###############################################################
1006     # _scramprodb() #
1007     ###############################################################
1008     # modified : Mon May 28 11:29:10 2001 / SFA #
1009     # params : #
1010     # : #
1011     # : #
1012     # : #
1013     # function : #
1014     # : #
1015     # : #
1016     ###############################################################
1017 sashby 1.28 &local_verbose("_scramprojdb",@ARGV);
1018    
1019 sashby 1.2 return scrambasics()->scramprojectdb();
1020     }
1021    
1022     sub runtime
1023     {
1024     ###############################################################
1025     # runtime() #
1026     ###############################################################
1027     # modified : Mon May 28 11:29:13 2001 / SFA #
1028     # params : shell type (-sh for Bourne, -csh for C/tcsh) #
1029     # : #
1030     # : #
1031     # : #
1032     # function : Get/set runtime environment. #
1033     # : #
1034     # : #
1035     ###############################################################
1036 sashby 1.28 &local_verbose("runtime",@ARGV);
1037    
1038 sashby 1.2 my $shell;
1039     require Runtime;
1040    
1041     # process options
1042     while ( $ARGV[0] =~ "^-" )
1043     {
1044     if ( $ARGV[0] =~ /-sh/ )
1045     {
1046     shift @ARGV;
1047     $shell="sh";
1048     next;
1049     }
1050     if ( $ARGV[0] =~ /-csh/ ) #installation area directory
1051     {
1052     shift @ARGV;
1053     $shell="csh";
1054     next;
1055     }
1056     print "Unknown Option $ARGV[0]\n";
1057     exit 1;
1058     }
1059 sashby 1.12
1060 sashby 1.2 FullEnvInit();
1061 sashby 1.12
1062 sashby 1.2 if ( @ARGV )
1063     {
1064     my $runtime=Runtime->new();
1065     my $arg=shift @ARGV;
1066    
1067     my $info=0;
1068     if ( $arg eq "info" )
1069     {
1070     $arg=shift @ARGV;
1071     $info=1;
1072     }
1073    
1074     # --- determine filename
1075     my $filename;
1076     if ( -f $arg ) # Is it a file?
1077     {
1078     $filename=$arg;
1079     }
1080     else
1081     {
1082     # -- lets see if its a BuildFile location
1083     $filename=_testfile($ENV{LOCALTOP}."/src/".$arg,
1084     $ENV{RELEASETOP}."/src/".$arg,
1085     $ENV{LOCALTOP}."/src/".$arg."/BuildFile",
1086     $ENV{RELEASETOP}."/src/".$arg."/BuildFile");
1087     if ( $filename eq "" )
1088     {
1089     print "Unable to find a file (or BuildFile) relating to ".
1090     $arg."\n";
1091     exit 1;
1092     }
1093     }
1094     $runtime->file($filename);
1095     if ( ! $info )
1096     {
1097     $runtime->printenv($shell);
1098     }
1099     else
1100     {
1101     if ( @ARGV ) #do we have a specific variable request?
1102     {
1103     _printvardoc($runtime,shift @ARGV);
1104     }
1105     else
1106     {
1107     foreach $var ( $runtime->list() )
1108     {
1109     _printvardoc($runtime,$var);
1110     }
1111     }
1112     }
1113     undef $runtime;
1114     }
1115     else
1116     {
1117     FullEnvInit();
1118     # -- We have to clean up from the last runtime cmd - use env history
1119     foreach $variable ( %ENV )
1120     {
1121     if ( $variable =~ /^SCRAMRT_(.*)/ ) #SCRAMRT are history retaining
1122     {
1123 hpw 1.1 my $var=$1;
1124 sashby 1.2 $ENV{$var} =~ s/\Q$ENV{$variable}\E//g;
1125     $ENV{$var} =~ s/^:*//; # Deal with any Path variables
1126 hpw 1.1 delete $ENV{$variable};
1127 sashby 1.2 }
1128     }
1129 hpw 1.1
1130 sashby 1.2 # -- get the tool runtime environments
1131     my $toolrt=scrambasics()->toolruntime(_localarea());
1132     $toolrt->sethash(\%EnvRuntime);
1133    
1134     # -- create new SCRAMRT history vars.
1135     foreach $variable ( keys %EnvRuntime )
1136     {
1137     printoutenv($shell,"SCRAMRT_$variable",$EnvRuntime{$variable});
1138     }
1139 hpw 1.1
1140 sashby 1.2 # TODO -- this stuff should dissappear with compiler description docs
1141     # Now adapt as necessary - include base environment as well
1142     if ( exists $ENV{LD_LIBRARY_PATH} )
1143     {
1144     addpath("LD_LIBRARY_PATH","$ENV{LD_LIBRARY_PATH}");
1145     }
1146     if ( exists $ENV{MANPATH} )
1147     {
1148     addpath("MANPATH","$ENV{MANPATH}");
1149     }
1150     addpath("PATH","$ENV{PATH}");
1151    
1152     # -- Print out as reqd
1153     # TODO -- we can use the runtime class method once we have removed
1154     # this stuff above
1155     foreach $variable ( keys %EnvRuntime )
1156     {
1157     printoutenv($shell,$variable,$EnvRuntime{$variable});
1158     }
1159 sashby 1.12
1160     # Export the local and release top:
1161     printoutenv($shell,"LOCALTOP",$ENV{LOCALTOP});
1162     printoutenv($shell,"RELEASETOP",$ENV{RELEASETOP});
1163    
1164 sashby 1.2 }
1165     }
1166 hpw 1.1
1167     # Support rt for runtime
1168    
1169 sashby 1.2 sub _testfile
1170     {
1171     ###############################################################
1172     # _testfile() #
1173     ###############################################################
1174     # modified : Mon May 28 11:29:21 2001 / SFA #
1175     # params : #
1176     # : #
1177     # : #
1178     # : #
1179     # function : #
1180     # : #
1181     # : #
1182     ###############################################################
1183 sashby 1.28 &local_verbose("_testfile",@ARGV);
1184    
1185 sashby 1.2 my @files=@_;
1186     my $filename="";
1187    
1188     foreach $file ( @files )
1189     {
1190     if ( -f $file )
1191     {
1192     $filename=$file;
1193     last;
1194     }
1195     }
1196     return $filename;
1197     }
1198    
1199     sub _printvardoc
1200     {
1201     ###############################################################
1202     # _printvardoc() #
1203     ###############################################################
1204     # modified : Mon May 28 11:29:25 2001 / SFA #
1205     # params : #
1206     # : #
1207     # : #
1208     # : #
1209     # function : #
1210     # : #
1211     # : #
1212     ###############################################################
1213 sashby 1.28 &local_verbose("_printvardoc",@ARGV);
1214    
1215 sashby 1.2 my $runtime=shift;
1216     my $var=shift;
1217    
1218     print $var." :\n";
1219     print $runtime->doc($var);
1220     print "\n";
1221     }
1222    
1223     sub printoutenv
1224     {
1225     ###############################################################
1226     # printoutenv() #
1227     ###############################################################
1228     # modified : Mon May 28 11:29:28 2001 / SFA #
1229     # params : #
1230     # : #
1231     # : #
1232     # : #
1233     # function : #
1234     # : #
1235     # : #
1236     ###############################################################
1237 sashby 1.28 &local_verbose("printoutenv",@ARGV);
1238    
1239 sashby 1.2 my $shell=shift;
1240     my $variable=shift;
1241     my $value=shift;
1242    
1243     if ( $shell eq "csh" )
1244     {
1245     print "setenv $variable \"$value\";\n";
1246     }
1247     elsif ( $shell eq "sh" )
1248     {
1249     print "$variable=\"$value\";\n";
1250     print "export $variable;\n";
1251     }
1252     }
1253    
1254     sub addpath
1255     {
1256     ###############################################################
1257     # addpath() #
1258     ###############################################################
1259     # modified : Mon May 28 11:29:32 2001 / SFA #
1260     # params : #
1261     # : #
1262     # : #
1263     # : #
1264     # function : #
1265     # : #
1266     # : #
1267     ###############################################################
1268 sashby 1.28 &local_verbose("addpath",@ARGV);
1269    
1270 sashby 1.2 my $name=shift;
1271     my $val=shift;
1272    
1273     my $n;
1274     my @env;
1275     @env=split /:/, $EnvRuntime{$name};
1276     foreach $n ( (split /:/, $val ) )
1277     {
1278     if ( ! grep /^\Q$n\E$/, @env )
1279     {
1280     addvar($name,$n,":");
1281     }
1282     }
1283     }
1284 hpw 1.1
1285 sashby 1.2 sub addvar
1286     {
1287     ###############################################################
1288     # addvar() #
1289     ###############################################################
1290     # modified : Mon May 28 11:29:35 2001 / SFA #
1291     # params : #
1292     # : #
1293     # : #
1294     # : #
1295     # function : #
1296     # : #
1297     # : #
1298     ###############################################################
1299 sashby 1.28 &local_verbose("addvar",@ARGV);
1300    
1301 sashby 1.2 my $name=shift;
1302     my $val=shift;
1303     my $sep=shift;
1304    
1305     if ( $val ne "" )
1306     {
1307     if ( defined $EnvRuntime{$name} )
1308     {
1309 hpw 1.1 $EnvRuntime{$name}=$EnvRuntime{$name}.$sep.$val;
1310 sashby 1.2 }
1311     else
1312     {
1313 hpw 1.1 $EnvRuntime{$name}=$val;
1314 sashby 1.2 }
1315     }
1316     }
1317    
1318     sub FullEnvInit
1319     {
1320     ###############################################################
1321     # FullEnvInit() #
1322     ###############################################################
1323     # modified : Mon May 28 11:29:38 2001 / SFA #
1324     # params : #
1325     # : #
1326     # : #
1327     # : #
1328     # function : #
1329     # : #
1330     # : #
1331     ###############################################################
1332 sashby 1.28 &local_verbose("FullEnvInit",@ARGV);
1333    
1334 sashby 1.2 environmentinit();
1335     localtop();
1336     LoadEnvFile();
1337     }
1338    
1339     sub environmentinit
1340     {
1341     ###############################################################
1342     # environmentinit() #
1343     ###############################################################
1344     # modified : Mon May 28 11:29:41 2001 / SFA #
1345     # params : #
1346     # : #
1347     # : #
1348     # : #
1349     # function : Set the environment variables needed #
1350     # : by scram (arch, home etc.) #
1351     # : #
1352     ###############################################################
1353 sashby 1.28 &local_verbose("environmentinit",@ARGV);
1354    
1355 sashby 1.2 use Utilities::setarchitecture;
1356 sashby 1.23
1357 sashby 1.2 my $name;
1358     my $value;
1359    
1360     $ENV{LatestBuildFile}=""; # stop recursive behaviour in make
1361 sashby 1.23
1362 sashby 1.2 if ( ! defined $ENV{SCRAM_ARCH} )
1363     {
1364     setarchitecture::setarch();
1365     }
1366     $ENV{INTwork}="tmp/$ENV{SCRAM_ARCH}";
1367     $ENV{INTsrc}="src";
1368     $ENV{INTlog}="logs";
1369     $ENV{INTlib}="lib/".$ENV{SCRAM_ARCH};
1370    
1371     ($ENV{SCRAM_BASEDIR}=$ENV{SCRAM_HOME}) =~ s/(.*)\/.*/$1/;
1372     if ( ! ( exists $ENV{SCRAM_CONFIG} ) )
1373     {
1374     $ENV{SCRAM_CONFIG}="$ENV{SCRAM_HOME}/configuration";
1375     }
1376     $ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src";
1377     if ( ! ( exists $ENV{SCRAM_LOOKUPDB} ) )
1378     {
1379     if ( -d "$ENV{SCRAM_BASEDIR}/scramdb/" )
1380     {
1381     $ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_BASEDIR}/scramdb/project.lookup";
1382     }
1383     else
1384     {
1385     $ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_CONFIG}/project.lookup";
1386     }
1387     }
1388     $ENV{SCRAM_AVAILDIRS}="";
1389     $ENV{SCRAM_AVAILFILES}="";
1390     }
1391    
1392     sub _localarea
1393     {
1394     ###############################################################
1395     # _localarea() #
1396     ###############################################################
1397     # modified : Mon May 28 11:29:47 2001 / SFA #
1398     # params : #
1399     # : #
1400     # : #
1401     # : #
1402     # function : #
1403     # : #
1404     # : #
1405     ###############################################################
1406 sashby 1.28 &local_verbose("_localarea",@ARGV);
1407    
1408 sashby 1.2 if ( ! defined $self->{localarea} )
1409     {
1410     require Configuration::ConfigArea;
1411     $self->{localarea}=Configuration::ConfigArea->new();
1412     if ( ! defined $ENV{LOCALTOP} )
1413     {
1414     if ( $self->{localarea}->bootstrapfromlocation() )
1415     {
1416 hpw 1.1 # Were not in a local area
1417     undef $self->{localarea};
1418 sashby 1.2 }
1419     else
1420     {
1421     $self->{localarea}->archname(scrambasics()->arch());
1422     }
1423     }
1424     else
1425     {
1426     $self->{localarea}->bootstrapfromlocation($ENV{LOCALTOP});
1427     }
1428     }
1429     return $self->{localarea};
1430     }
1431    
1432     sub localtop_find
1433     {
1434     ###############################################################
1435     # localtop_find() #
1436     ###############################################################
1437     # modified : Mon May 28 11:29:50 2001 / SFA #
1438     # params : #
1439     # : #
1440     # : #
1441     # : #
1442     # function : #
1443     # : #
1444     # : #
1445     ###############################################################
1446 sashby 1.28 &local_verbose("localtop_find",@ARGV);
1447    
1448 sashby 1.2 my $rv=1;
1449     if ( defined _localarea())
1450     {
1451     $rv=0;
1452     $ENV{LOCALTOP}=_localarea()->location();
1453     }
1454     return $rv;
1455     }
1456    
1457     sub localtop
1458     {
1459     ###############################################################
1460     # localtop() #
1461     ###############################################################
1462     # modified : Mon May 28 11:29:54 2001 / SFA #
1463     # params : #
1464     # : #
1465     # : #
1466     # : #
1467 sashby 1.5 # function : Find the top directory of local release area. #
1468 sashby 1.2 # : #
1469     # : #
1470     ###############################################################
1471 sashby 1.28 &local_verbose("localtop",@ARGV);
1472    
1473 sashby 1.2 localtop_find();
1474    
1475     if ( ! (defined $ENV{LOCALTOP}) )
1476     {
1477     print "Unable to locate the top of local release. Exitting.\n";
1478     exit 1;
1479     }
1480     ($ENV{THISDIR}=cwd) =~ s/^\Q$ENV{LOCALTOP}\L//;
1481     $ENV{THISDIR} =~ s/^\///;
1482     }
1483    
1484     sub LoadEnvFile
1485     {
1486     ###############################################################
1487     # LoadEnvFile() #
1488     ###############################################################
1489     # modified : Mon May 28 11:29:58 2001 / SFA #
1490     # params : #
1491     # : #
1492     # : #
1493     # : #
1494     # function : #
1495     # : #
1496     # : #
1497     ###############################################################
1498 sashby 1.28 &local_verbose("LoadEnvFile",@ARGV);
1499    
1500 sashby 1.2 _localarea()->copyenv(\%ENV);
1501     }
1502    
1503     sub env
1504     {
1505     ###############################################################
1506     # env() #
1507     ###############################################################
1508     # modified : Mon May 28 11:30:00 2001 / SFA #
1509     # params : #
1510     # : #
1511     # : #
1512     # : #
1513     # function : #
1514     # : #
1515     # : #
1516     ###############################################################
1517 sashby 1.28 &local_verbose("env",@ARGV);
1518    
1519 hpw 1.1 print "Sorry - Not yet\n";
1520 sashby 1.2 }
1521 hpw 1.1
1522 sashby 1.2 sub devint
1523     {
1524     ###############################################################
1525     # devint() #
1526     ###############################################################
1527     # modified : Mon May 28 11:30:03 2001 / SFA #
1528     # params : #
1529     # : #
1530     # : #
1531     # : #
1532     # function : #
1533     # : #
1534     # : #
1535     ###############################################################
1536 sashby 1.28 &local_verbose("devint",@ARGV);
1537    
1538 sashby 1.2 my $class=shift @ARGV;
1539     scrambasics()->scramobjectinterface($class);
1540     }
1541    
1542     sub devtest
1543     {
1544     ###############################################################
1545     # devtest() #
1546     ###############################################################
1547     # modified : Mon May 28 11:30:06 2001 / SFA #
1548     # params : #
1549     # : #
1550     # : #
1551     # : #
1552     # function : #
1553     # : #
1554     # : #
1555     ###############################################################
1556 sashby 1.28 &local_verbose("devtest",@ARGV);
1557    
1558 sashby 1.2 require Utilities::TestClass;
1559     my $class=shift @ARGV;
1560    
1561     my $tester;
1562     my $path;
1563    
1564     if ( $class =~ /::/ )
1565     {
1566     ($path=$class) =~ s/(.*)::.*/$1/;
1567     }
1568     $tester=Utilities::TestClass->new($class,
1569     "$ENV{SCRAM_HOME}/src/$path/test/testdata");
1570     $tester->dotest(@_);
1571     }
1572 hpw 1.1
1573     #
1574     # Create a lookup tag in the site database
1575     #
1576 sashby 1.2 sub install
1577     {
1578     ###############################################################
1579     # install() #
1580     ###############################################################
1581     # modified : Mon May 28 11:30:09 2001 / SFA #
1582     # params : #
1583     # : #
1584     # : #
1585     # : #
1586     # function : Install a project. Updates project.lookup #
1587     # : files found in /scramdb. #
1588     # : #
1589     ###############################################################
1590 sashby 1.28 &local_verbose("install",@ARGV);
1591    
1592 sashby 1.2 localtop();
1593    
1594     scrambasics()->addareatoDB(_localarea(),@ARGV);
1595     _localarea()->align();
1596     }
1597    
1598     sub help_install()
1599     {
1600     ###############################################################
1601     # help_install() #
1602     ###############################################################
1603     # modified : Mon May 28 11:30:12 2001 / SFA #
1604     # params : #
1605     # : #
1606     # : #
1607     # : #
1608 sashby 1.28 # function : Show help for the install command. #
1609 sashby 1.2 # : #
1610     # : #
1611     ###############################################################
1612 sashby 1.28 &local_verbose("help_install",@ARGV);
1613    
1614 sashby 1.2 print <<ENDTEXT;
1615 hpw 1.1 Associates a label with the current release in the SCRAM database.
1616     This allows other users to refer to a centrally installed project by
1617     this label rather than a remote url reference.
1618    
1619     Usage:
1620    
1621     $bold scram install $normal [project_tag [version_tag]]
1622    
1623     porject_tag : override default label (the project name of the current release)
1624     version_tag : the version tag of the current release. If version is not
1625     specified the base release version will be taken by default.
1626    
1627     ENDTEXT
1628 sashby 1.2 }
1629 hpw 1.1
1630 sashby 1.2 sub helpheader ($label)
1631     {
1632     ###############################################################
1633     # helpheader(label) #
1634     ###############################################################
1635     # modified : Mon May 28 11:30:17 2001 / SFA #
1636     # params : label for the header. #
1637     # : #
1638     # : #
1639     # : #
1640     # function : Prints a header for the help command of #
1641     # : scram command "label". #
1642     # : #
1643     ###############################################################
1644 sashby 1.28 &local_verbose("helpheader",@ARGV);
1645    
1646 sashby 1.2 my $label=shift;
1647    
1648     print <<ENDTEXT;
1649    
1650 hpw 1.1 *************************************************************************
1651 sashby 1.2 SCRAM HELP --------- $label
1652 hpw 1.1 *************************************************************************
1653 sashby 1.2
1654 hpw 1.1 ENDTEXT
1655 sashby 1.2 }
1656 hpw 1.1
1657 sashby 1.2 sub version
1658     {
1659     ###############################################################
1660     # version() #
1661     ###############################################################
1662     # modified : Mon May 28 11:30:24 2001 / SFA #
1663     # params : #
1664     # : #
1665     # : #
1666     # : #
1667     # function : Get the version of scram being used. #
1668     # : #
1669     # : #
1670     ###############################################################
1671 sashby 1.28 &local_verbose("version",@ARGV);
1672    
1673 sashby 1.2 my $version=shift @ARGV;
1674     my $thisversion;
1675     my $scram_top;
1676     my $cvsobject;
1677    
1678     ($thisversion=$ENV{SCRAM_HOME}) =~ s/(.*)\///;
1679     $scram_top=$1;
1680     if ( $version eq "" )
1681     {
1682     print "$thisversion";
1683     # deal with links
1684     $version=readlink $ENV{SCRAM_HOME};
1685     if ( defined $version)
1686     {
1687     print " ---> $version";
1688     }
1689     print "\n";
1690     }
1691     else
1692     {
1693     if ( -d $scram_top."/".$version )
1694     {
1695     print "Version $version exists\n";
1696     }
1697     else
1698     {
1699     print "Version $version not available locally\n";
1700     print "Attempting download from the SCRAM repository\n";
1701     # set up and configure the cvs module for SCRAM
1702     require Utilities::CVSmodule;
1703     $cvsobject=Utilities::CVSmodule->new();
1704     $cvsobject->set_base(
1705     "cmscvs.cern.ch:/cvs_server/repositories/SCRAM");
1706     $cvsobject->set_auth("pserver");
1707     $cvsobject->set_user("anonymous");
1708     $cvsobject->set_passkey("AA_:yZZ3e");
1709     # Now check it out in the right place
1710     chdir $scram_top or die "Unable to change to $scram_top $!\n";
1711     $cvsobject->invokecvs( ( split / /,
1712     "co -d $version -r $version SCRAM" ));
1713 hpw 1.1
1714 sashby 1.2 # Get rid of cvs object now weve finished
1715     $cvsobject=undef;
1716     print "\n";
1717     }
1718     }
1719     0;
1720     }
1721    
1722     sub list
1723     {
1724     ###############################################################
1725     # list() #
1726     ###############################################################
1727     # modified : Mon May 28 11:30:28 2001 / SFA #
1728     # params : #
1729     # : #
1730     # : #
1731     # : #
1732     # function : List available projects. #
1733     # : #
1734     # : #
1735     ###############################################################
1736 sashby 1.28 &local_verbose("list",@ARGV);
1737 sashby 1.2 &environmentinit;
1738    
1739     my $linebold = "$bold"."$line"."$normal";
1740     my $pjname = "Project Name";
1741     my $pjversion = "Project Version";
1742     my $pjlocation = "Project Location";
1743 sashby 1.5 my $headstring = sprintf("| %-12s | %-24s | %-33s |",$pjname,$pjversion,$pjlocation);
1744 sashby 1.2
1745     if ( ! -f $ENV{SCRAM_LOOKUPDB} )
1746     {
1747     print "\n","No installation database available - perhaps no projects".
1748     " have been installed locally?\n";
1749     exit 1;
1750     }
1751 sashby 1.4 print "\n","Listing installed projects....","\n\n";
1752 sashby 1.2 print $linebold,"\n";
1753     print $headstring."\n";
1754     print $linebold,"\n\n";
1755     listDB(@ARGV);
1756     print "\n";
1757     }
1758    
1759    
1760     sub remove
1761     {
1762     ###############################################################
1763     # remove(project) #
1764     ###############################################################
1765     # modified : Mon May 28 11:30:31 2001 / SFA #
1766 sashby 1.5 # params : project name, project version #
1767 sashby 1.2 # : #
1768     # : #
1769     # : #
1770     # function : Remove the named project from the project.lookup #
1771     # : file (scram database). #
1772     # : #
1773 sashby 1.28 ###############################################################
1774     &local_verbose("remove",@ARGV);
1775    
1776 sashby 1.5 my $projectname=shift @ARGV;
1777     my $projectversion=shift @ARGV;
1778    
1779     # Check there were sufficient args:
1780     if ($projectname eq "" || $projectversion eq "")
1781     {
1782     error("\"scram remove help\" for usage info.");
1783     &help_remove;
1784     exit (0);
1785     }
1786     else
1787     {
1788     scrambasics()->removeareafromDB($projectname,$projectversion);
1789     }
1790     0;
1791 sashby 1.2 }
1792    
1793     sub db
1794     {
1795     ###############################################################
1796     # db() #
1797     ###############################################################
1798     # modified : Mon May 28 11:30:35 2001 / SFA #
1799 sashby 1.5 # params : "link", "unlink" or "show(links )" #
1800 sashby 1.2 # : #
1801     # : #
1802     # : #
1803     # function : Show project info stored in scramdb. Link/unlink #
1804     # : project database files, or show linked databases.#
1805     # : #
1806     ###############################################################
1807 sashby 1.28 &local_verbose("db",@ARGV);
1808    
1809 sashby 1.2 my $subcmd=shift @ARGV;
1810    
1811     # Make sure we have an argument, or tell the user:
1812     if ( ! defined($subcmd))
1813     {
1814     &help_db;
1815     print "\n";
1816     exit (1);
1817     }
1818    
1819     &environmentinit;
1820    
1821     # First, check for a database area:
1822     if ( ! -f $ENV{SCRAM_LOOKUPDB} )
1823     {
1824     print "\n","No installation database available - perhaps no projects".
1825     "have been installed locally?\n";
1826     exit (1);
1827     }
1828     print "\n","Current scram database: ";
1829     print $bold."$ENV{SCRAM_LOOKUPDB}".$normal."\n\n";
1830    
1831     switch :
1832     {
1833     if ( $subcmd eq 'link' )
1834     {
1835     print "\n","Linked @ARGV to current scram database.","\n\n";
1836     scrambasics()->scramprojectdb()->link(@ARGV);
1837     last switch;
1838     }
1839     if ( $subcmd eq 'unlink' )
1840     {
1841     print "\n","Unlinked @ARGV from current scram database.","\n\n";
1842     scrambasics()->scramprojectdb()->unlink(@ARGV);
1843     last switch;
1844     }
1845     if ( $subcmd eq 'showlinks'
1846     || $subcmd eq 'showlink'
1847     || $subcmd eq 'show')
1848     {
1849     my @links=scrambasics()->scramprojectdb()->listlinks();
1850     # Are there any links defined?:
1851     if ( defined($links[0]) )
1852     {
1853     print "\n","The following scram databases are linked to the current scram database: ","\n\n";
1854     foreach $link ( @links )
1855     {
1856     print " ".$link."\n";
1857     }
1858     print "\n";
1859     }
1860     else
1861     {
1862     print "There are no databases linked.","\n\n";
1863     }
1864     last switch;
1865     }
1866     } # end switch
1867     }
1868 hpw 1.1
1869 sashby 1.2 sub listDB
1870     {
1871     ###############################################################
1872     # listDB() #
1873     ###############################################################
1874     # modified : Mon May 28 11:30:39 2001 / SFA #
1875     # params : Project name #
1876     # : #
1877 sashby 1.4 # function : List projects. Only those projects that were #
1878     # : installed on the user's current OS will be #
1879     # : displayed (slight anomaly here: some projects #
1880     # : were installed on SunOS_5.6 so won't appear if #
1881     # : the user's current platform is SunOS_5.7...). #
1882 sashby 1.2 # : #
1883     ###############################################################
1884 sashby 1.28 &local_verbose("listDB",@ARGV);
1885    
1886 sashby 1.2 my $project="";
1887 sashby 1.14 my $projectexists=0;
1888     my @missingareas;
1889    
1890 sashby 1.2 if ( @_ )
1891     {
1892     $project=shift;
1893     }
1894 sashby 1.5
1895 sashby 1.2 my @prs=scrambasics()->scramprojectdb()->listall();
1896 sashby 1.5
1897     # Check to see if there are any projects:
1898     if ( ! defined @prs )
1899     {
1900     print "\t\t>>>> No locally installed projects! <<<<","\n";
1901     return (0);
1902     }
1903 sashby 1.14
1904 sashby 1.5 # Iterate over the project list:
1905 sashby 1.2 foreach $pr ( @prs )
1906     {
1907 sashby 1.14 my $url='NULL';
1908    
1909 sashby 1.2 if ( $project eq "" || $project eq $$pr[0] )
1910     {
1911 sashby 1.14 # Check that the area exists (i.e. check that a configarea object
1912     # is returned before attempting to test its' location:
1913     my $possiblearea=scrambasics()->scramprojectdb()->getarea($$pr[0],$$pr[1]);
1914    
1915     if ( defined ($possiblearea))
1916 sashby 1.4 {
1917 sashby 1.14 $url=$possiblearea->location();
1918     if ($project eq $$pr[0]) {$projectexists=1};
1919     }
1920    
1921     # Check that the path to the project area is readable:
1922     if ( -d $url )
1923     {
1924     # Check that there exists an installation for
1925     # our current architecture. Check for a bin and
1926     # a lib directory:
1927     if ( -d "$url/bin/$ENV{SCRAM_ARCH}" || -d "$url/lib/$ENV{SCRAM_ARCH}" )
1928 sashby 1.12 {
1929     # Stagger the printed lines to allow easier
1930     # copying using the mouse:
1931     printf " %-15s %-25s \n",$$pr[0],$$pr[1];
1932     printf "%45s%-30s\n","--> ",$bold.$url.$normal;
1933     }
1934 sashby 1.14 }
1935     else
1936     {
1937     # We have an area that is unreadable. Push an entry onto the array:
1938     push @missingareas, sprintf ">> Project area MISSING: %-10s %-20s \n",$$pr[0],$$pr[1];
1939 sashby 1.4 }
1940 sashby 1.2 }
1941     }
1942 sashby 1.14
1943     if ( ! $projectexists && $project ne "" )
1944     {
1945     print "\t\t>>>> No locally installed $project projects! <<<<","\n";
1946     return(0);
1947     }
1948    
1949     # Print out a list of areas that are missing:
1950     if ( @missingareas )
1951     {
1952     print "\n\n\n\n\n\n";
1953     print $line,"\n";
1954     print @missingareas;
1955     print $line,"\n";
1956     }
1957    
1958 sashby 1.4 print "\n\n","Projects available for platform >> ".$bold."$ENV{SCRAM_ARCH}".$normal." <<\n";
1959     print "\n";
1960 sashby 1.2 0;
1961     }
1962    
1963     sub arch
1964     {
1965     ###############################################################
1966     # arch() #
1967     ###############################################################
1968     # modified : Mon May 28 11:30:41 2001 / SFA #
1969     # params : #
1970     # : #
1971     # : #
1972     # : #
1973     # function : Show the information about current architecture. #
1974     # : #
1975     # : #
1976     ###############################################################
1977 sashby 1.28 &local_verbose("arch",@ARGV);
1978 sashby 1.2 &environmentinit();
1979 sashby 1.10
1980     print "$ENV{SCRAM_ARCH}\n";
1981 sashby 1.2 }
1982 hpw 1.1
1983    
1984     #
1985     # Setup a new tool
1986     #
1987    
1988 sashby 1.2 sub setup
1989     {
1990     ###############################################################
1991     # setup() #
1992     ###############################################################
1993     # modified : Mon May 28 11:30:45 2001 / SFA #
1994     # params : #
1995     # : #
1996     # : #
1997     # : #
1998     # function : Setup tools. #
1999     # : #
2000     # : #
2001     ###############################################################
2002 sashby 1.28 &local_verbose("setup",@ARGV);
2003 sashby 1.2 my $interactive=0;
2004    
2005     # process options
2006     while ( $ARGV[0] =~ "^-" )
2007     {
2008     if ( $ARGV[0] =~ /-i/ )
2009     {
2010     shift @ARGV;
2011     $interactive=1;
2012 sashby 1.20 print "Running interactive setup....","\n";
2013 hpw 1.1 }
2014 sashby 1.2 else
2015     {
2016 sashby 1.20 error("Unknown option $ARGV[0] to setup command");
2017 hpw 1.1 }
2018 sashby 1.2 }
2019 hpw 1.1
2020 sashby 1.2 localtop();
2021    
2022     my $area=_localarea();
2023 sashby 1.21 # We have a local area so we can invoke
2024     # method to get the sitename:
2025 sashby 1.22 $ENV{'SITENAME'} = $area->sitename();
2026     $ENV{'PROJECTDIR'} = $area->location();
2027    
2028 sashby 1.2 my $toolname=shift @ARGV;
2029     my $insert=0;
2030 sashby 1.19
2031 sashby 1.2 toolbox()->interactive($interactive);
2032    
2033 sashby 1.20 # Initialize the lookup table:
2034     use Scram::AutoToolSetup;
2035     $lookupobject = Scram::AutoToolSetup->new();
2036    
2037 sashby 1.2 # If no toolname specified then its a full setup
2038     if ( $toolname eq "" )
2039     {
2040     # -- add architecture specific directories
2041     use Utilities::AddDir;
2042 sashby 1.22 AddDir::adddir($ENV{'PROJECTDIR'}."/lib/$ENV{SCRAM_ARCH}");
2043     AddDir::adddir($ENV{'PROJECTDIR'}."/bin/$ENV{SCRAM_ARCH}");
2044 sashby 1.2 # -- check the releasetop area
2045     # if the releasetop has the files copy them
2046     my $releaseobj=_releasearea();
2047     if ( $releaseobj->copysetup($ENV{LOCALTOP}) )
2048     {
2049     print "Doing Full Setup\n";
2050 sashby 1.20 # Run the full setup for the area:
2051 sashby 1.2 scrambasics()->setuptoolsinarea($area);
2052     }
2053     }
2054     else
2055     {
2056 sashby 1.20 print "Running setup for tool ",$toolname,"...","\n";
2057 sashby 1.2 scrambasics()->setuptoolsinarea($area, $toolname,@ARGV);
2058     }
2059     }
2060 sashby 1.11
2061    
2062 sashby 1.12 sub setroot
2063     {
2064     ###############################################################
2065     # setroot #
2066     ###############################################################
2067     # modified : Wed Nov 7 16:22:25 2001 / SFA #
2068     # params : #
2069     # : #
2070     # : #
2071     # : #
2072     # function : #
2073     # : #
2074     # : #
2075     # : #
2076     ###############################################################
2077 sashby 1.28 &local_verbose("setroot",@ARGV);
2078 sashby 1.12 my $shell = shift @ARGV;
2079    
2080     # Check the shell argument...this must be supplied:
2081     if ($shell =~ "^-" )
2082     {
2083     # Remove the hyphen:
2084     $shell =~ s/-//;
2085     if ($shell ne "sh" && $shell ne "csh") {print "No shell given! Exitting.","\n"; exit(1);}
2086     }
2087     else
2088     {
2089     print "No shell given! Exitting.","\n";
2090     exit(1);
2091     }
2092    
2093     my $projectname=shift @ARGV;
2094     my $projectversion=shift @ARGV;
2095    
2096     # Check there were sufficient args:
2097     if ($projectname eq "" || $projectversion eq "")
2098     {
2099     error("\"scram setroot help\" for usage info.");
2100     &help_setroot;
2101     exit (0);
2102     }
2103     else
2104     {
2105 sashby 1.13 # Reset the LOCALTOP/RELEASETOP vars:
2106     $ENV{'LOCALTOP'}='';
2107     $ENV{'RELEASETOP'}='';
2108    
2109     # And on we go. Let's find a release area for this project/version:
2110 sashby 1.12 my $releasearea = scrambasics()->scramprojectdb()->getarea($projectname,$projectversion);
2111     print "No release area!!","\n" if ( ! defined ($releasearea));
2112 sashby 1.13
2113 sashby 1.12 # The info we need is stored in a hash and can be accessed using the key ENV.
2114     # Location info is accessed using keys LOCALTOP and RELEASETOP:
2115     foreach $key (keys %{${$releasearea}{'ENV'}})
2116     {
2117     if ( $key eq "LOCALTOP" || $key eq "RELEASETOP" )
2118     {
2119     printoutenv($shell,$key,${${$releasearea}{'ENV'}}{$key});
2120     }
2121     }
2122    
2123     # If LOCALTOP isn't defined, make it the same as RELEASETOP:
2124 sashby 1.13 if ( $ENV{'LOCALTOP'} eq '' )
2125 sashby 1.12 {
2126     printoutenv($shell,"LOCALTOP",${${$releasearea}{'ENV'}}{'RELEASETOP'});
2127     }
2128 sashby 1.13 0;
2129 sashby 1.12 }
2130     }
2131    
2132 sashby 1.2
2133     sub _releasearea
2134     {
2135     ###############################################################
2136     # _releasearea() #
2137     ###############################################################
2138     # modified : Mon May 28 11:30:50 2001 / SFA #
2139     # params : #
2140     # : #
2141     # : #
2142     # : #
2143     # function : #
2144     # : #
2145     # : #
2146     ###############################################################
2147 sashby 1.28 &local_verbose("_releasearea",@ARGV);
2148    
2149 sashby 1.2 if ( !defined $self->{releasearea} )
2150     {
2151     require Configuration::ConfigArea;
2152     $self->{releasearea}=Configuration::ConfigArea->new();
2153     $self->{releasearea}->bootstrapfromlocation($ENV{RELEASETOP});
2154     }
2155     return $self->{releasearea};
2156     }
2157 hpw 1.1
2158     # get a toolbox object for the local area
2159 sashby 1.2 sub toolbox
2160     {
2161     ###############################################################
2162     # toolbox() #
2163     ###############################################################
2164     # modified : Mon May 28 11:30:53 2001 / SFA #
2165     # params : #
2166     # : #
2167     # : #
2168     # : #
2169     # function : #
2170     # : #
2171     # : #
2172     ###############################################################
2173 sashby 1.28 &local_verbose("toolbox",@ARGV);
2174    
2175 sashby 1.2 if ( ! defined $toolbox )
2176     {
2177     localtop();
2178     my $area=_localarea();
2179     $toolbox=scrambasics()->areatoolbox($area);
2180     }
2181     return $toolbox;
2182     }
2183 sashby 1.27
2184    
2185     sub local_verbose
2186     {
2187     ###############################################################
2188     # local_verbose #
2189     ###############################################################
2190     # modified : Mon Jan 21 12:38:02 2002 / SFA #
2191     # params : Only debug env variable (switch) #
2192     # : #
2193     # : #
2194     # : #
2195     # function : Enable verbose mode for package "main" (i.e. #
2196     # : this wrapped script) #
2197     # : #
2198     # : #
2199     ###############################################################
2200     my $subroutine=shift;
2201 sashby 1.29 my @args=@ARGV;
2202    
2203 sashby 1.28 if ($ENV{'SCRAMDEBUG'})
2204     {
2205     print "---- Local verbose mode ---------------------------------","\n";
2206 sashby 1.29 print " subname: >> ",$subroutine," ","\n";
2207     # print " ARGS: >> ",@args,"\n";
2208 sashby 1.28 print "---------------------------------------------------------","\n\n";
2209     }
2210     }
2211 sashby 1.27
2212 sashby 1.2
2213     sub help_db
2214     {
2215     ###############################################################
2216     # help_db() #
2217     ###############################################################
2218     # modified : Mon May 28 11:30:56 2001 / SFA #
2219     # params : #
2220     # : #
2221     # : #
2222     # : #
2223     # function : Show help for scram db command. #
2224     # : #
2225     # : #
2226     ###############################################################
2227 sashby 1.28 &local_verbose("help_db",@ARGV);
2228    
2229 sashby 1.2 print <<ENDTEXT;
2230 hpw 1.1 scram database administration command.
2231    
2232     Usage:
2233    
2234     $bold scram db $normal subcommand
2235    
2236 sashby 1.2 Subcommands:
2237    
2238 hpw 1.1 link :
2239     Make available an additional database for
2240     project and list operations
2241    
2242     $bold scram db link $normal /a/directory/path/project.lookup
2243    
2244     unlink :
2245     Remove a database from the link list. Note this does
2246     not remove the database, just the link to it in scram.
2247    
2248     $bold scram db unlink $normal /a/directory/path/project.lookup
2249    
2250     showlinks :
2251     List the databases that are linked in
2252    
2253     ENDTEXT
2254 sashby 1.2 }
2255 hpw 1.1
2256 sashby 1.2 sub help_setup
2257     {
2258     ###############################################################
2259     # help_setup() #
2260     ###############################################################
2261     # modified : Mon May 28 11:31:02 2001 / SFA #
2262     # params : #
2263     # : #
2264     # : #
2265     # : #
2266     # function : Show help for scram setup command. #
2267     # : #
2268     # : #
2269     ###############################################################
2270 sashby 1.28 &local_verbose("help_setup",@ARGV);
2271    
2272 sashby 1.2 print <<ENDTEXT;
2273 hpw 1.1 Allows installation/re-installation of a new tool/external package into an
2274     already existing development area. If not toolname is specified,
2275     the complete installation process is initiated.
2276    
2277     Usage:
2278    
2279 sashby 1.24 $bold scram setup [-i]$normal [toolname] [[version] [url]]
2280 hpw 1.1
2281     toolname : The name of the tool setup file required.
2282     version : where more than one version exists specify the version
2283     url : when setting up a completely new tool specify the url too
2284    
2285     The -i option turns off the automatic search mechanism allowing for more
2286     user interaction with the setup mechanism
2287     ENDTEXT
2288 sashby 1.2 }
2289 hpw 1.1
2290 sashby 1.2 sub help_list
2291     {
2292     ###############################################################
2293     # help_list() #
2294     ###############################################################
2295     # modified : Mon May 28 11:31:09 2001 / SFA #
2296     # params : #
2297     # : #
2298     # : #
2299     # : #
2300     # function : Show help for scram list command. #
2301     # : #
2302     # : #
2303     ###############################################################
2304 sashby 1.28 &local_verbose("help_list",@ARGV);
2305    
2306 sashby 1.2 print <<ENDTEXT;
2307 hpw 1.1 List the available projects and versions installed in the local SCRAM database
2308     (see scram install help)
2309    
2310     Usage:
2311    
2312 sashby 1.24 $bold scram list $normal [ProjectName]
2313 hpw 1.1
2314     ENDTEXT
2315 sashby 1.2 }
2316    
2317     sub help_remove
2318     {
2319     ###############################################################
2320     # help_remove() #
2321     ###############################################################
2322     # modified : Mon May 28 11:31:12 2001 / SFA #
2323     # params : #
2324     # : #
2325     # : #
2326     # : #
2327     # function : Show help for scram remove command. #
2328     # : #
2329     # : #
2330     ###############################################################
2331 sashby 1.28 &local_verbose("help_remove",@ARGV);
2332    
2333 sashby 1.2 print <<ENDTEXT;
2334 sashby 1.5 Remove a project entry from scram database file (\"project.lookup\").
2335 sashby 1.2
2336     Usage:
2337    
2338 sashby 1.24 $bold scram remove $normal [ProjectName] [Version]
2339 sashby 1.2
2340     ENDTEXT
2341     }
2342 hpw 1.1
2343 sashby 1.2 sub help_project
2344     {
2345     ###############################################################
2346     # help_project() #
2347     ###############################################################
2348     # modified : Mon May 28 11:31:16 2001 / SFA #
2349     # params : #
2350     # : #
2351     # : #
2352     # : #
2353     # function : Show help for scram project command. #
2354     # : #
2355     # : #
2356     ###############################################################
2357 sashby 1.28 &local_verbose("help_project",@ARGV);
2358    
2359 sashby 1.2 print <<ENDTEXT;
2360 hpw 1.1 Setup a new project development area. The new area will appear in the current
2361     working directory.
2362     Usage:
2363    
2364     $bold scram project [-d install_area] [-n directory_name]$normal project_url [project_version]
2365    
2366     Options:
2367    
2368     project_url: The url of a scram bootstrap file.
2369     Currently supported types are:
2370     $bold Database label $normal
2371     Labels can be assigned to bootstrap files for easy
2372     access (See "scram install" command). If you
2373     specify a label you must also specify a project_version.
2374     e.g.
2375    
2376     scram project SCRAM V1_0
2377    
2378     scram project ORCA ORCA_1_1_1
2379    
2380     To see the list of installed projects use the
2381     "scram list" command.
2382    
2383     $bold file: $normal A regular file on an accessable file system
2384     e.g.
2385    
2386     file:~/myprojects/projecta/config/BootStrapFile
2387    
2388     project_version:
2389     Only for use with a database label
2390    
2391     -d install_area:
2392     Indicate a project installation area into which the new
2393     project area should appear. Default is the current working
2394     directory.
2395    
2396     -n directory_name:
2397     Specify the name of the SCRAM development area you wish to
2398     create.
2399    
2400     ENDTEXT
2401 sashby 1.2 }
2402 hpw 1.1
2403 sashby 1.2 sub help_version
2404     {
2405     ###############################################################
2406     # help_version() #
2407     ###############################################################
2408     # modified : Mon May 28 11:31:23 2001 / SFA #
2409     # params : #
2410     # : #
2411     # : #
2412     # : #
2413     # function : Show help for scram version command. #
2414     # : #
2415     # : #
2416     ###############################################################
2417 sashby 1.28 &local_verbose("help_version",@ARGV);
2418    
2419 sashby 1.2 print <<ENDTEXT;
2420     With no $bold [version] $normal argument given, this command will simply
2421 hpw 1.1 print to standard output the current version number.
2422    
2423     Providing a version argument will cause that version to be downloaded and
2424     installed, if not already locally available.
2425    
2426    
2427     Usage:
2428     $bold scram version [version]$normal
2429    
2430     ENDTEXT
2431 sashby 1.2 }
2432 hpw 1.1
2433 sashby 1.2 sub help_arch
2434     {
2435     ###############################################################
2436     # help_arch() #
2437     ###############################################################
2438     # modified : Mon May 28 11:31:33 2001 / SFA #
2439     # params : #
2440     # : #
2441     # : #
2442     # : #
2443     # function : Show help for scram arch command. #
2444     # : #
2445     # : #
2446     ###############################################################
2447 sashby 1.28 &local_verbose("help_arch",@ARGV);
2448    
2449 sashby 1.2 print <<ENDTEXT;
2450 hpw 1.1 Print out the architecture flag for the current machine.
2451    
2452     Usage:
2453     $bold scram arch $normal
2454     ENDTEXT
2455 sashby 1.2 }
2456 hpw 1.1
2457 sashby 1.2 sub help_runtime
2458     {
2459     ###############################################################
2460     # help_runtime() #
2461     ###############################################################
2462     # modified : Mon May 28 11:31:37 2001 / SFA #
2463     # params : #
2464     # : #
2465     # : #
2466     # : #
2467     # function : Show help for scram runtime command. #
2468     # : #
2469     # : #
2470     ###############################################################
2471 sashby 1.28 &local_verbose("help_runtime",@ARGV);
2472    
2473 sashby 1.2 print <<ENDTEXT;
2474 hpw 1.1 Echo to Standard Output the Runtime Environment for the current development area
2475     Output available in csh or sh flavours
2476    
2477     Usage:
2478     1) $bold scram runtime [-csh|-sh] $normal
2479     or
2480     2) $bold scram runtime [-csh|-sh] filename $normal
2481     or
2482     3) $bold scram runtime info filename [variable]$normal
2483    
2484     1) For the general configuration environment
2485     2) For environment described in filename or
2486     areatop/src/directory/BuildFile
2487     3) Display information concerning the environment in the given file
2488     (limited to variable if specified)
2489    
2490     The file for cases 2) and 3) are searched as follows :
2491     a) straightforward filename
2492     b) filename relative to local_area/src
2493     c) filename relative to release_area/src
2494     d) BuildFile relative to local_area/src
2495     e) BuildFile relative to release_area/src
2496    
2497     Examples:
2498    
2499     Setup the current environment to include the project Runtime Environment
2500     in a csh environment
2501    
2502     $bold eval `scram runtime -csh` $normal
2503    
2504     Setup the current environment to include the project Runtime Environment in a
2505     sh environment
2506    
2507     $bold eval `scram runtime -sh` $normal
2508    
2509 sashby 1.12 ENDTEXT
2510     }
2511    
2512    
2513     sub help_setroot
2514     {
2515     ###############################################################
2516     # help_setroot #
2517     ###############################################################
2518     # modified : Wed Nov 7 16:23:32 2001 / SFA #
2519     # params : #
2520     # : #
2521     # : #
2522     # : #
2523     # function : #
2524     # : #
2525     # : #
2526     # : #
2527     ###############################################################
2528 sashby 1.28 &local_verbose("help_setroot",@ARGV);
2529    
2530 sashby 1.12 print <<ENDTEXT;
2531     Set a SCRAM-aware variable which points to a particular project area. This
2532     permits the setting of the runtime environment outside of the project area.
2533    
2534     Usage:
2535 sashby 1.24 $bold scram setroot [-sh|-csh] [ProjectName] [Version] $normal
2536 sashby 1.12
2537 sashby 1.24 To set the environment:
2538 sashby 1.12
2539 sashby 1.24 $bold eval `scram setroot [-sh|-csh] [ProjectName] [Version]` $normal
2540 hpw 1.1
2541     ENDTEXT
2542 sashby 1.2 }