7 |
|
$found='false'; |
8 |
|
$bold = "\033[1m"; |
9 |
|
$normal = "\033[0m"; |
10 |
< |
@allowed_commands=qw(project build env install version list arch setup); |
10 |
> |
@allowed_commands=qw(project build install version list arch setup); |
11 |
|
|
12 |
< |
foreach $command ( @allowed_commands ) { |
13 |
< |
if ( $inputcmd=~/^$command\Z/i) { |
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"; |
24 |
< |
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(); |
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 |
|
} |
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 |
84 |
|
use clientfile; |
85 |
|
BuildClientFile( $ENV{SCRAM_ProjReqsDoc} ); |
86 |
|
use Cwd; |
87 |
< |
print "Installation Located at:\n".cwd()."\n"; |
88 |
< |
ReturnToContinue(); |
87 |
> |
print "\nInstallation Procedure Complete. \n". |
88 |
> |
"Installation Located at:\n".cwd()."\n"; |
89 |
|
} |
90 |
|
|
91 |
|
sub FullEnvInit { |
136 |
|
} while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./ ); |
137 |
|
if ( ! (defined $ENV{LOCALTOP}) ) { |
138 |
|
print "Unable to locate the top of local release. Exiting\n"; |
139 |
< |
ReturnToContinue(); |
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 |
|
} |
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"; |
263 |
|
print "$ENV{SCRAM_ARCH}\n"; |
264 |
|
} |
265 |
|
|
254 |
– |
sub ReturnToContinue { |
255 |
– |
print "Press RETURN to exit\n"; |
256 |
– |
$junk=<STDIN>; |
257 |
– |
} |
266 |
|
|
267 |
|
# |
268 |
|
# Setup a new tool |
276 |
|
$ENV{SCRAM_BootStrapFiles}="$ENV{LOCALTOP}/.SCRAM:". |
277 |
|
$ENV{SCRAM_BootStrapFiles}; |
278 |
|
} |
279 |
< |
# Check for the correct toolfile |
280 |
< |
# ideally try and download it if not already in .SCRAM |
281 |
< |
# Only scram toolbox files supported so far |
282 |
< |
if ( ! -e "$ENV{LOCALTOP}/.SCRAM/$toolname" ) { |
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 |
|
} |
278 |
– |
# Parse the toolfile and update the clientsettings file |
279 |
– |
# currently just append to the end |
280 |
– |
use clientfile; |
281 |
– |
clientfile::openclientfile('add'); |
282 |
– |
clientfile::_tool("file:$toolname"); |
283 |
– |
closeclientfile; |
303 |
|
} |
304 |
|
|
305 |
|
sub help_setup { |
306 |
|
|
307 |
|
print <<ENDTEXT; |
308 |
< |
Allows installation of a new tool/external package into an already existing |
309 |
< |
area. |
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 |
< |
scram setup toolname |
314 |
> |
$bold scram setup $normal [toolname] |
315 |
|
|
316 |
|
toolname : The name of the tool setup file required. |
317 |
|
ENDTEXT |
324 |
|
referenced in the 'project' command by a tag/version combination. |
325 |
|
Usage: (command to be issued from inside an installed project) |
326 |
|
|
327 |
< |
scram install [project_tag [version_tag]] |
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. |
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 |
+ |
} |