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.6 by williamc, Mon Mar 8 11:02:40 1999 UTC vs.
Revision 1.20 by williamc, Tue Mar 30 13:44:00 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);
8 > $bold  = "\033[1m";
9 > $normal = "\033[0m";
10 > @allowed_commands=qw(project build install version list arch setup);
11  
12   foreach $command ( @allowed_commands ) {
13 <         do { &$command; $found='true'; last;} if ( $inputcmd=~/^$command\Z/i);
13 >         if ( $inputcmd=~/^$command\Z/i) {
14 >                # Deal with a help request
15 >                do{     helpheader($command);
16 >                        &{"help_".$command}; exit; } if $ARGV[0]=~/help/i;
17 >                &$command; $found='true';
18 >                last;
19 >         }
20   }
21  
22   if ( ! ( $found=~/true/ ) ) {
23 <        print "scram help\n--------\n";
17 <        print "Recognised Commands: \n";
23 >        helpheader('Recognised Commands');
24          foreach $command ( @allowed_commands ) {
25 <        print "       ".$command."\n";  
25 >        print "      $bold scram ".$command.$normal."\n";      
26          }
27 +        print "\n";
28 +        print "Help on individual commands available through\n\n";
29 +        print "$bold       scram".$normal." command$bold help $normal\n\n";
30   }
31  
32 + sub help_build {
33 +        &build;
34 + }
35   sub build {
36          # is this a based or free release?
37          FullEnvInit();
38          use BuildSetup;
39 +        $ENV{MAKETARGETS}=join ' ',@ARGV;
40          BuildSetup($ENV{THISDIR},@ARGV);
41   #       system("$ENV{TOOL_HOME}/BuildSetup",$ENV{THISDIR},@ARGV);
42   }
43  
44   sub project {
45 +        # process options
46 +        while ( $ARGV[0]=~"^-" ) {
47 +         if ( (shift @ARGV)=~/-d/ ) {  #installation area directory
48 +          chdir $ARGV[0];
49 +          shift @ARGV;
50 +         }
51 +        }
52          my $project=shift @ARGV;
53          my $version=shift @ARGV;
54          environmentinit();
55          use File::Copy;
56          use Utilities::AddDir;
57          
38           print "Warning : - you are entering a development zone.".
39                " Don't complain if it don't work\n";
58             use BootStrapProject;
59             # get the bootstrap files downloaded
60             BootStrapProject("$project\?\?$version");
# Line 58 | Line 76 | sub project {
76             }
77             use clientfile;
78             BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
79 +           use Cwd;
80 +           print "\nInstallation Procedure Complete. \n".
81 +                        "Installation Located at:\n".cwd()."\n";
82   }
83 +
84   sub FullEnvInit {
85      environmentinit();
86      localtop();
# Line 79 | Line 101 | sub environmentinit {
101          $ENV{INTlog}="logs";
102  
103          if ( ! ( exists $ENV{SCRAM_HOME}) ){
104 <         $ENV{SCRAM_HOME}="/afs/cern.ch/user/w/williamc/public/SCRAM";
104 >         $ENV{SCRAM_HOME}="/afs/cern.ch/cms/Releases";
105           print "Warning : Environment Variable SCRAM_HOME not set.\n";
106           print "Defaulting to $ENV{SCRAM_HOME}\n";
107          }
# Line 107 | Line 129 | sub localtop {
129          } while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./  );
130          if ( ! (defined $ENV{LOCALTOP}) ) {
131           print "Unable to locate the top of local release. Exiting\n";
132 <         exit 1
132 >         exit 1;
133          }
134          } #end block
135 <        ($ENV{THISDIR}=cwd)=~s/^$ENV{LOCALTOP}//;
135 >        ($ENV{THISDIR}=cwd)=~s/^\Q$ENV{LOCALTOP}\L//;
136          $ENV{THISDIR}=~s/^\///;
137          $ENV{SCRAM_WORKDIR}="$ENV{LOCALTOP}/.SCRAM";
138   }
# Line 140 | Line 162 | sub install ( $tagname, $version ) {
162          my $version=shift @ARGV;
163  
164          # create database entry
143        do { &help_install; } if $tagname=~/help/i;
165          &FullEnvInit;
166          if ( $version eq "" ) {
167             $version=$ENV{SCRAM_PROJVERSION};
# Line 151 | Line 172 | sub install ( $tagname, $version ) {
172          my $filename="$ENV{SCRAM_CONFIG}/project.lookup";
173          my $outfile="$ENV{SCRAM_CONFIG}/project.lookup.tmp";
174          open ( LOCALLOOKUPDB, "<$filename" );
175 <        open ( OUTFILE , ">$outfile" );
175 >        open ( OUTFILE , ">$outfile" ) or die "Unable to open $outfile $!\n";
176          while ( <LOCALLOOKUPDB> ) {
177              if ( /^$tagname/ ) {
178                  print "Related tag :".$_."\n";
# Line 183 | Line 204 | sub install ( $tagname, $version ) {
204  
205   sub help_install()  {
206  
186 helpheader("install");
207   print <<ENDTEXT;
208   Associates a label with the current release in the SCRAM database.
209   This allows other users to refer to a centrally installed project by
# Line 235 | Line 255 | sub arch {
255          &environmentinit();
256          print "$ENV{SCRAM_ARCH}\n";
257   }
258 +
259 +
260 + #
261 + # Setup a new tool
262 + #
263 +
264 + sub setup {
265 +        my $toolname=shift @ARGV;
266 +
267 +        &FullEnvInit;
268 +        if ( $ENV{SCRAM_BootStrapFiles}!~/$ENV{LOCALTOP}\/\.SCRAM/ ) {
269 +          $ENV{SCRAM_BootStrapFiles}="$ENV{LOCALTOP}/.SCRAM:".
270 +                        $ENV{SCRAM_BootStrapFiles};
271 +        }
272 +        # If no toolname specified then its a full setup
273 +        if ( $toolname eq "" ) {
274 +           my $filebase="$ENV{LOCALTOP}/.SCRAM/$ENV{SCRAM_ARCH}";
275 +           rename "$filebase/clientsettings", "$filebase/clientsettings.old";
276 +           rename "$filebase/clientsettings_reqs",
277 +                                "$filebase/clientsettings_reqs.old";
278 +           use clientfile;
279 +           BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
280 +        }
281 +        else {
282 +          # Check for the correct toolfile
283 +          # ideally try and download it if not already in .SCRAM
284 +          # Only scram toolbox files supported so far
285 +          if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) {
286 +                &urlhandler::urlhandler("file:$ENV{SCRAM_HOME}/toolbox/"
287 +                        .$toolname, "$ENV{LOCALTOP}/.SCRAM/$toolname") ;
288 +          }
289 +          # Parse the toolfile and update the clientsettings file
290 +          # currently just append to the end
291 +          use clientfile;
292 +          clientfile::openclientfile('add');
293 +          clientfile::_tool("file:$toolname");
294 +          closeclientfile;
295 +        }
296 + }
297 +
298 + sub help_setup {
299 +
300 + print <<ENDTEXT;
301 + Allows installation of a new tool/external package into an already
302 + existing area. If not toolname is specified, the complete installation
303 + process is initiated.
304 +
305 + Usage:
306 +
307 +                 $bold scram setup $normal [toolname]
308 +
309 + toolname : The name of the tool setup file required.
310 + ENDTEXT
311 + exit;
312 + }
313 +
314 + sub help_list {
315 + print <<ENDTEXT;
316 + Create an entry in the SCRAM database so that an installed project can be
317 + referenced in the 'project' command by a tag/version combination.
318 + Usage: (command to be issued from inside an installed project)
319 +
320 +        $bold   scram install $normal [project_tag [version_tag]]
321 +
322 + If not specified the project_tag and version_tag default to the project
323 + name and version of the installation.
324 + ENDTEXT
325 + exit;
326 + }
327 + sub help_project {
328 + print <<ENDTEXT;
329 + Setup a new project development area. The new area will appear in the current
330 + working directory.
331 + Usage:
332 +
333 +        $bold scram project [-d install_area] $normal project_url [project_version]
334 +
335 + Options:
336 +
337 + project_url: The url of a scram bootstrap file.
338 +             Currently supported types are:
339 +                $bold Database label $normal
340 +                        Labels can be assigned to bootstrap files for easy
341 +                        access (See "scram install" command). If you
342 +                        specify a label you must also specify a project_version.
343 +                        e.g.
344 +
345 +                           scram project SCRAM V1_0
346 +                                
347 +                           scram project ORCA ORCA_1_1_1
348 +
349 +                        To see the list of installed projects use the
350 +                        "scram list" command.
351 +
352 +                $bold file: $normal A regular file on an accessable file system
353 +                        e.g.
354 +
355 +                           file:~/myprojects/projecta/config/BootStrapFile
356 +
357 + project_version:
358 +                 Only for use with a database label
359 +
360 + -d install_area:
361 +                 Indicate a project installation area into which the new
362 +                 project area should appear. Default is the current working
363 +                 directory.
364 +        
365 + ENDTEXT
366 + }
367 +
368 + sub help_version {
369 + print <<ENDTEXT;
370 + Print the version number of scram
371 + Usage:
372 +                $bold scram version $normal
373 +
374 + ENDTEXT
375 + }
376 +
377 + sub help_arch {
378 + print <<ENDTEXT;
379 + Print out the architecture flag for the current machine.
380 +
381 + Usage:
382 +        $bold   scram arch $normal
383 + ENDTEXT
384 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines