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(); |
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 { |
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 |
|
} |
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"; |
258 |
|
print "$ENV{SCRAM_ARCH}\n"; |
259 |
|
} |
260 |
|
|
254 |
– |
sub ReturnToContinue { |
255 |
– |
print "Press RETURN to exit\n"; |
256 |
– |
$junk=<STDIN>; |
257 |
– |
} |
261 |
|
|
262 |
|
# |
263 |
|
# Setup a new tool |
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" ) { |
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 |
|
} |
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; |
298 |
|
} |
299 |
|
|
300 |
|
sub help_setup { |
301 |
|
|
302 |
|
print <<ENDTEXT; |
303 |
< |
Allows installation of a new tool/external package into an already existing |
304 |
< |
area. |
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 |
< |
scram setup toolname |
309 |
> |
$bold scram setup $normal [toolname] |
310 |
|
|
311 |
|
toolname : The name of the tool setup file required. |
312 |
|
ENDTEXT |
319 |
|
referenced in the 'project' command by a tag/version combination. |
320 |
|
Usage: (command to be issued from inside an installed project) |
321 |
|
|
322 |
< |
scram install [project_tag [version_tag]] |
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. |
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 |
+ |
} |