ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/scram
(Generate patch)

Comparing COMP/SCRAM/src/scram (file contents):
Revision 1.11 by williamc, Tue Mar 23 12:34:35 1999 UTC vs.
Revision 1.22 by williamc, Wed Apr 14 09:46:02 1999 UTC

# Line 5 | Line 5
5  
6   $inputcmd=shift;
7   $found='false';
8 < @allowed_commands=qw(project build env install version list arch);
9 <
10 < foreach $command ( @allowed_commands ) {
11 <         do { &$command; $found='true'; last;} if ( $inputcmd=~/^$command\Z/i);
8 > $bold  = "\033[1m";
9 > $normal = "\033[0m";
10 > @allowed_commands=qw(project build install version list arch setup);
11 >
12 > if ( $inputcmd ne "" ) {
13 > foreach $command ( @allowed_commands ) {
14 >         if ( $command=~/^$inputcmd/i) {
15 >                # Deal with a help request
16 >                do{     helpheader($command);
17 >                        &{"help_".$command}; exit; } if $ARGV[0]=~/help/i;
18 >                &$command; $found='true';
19 >                last;
20 >         }
21 > }
22   }
23  
24   if ( ! ( $found=~/true/ ) ) {
25 <        print "scram help\n--------\n";
16 <        print "Recognised Commands: \n";
25 >        helpheader('Recognised Commands');
26          foreach $command ( @allowed_commands ) {
27 <        print "       ".$command."\n";  
27 >        print "      $bold scram ".$command.$normal."\n";      
28          }
29 +        print "\n";
30 +        print "Help on individual commands available through\n\n";
31 +        print "$bold       scram".$normal." command$bold help $normal\n\n";
32   }
33  
34 + sub help_build {
35 +        &build;
36 + }
37   sub build {
38          # is this a based or free release?
39          FullEnvInit();
# Line 42 | Line 57 | sub project {
57          use File::Copy;
58          use Utilities::AddDir;
59          
60 +           &localtop;
61 +           chdir $ENV{LOCALTOP};
62             use BootStrapProject;
63             # get the bootstrap files downloaded
64             BootStrapProject("$project\?\?$version");
65             # Go setup the rest of the environement, now we can
49           chdir $ENV{LOCALTOP};
50           &localtop;
66             LoadEnvFile();
67             #
68             # Now create the directories specified in the interface
# Line 64 | Line 79 | sub project {
79             use clientfile;
80             BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
81             use Cwd;
82 <           print "Installation Located at:\n".cwd()."\n";
83 <           ReturnToContinue();
82 >           print "\nInstallation Procedure Complete. \n".
83 >                        "Installation Located at:\n".cwd()."\n";
84   }
85  
86   sub FullEnvInit {
# Line 116 | Line 131 | sub localtop {
131          } while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./  );
132          if ( ! (defined $ENV{LOCALTOP}) ) {
133           print "Unable to locate the top of local release. Exiting\n";
134 <         ReturnToContinue();
134 >         exit 1;
135          }
136          } #end block
137 <        ($ENV{THISDIR}=cwd)=~s/^$ENV{LOCALTOP}//;
137 >        ($ENV{THISDIR}=cwd)=~s/^\Q$ENV{LOCALTOP}\L//;
138          $ENV{THISDIR}=~s/^\///;
139          $ENV{SCRAM_WORKDIR}="$ENV{LOCALTOP}/.SCRAM";
140   }
# Line 149 | Line 164 | sub install ( $tagname, $version ) {
164          my $version=shift @ARGV;
165  
166          # create database entry
152        do { &help_install; } if $tagname=~/help/i;
167          &FullEnvInit;
168          if ( $version eq "" ) {
169             $version=$ENV{SCRAM_PROJVERSION};
# Line 160 | Line 174 | sub install ( $tagname, $version ) {
174          my $filename="$ENV{SCRAM_CONFIG}/project.lookup";
175          my $outfile="$ENV{SCRAM_CONFIG}/project.lookup.tmp";
176          open ( LOCALLOOKUPDB, "<$filename" );
177 <        open ( OUTFILE , ">$outfile" );
177 >        open ( OUTFILE , ">$outfile" ) or die "Unable to open $outfile $!\n";
178          while ( <LOCALLOOKUPDB> ) {
179              if ( /^$tagname/ ) {
180                  print "Related tag :".$_."\n";
# Line 192 | Line 206 | sub install ( $tagname, $version ) {
206  
207   sub help_install()  {
208  
195 helpheader("install");
209   print <<ENDTEXT;
210   Associates a label with the current release in the SCRAM database.
211   This allows other users to refer to a centrally installed project by
# Line 245 | Line 258 | sub arch {
258          print "$ENV{SCRAM_ARCH}\n";
259   }
260  
261 < sub ReturnToContinue {
262 <           print "Press RETURN to exit\n";
263 <           $junk=<STDIN>;
261 >
262 > #
263 > # Setup a new tool
264 > #
265 >
266 > sub setup {
267 >        my $toolname=shift @ARGV;
268 >
269 >        &FullEnvInit;
270 >        if ( $ENV{SCRAM_BootStrapFiles}!~/$ENV{LOCALTOP}\/\.SCRAM/ ) {
271 >          $ENV{SCRAM_BootStrapFiles}="$ENV{LOCALTOP}/.SCRAM:".
272 >                        $ENV{SCRAM_BootStrapFiles};
273 >        }
274 >        # If no toolname specified then its a full setup
275 >        if ( $toolname eq "" ) {
276 >           my $filebase="$ENV{LOCALTOP}/.SCRAM/$ENV{SCRAM_ARCH}";
277 >           rename "$filebase/clientsettings", "$filebase/clientsettings.old";
278 >           rename "$filebase/clientsettings_reqs",
279 >                                "$filebase/clientsettings_reqs.old";
280 >           use clientfile;
281 >           BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
282 >        }
283 >        else {
284 >          # Check for the correct toolfile
285 >          # ideally try and download it if not already in .SCRAM
286 >          # Only scram toolbox files supported so far
287 >          if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) {
288 >                &urlhandler::urlhandler("file:$ENV{SCRAM_HOME}/toolbox/"
289 >                        .$toolname, "$ENV{LOCALTOP}/.SCRAM/$toolname") ;
290 >          }
291 >          # Parse the toolfile and update the clientsettings file
292 >          # currently just append to the end
293 >          use clientfile;
294 >          clientfile::openclientfile('add');
295 >          clientfile::_tool("file:$toolname");
296 >          closeclientfile;
297 >        }
298 > }
299 >
300 > sub help_setup {
301 >
302 > print <<ENDTEXT;
303 > Allows installation of a new tool/external package into an already
304 > existing area. If not toolname is specified, the complete installation
305 > process is initiated.
306 >
307 > Usage:
308 >
309 >                 $bold scram setup $normal [toolname]
310 >
311 > toolname : The name of the tool setup file required.
312 > ENDTEXT
313 > exit;
314 > }
315 >
316 > sub help_list {
317 > print <<ENDTEXT;
318 > Create an entry in the SCRAM database so that an installed project can be
319 > referenced in the 'project' command by a tag/version combination.
320 > Usage: (command to be issued from inside an installed project)
321 >
322 >        $bold   scram install $normal [project_tag [version_tag]]
323 >
324 > If not specified the project_tag and version_tag default to the project
325 > name and version of the installation.
326 > ENDTEXT
327 > exit;
328 > }
329 > sub help_project {
330 > print <<ENDTEXT;
331 > Setup a new project development area. The new area will appear in the current
332 > working directory.
333 > Usage:
334 >
335 >        $bold scram project [-d install_area] $normal project_url [project_version]
336 >
337 > Options:
338 >
339 > project_url: The url of a scram bootstrap file.
340 >             Currently supported types are:
341 >                $bold Database label $normal
342 >                        Labels can be assigned to bootstrap files for easy
343 >                        access (See "scram install" command). If you
344 >                        specify a label you must also specify a project_version.
345 >                        e.g.
346 >
347 >                           scram project SCRAM V1_0
348 >                                
349 >                           scram project ORCA ORCA_1_1_1
350 >
351 >                        To see the list of installed projects use the
352 >                        "scram list" command.
353 >
354 >                $bold file: $normal A regular file on an accessable file system
355 >                        e.g.
356 >
357 >                           file:~/myprojects/projecta/config/BootStrapFile
358 >
359 > project_version:
360 >                 Only for use with a database label
361 >
362 > -d install_area:
363 >                 Indicate a project installation area into which the new
364 >                 project area should appear. Default is the current working
365 >                 directory.
366 >        
367 > ENDTEXT
368 > }
369 >
370 > sub help_version {
371 > print <<ENDTEXT;
372 > Print the version number of scram
373 > Usage:
374 >                $bold scram version $normal
375 >
376 > ENDTEXT
377 > }
378 >
379 > sub help_arch {
380 > print <<ENDTEXT;
381 > Print out the architecture flag for the current machine.
382 >
383 > Usage:
384 >        $bold   scram arch $normal
385 > ENDTEXT
386   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines