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.7 by williamc, Thu Mar 18 08:01:59 1999 UTC vs.
Revision 1.23 by williamc, Fri Apr 16 14:47:06 1999 UTC

# Line 1 | Line 1
1 < #!/usr/local/bin/perl5 -I$SCRAM_HOME/src -I/afs/cern.ch/user/w/williamc/public/SCRAM/src
2 <
1 > #!/usr/local/bin/perl5
2   #
3   # User Interface
4   #
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";
17 <        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();
40          use BuildSetup;
41 +        $ENV{MAKETARGETS}=join ' ',@ARGV;
42          BuildSetup($ENV{THISDIR},@ARGV);
43   #       system("$ENV{TOOL_HOME}/BuildSetup",$ENV{THISDIR},@ARGV);
44   }
# Line 31 | Line 46 | sub build {
46   sub project {
47          # process options
48          while ( $ARGV[0]=~"^-" ) {
49 <         if ( (shift @ARGV)=~/-d/ ) {  #installation area directory
49 >         if ( $ARGV[0]=~/-n/ ) {
50 >           shift @ARGV;
51 >           $ENV{devareaname}=shift @ARGV;
52 >         }
53 >         if ( $ARGV[0]=~/-d/ ) {  #installation area directory
54 >          shift @ARGV;
55            chdir $ARGV[0];
56            shift @ARGV;
57           }
# Line 47 | Line 67 | sub project {
67             BootStrapProject("$project\?\?$version");
68             # Go setup the rest of the environement, now we can
69             chdir $ENV{LOCALTOP};
70 <           &localtop;
70 >           &localtop;
71             LoadEnvFile();
72             #
73             # Now create the directories specified in the interface
# Line 64 | Line 84 | sub project {
84             use clientfile;
85             BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
86             use Cwd;
87 <           print "Installation Located at:\n".cwd()."\n";
88 <           print "Press RETURN to exit\n";
69 <           $junk=<STDIN>;
87 >           print "\nInstallation Procedure Complete. \n".
88 >                        "Installation Located at:\n".cwd()."\n";
89   }
90  
91   sub FullEnvInit {
# Line 89 | Line 108 | sub environmentinit {
108          $ENV{INTlog}="logs";
109  
110          if ( ! ( exists $ENV{SCRAM_HOME}) ){
111 <         $ENV{SCRAM_HOME}="/afs/cern.ch/user/w/williamc/public/SCRAM";
111 >         $ENV{SCRAM_HOME}="/afs/cern.ch/cms/Releases";
112           print "Warning : Environment Variable SCRAM_HOME not set.\n";
113           print "Defaulting to $ENV{SCRAM_HOME}\n";
114          }
# Line 117 | Line 136 | sub localtop {
136          } while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./  );
137          if ( ! (defined $ENV{LOCALTOP}) ) {
138           print "Unable to locate the top of local release. Exiting\n";
139 <         exit 1
139 >         exit 1;
140          }
141          } #end block
142 <        ($ENV{THISDIR}=cwd)=~s/^$ENV{LOCALTOP}//;
142 >        ($ENV{THISDIR}=cwd)=~s/^\Q$ENV{LOCALTOP}\L//;
143          $ENV{THISDIR}=~s/^\///;
144          $ENV{SCRAM_WORKDIR}="$ENV{LOCALTOP}/.SCRAM";
145   }
# Line 150 | Line 169 | sub install ( $tagname, $version ) {
169          my $version=shift @ARGV;
170  
171          # create database entry
153        do { &help_install; } if $tagname=~/help/i;
172          &FullEnvInit;
173          if ( $version eq "" ) {
174             $version=$ENV{SCRAM_PROJVERSION};
# Line 161 | Line 179 | sub install ( $tagname, $version ) {
179          my $filename="$ENV{SCRAM_CONFIG}/project.lookup";
180          my $outfile="$ENV{SCRAM_CONFIG}/project.lookup.tmp";
181          open ( LOCALLOOKUPDB, "<$filename" );
182 <        open ( OUTFILE , ">$outfile" );
182 >        open ( OUTFILE , ">$outfile" ) or die "Unable to open $outfile $!\n";
183          while ( <LOCALLOOKUPDB> ) {
184              if ( /^$tagname/ ) {
185                  print "Related tag :".$_."\n";
# Line 193 | Line 211 | sub install ( $tagname, $version ) {
211  
212   sub help_install()  {
213  
196 helpheader("install");
214   print <<ENDTEXT;
215   Associates a label with the current release in the SCRAM database.
216   This allows other users to refer to a centrally installed project by
# Line 245 | Line 262 | sub arch {
262          &environmentinit();
263          print "$ENV{SCRAM_ARCH}\n";
264   }
265 +
266 +
267 + #
268 + # Setup a new tool
269 + #
270 +
271 + sub setup {
272 +        my $toolname=shift @ARGV;
273 +
274 +        &FullEnvInit;
275 +        if ( $ENV{SCRAM_BootStrapFiles}!~/$ENV{LOCALTOP}\/\.SCRAM/ ) {
276 +          $ENV{SCRAM_BootStrapFiles}="$ENV{LOCALTOP}/.SCRAM:".
277 +                        $ENV{SCRAM_BootStrapFiles};
278 +        }
279 +        # If no toolname specified then its a full setup
280 +        if ( $toolname eq "" ) {
281 +           my $filebase="$ENV{LOCALTOP}/.SCRAM/$ENV{SCRAM_ARCH}";
282 +           rename "$filebase/clientsettings", "$filebase/clientsettings.old";
283 +           rename "$filebase/clientsettings_reqs",
284 +                                "$filebase/clientsettings_reqs.old";
285 +           use clientfile;
286 +           BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
287 +        }
288 +        else {
289 +          # Check for the correct toolfile
290 +          # ideally try and download it if not already in .SCRAM
291 +          # Only scram toolbox files supported so far
292 +          if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) {
293 +                &urlhandler::urlhandler("file:$ENV{SCRAM_HOME}/toolbox/"
294 +                        .$toolname, "$ENV{LOCALTOP}/.SCRAM/$toolname") ;
295 +          }
296 +          # Parse the toolfile and update the clientsettings file
297 +          # currently just append to the end
298 +          use clientfile;
299 +          clientfile::openclientfile('add');
300 +          clientfile::_tool("file:$toolname");
301 +          closeclientfile;
302 +        }
303 + }
304 +
305 + sub help_setup {
306 +
307 + print <<ENDTEXT;
308 + Allows installation of a new tool/external package into an already
309 + existing area. If not toolname is specified, the complete installation
310 + process is initiated.
311 +
312 + Usage:
313 +
314 +                 $bold scram setup $normal [toolname]
315 +
316 + toolname : The name of the tool setup file required.
317 + ENDTEXT
318 + exit;
319 + }
320 +
321 + sub help_list {
322 + print <<ENDTEXT;
323 + Create an entry in the SCRAM database so that an installed project can be
324 + referenced in the 'project' command by a tag/version combination.
325 + Usage: (command to be issued from inside an installed project)
326 +
327 +        $bold   scram install $normal [project_tag [version_tag]]
328 +
329 + If not specified the project_tag and version_tag default to the project
330 + name and version of the installation.
331 + ENDTEXT
332 + exit;
333 + }
334 + sub help_project {
335 + print <<ENDTEXT;
336 + Setup a new project development area. The new area will appear in the current
337 + working directory.
338 + Usage:
339 +
340 +        $bold scram project [-d install_area] $normal project_url [project_version]
341 +
342 + Options:
343 +
344 + project_url: The url of a scram bootstrap file.
345 +             Currently supported types are:
346 +                $bold Database label $normal
347 +                        Labels can be assigned to bootstrap files for easy
348 +                        access (See "scram install" command). If you
349 +                        specify a label you must also specify a project_version.
350 +                        e.g.
351 +
352 +                           scram project SCRAM V1_0
353 +                                
354 +                           scram project ORCA ORCA_1_1_1
355 +
356 +                        To see the list of installed projects use the
357 +                        "scram list" command.
358 +
359 +                $bold file: $normal A regular file on an accessable file system
360 +                        e.g.
361 +
362 +                           file:~/myprojects/projecta/config/BootStrapFile
363 +
364 + project_version:
365 +                 Only for use with a database label
366 +
367 + -d install_area:
368 +                 Indicate a project installation area into which the new
369 +                 project area should appear. Default is the current working
370 +                 directory.
371 +        
372 + ENDTEXT
373 + }
374 +
375 + sub help_version {
376 + print <<ENDTEXT;
377 + Print the version number of scram
378 + Usage:
379 +                $bold scram version $normal
380 +
381 + ENDTEXT
382 + }
383 +
384 + sub help_arch {
385 + print <<ENDTEXT;
386 + Print out the architecture flag for the current machine.
387 +
388 + Usage:
389 +        $bold   scram arch $normal
390 + ENDTEXT
391 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines