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.2 by williamc, Mon Mar 1 11:01:42 1999 UTC vs.
Revision 1.14 by williamc, Thu Mar 25 15:42:48 1999 UTC

# Line 1 | Line 1
1 < #!/usr/local/bin/perl5 -I$ENV{SCRAM_HOME}/src
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 env 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";
23 >        print "scram help\n----------\n";
24          print "Recognised Commands: \n";
25          foreach $command ( @allowed_commands ) {
26          print "       ".$command."\n";  
27          }
28   }
29  
30 + sub help_build {
31 +        &build;
32 + }
33   sub build {
34          # is this a based or free release?
35          FullEnvInit();
36          use BuildSetup;
37 +        $ENV{MAKETARGETS}=join ' ',@ARGV;
38          BuildSetup($ENV{THISDIR},@ARGV);
39   #       system("$ENV{TOOL_HOME}/BuildSetup",$ENV{THISDIR},@ARGV);
40   }
41  
42   sub project {
43 +        # process options
44 +        while ( $ARGV[0]=~"^-" ) {
45 +         if ( (shift @ARGV)=~/-d/ ) {  #installation area directory
46 +          chdir $ARGV[0];
47 +          shift @ARGV;
48 +         }
49 +        }
50          my $project=shift @ARGV;
51          my $version=shift @ARGV;
52          environmentinit();
53          use File::Copy;
54          use Utilities::AddDir;
55          
37           print "Warning : - you are entering a development zone.".
38                " Don't complain if it don't work\n";
56             use BootStrapProject;
57             # get the bootstrap files downloaded
58             BootStrapProject("$project\?\?$version");
# Line 48 | Line 65 | sub project {
65             #
66             foreach $key ( keys %ENV ) {
67                  if ( $key=~/^INT/ ) {
68 <                        adddir($ENV{$key});
68 >                        AddDir::adddir($ENV{$key});
69                  }
70             }
71 +           if ( ! -e "$ENV{LOCALTOP}/$ENV{projconfigdir}" ) {
72 +                system("cp", "-r", "$ENV{RELEASETOP}/$ENV{projconfigdir}",
73 +                                "$ENV{LOCALTOP}/$ENV{projconfigdir}");
74 +           }
75             use clientfile;
76             BuildClientFile( $ENV{SCRAM_ProjReqsDoc} );
77 +           use Cwd;
78 +           print "Installation Located at:\n".cwd()."\n";
79 +           ReturnToContinue();
80   }
81 +
82   sub FullEnvInit {
83      environmentinit();
84      localtop();
# Line 66 | Line 91 | sub environmentinit {
91          my $value;
92  
93          $ENV{LatestBuildFile}=""; # stop recursive behaviour in make
94 <        setarch();
94 >        setarchitecture::setarch();
95          $ENV{INTwork}="tmp/$ENV{SCRAM_ARCH}";
96          $ENV{INTlib}="lib/$ENV{SCRAM_ARCH}";
97          $ENV{INTsrc}="src";
# Line 74 | Line 99 | sub environmentinit {
99          $ENV{INTlog}="logs";
100  
101          if ( ! ( exists $ENV{SCRAM_HOME}) ){
102 <         $ENV{SCRAM_HOME}="/afs/cern.ch/user/w/williamc/public/ConfigMan";
102 >         $ENV{SCRAM_HOME}="/afs/cern.ch/cms/Releases";
103           print "Warning : Environment Variable SCRAM_HOME not set.\n";
104           print "Defaulting to $ENV{SCRAM_HOME}\n";
105          }
106           if ( ! ( exists $ENV{SCRAM_CONFIG} ) ){
107 <                $ENV{SCRAM_CONFIG}="$ENV{SCRAM_HOME}/Configuration";
107 >                $ENV{SCRAM_CONFIG}="$ENV{SCRAM_HOME}/configuration";
108          }
109          if ( ! ( exists $ENV{TOOL_HOME} ) ){
110 <                $ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/toolbox";
110 >                $ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src";
111          }
112          if ( ! ( exists $ENV{SCRAM_LOOKUPDB} ) ){
113                  $ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_CONFIG}/project.lookup";
# Line 102 | Line 127 | sub localtop {
127          } while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./  );
128          if ( ! (defined $ENV{LOCALTOP}) ) {
129           print "Unable to locate the top of local release. Exiting\n";
130 <         exit 1
130 >         ReturnToContinue();
131          }
132          } #end block
133          ($ENV{THISDIR}=cwd)=~s/^$ENV{LOCALTOP}//;
# Line 135 | Line 160 | sub install ( $tagname, $version ) {
160          my $version=shift @ARGV;
161  
162          # create database entry
138        do { &help_install; } if $tagname=~/help/i;
163          &FullEnvInit;
164          if ( $version eq "" ) {
165             $version=$ENV{SCRAM_PROJVERSION};
# Line 178 | Line 202 | sub install ( $tagname, $version ) {
202  
203   sub help_install()  {
204  
181 helpheader("install");
205   print <<ENDTEXT;
206   Associates a label with the current release in the SCRAM database.
207   This allows other users to refer to a centrally installed project by
# Line 230 | Line 253 | sub arch {
253          &environmentinit();
254          print "$ENV{SCRAM_ARCH}\n";
255   }
256 +
257 + sub ReturnToContinue {
258 +           print "Press RETURN to exit\n";
259 +           $junk=<STDIN>;
260 + }
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 +        # Check for the correct toolfile
275 +        # ideally try and download it if not already in .SCRAM
276 +        # Only scram toolbox files supported so far
277 +        if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) {
278 +                &urlhandler::urlhandler("file:$ENV{SCRAM_HOME}/toolbox/"
279 +                        .$toolname, "$ENV{LOCALTOP}/.SCRAM/$toolname") ;
280 +        }
281 +        # Parse the toolfile and update the clientsettings file
282 +        # currently just append to the end
283 +        use clientfile;
284 +        clientfile::openclientfile('add');
285 +        clientfile::_tool("file:$toolname");
286 +        closeclientfile;
287 + }
288 +
289 + sub help_setup {
290 +
291 + print <<ENDTEXT;
292 + Allows installation of a new tool/external package into an already
293 + existing area.
294 +
295 + Usage:
296 +
297 +                 $bold scram setup $normal toolname
298 +
299 + toolname : The name of the tool setup file required.
300 + ENDTEXT
301 + exit;
302 + }
303 +
304 + sub help_list {
305 + print <<ENDTEXT;
306 + Create an entry in the SCRAM database so that an installed project can be
307 + referenced in the 'project' command by a tag/version combination.
308 + Usage: (command to be issued from inside an installed project)
309 +
310 +        $bold   scram install $normal [project_tag [version_tag]]
311 +
312 + If not specified the project_tag and version_tag default to the project
313 + name and version of the installation.
314 + ENDTEXT
315 + exit;
316 + }
317 + sub help_project {
318 + print <<ENDTEXT;
319 + Setup a new project development area. The new area will appear in the current
320 + working directory.
321 + Usage:
322 +
323 +        $bold scram project [-d install_area] $normal project_url [project_version]
324 +
325 + Options:
326 +
327 + project_url: The url of a scram bootstrap file.
328 +             Currently supported types are:
329 +                $bold Database label $normal
330 +                        Labels can be assigned to bootstrap files for easy
331 +                        access (See "scram install" command). If you
332 +                        specify a label you must also specify a project_version.
333 +                        e.g.
334 +
335 +                           scram project SCRAM V1_0
336 +                                
337 +                           scram project ORCA ORCA_1_1_1
338 +
339 +                        To see the list of installed projects use the
340 +                        "scram list" command.
341 +
342 +                $bold file: $normal A regular file on an accessable file system
343 +                        e.g.
344 +
345 +                           file:~/myprojects/projecta/config/BootStrapFile
346 +
347 + project_version:
348 +                 Only for use with a database label
349 +
350 + -d install_area:
351 +                 Indicate a project installation area into which the new
352 +                 project area should appear. Default is the current working
353 +                 directory.
354 +        
355 + ENDTEXT
356 + }
357 +
358 + sub help_version {
359 + print <<ENDTEXT;
360 + Print the version number of scram
361 + Usage:
362 +                $bold scram version $normal
363 +
364 + ENDTEXT
365 + }
366 +
367 + sub help_arch {
368 + print <<ENDTEXT;
369 + Print out the architecture flag for the current machine.
370 +
371 + Usage:
372 +        $bold   scram arch $normal
373 + ENDTEXT
374 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines