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 |
> |
# we dont need this anymore to invoke perl but options placed here will be |
4 |
> |
# used. |
5 |
|
# |
6 |
|
# User Interface |
7 |
|
# |
8 |
+ |
# Make sure were running the right version |
9 |
+ |
|
10 |
+ |
versioncheck(); |
11 |
|
|
12 |
|
$inputcmd=shift; |
13 |
|
$found='false'; |
14 |
< |
@allowed_commands=qw(project build env install version list arch); |
15 |
< |
|
16 |
< |
foreach $command ( @allowed_commands ) { |
17 |
< |
do { &$command; $found='true'; last;} if ( $inputcmd=~/^$command\Z/i); |
14 |
> |
$bold = "\033[1m"; |
15 |
> |
$rv=0; |
16 |
> |
$normal = "\033[0m"; |
17 |
> |
$self={}; |
18 |
> |
|
19 |
> |
@allowed_commands=qw(project build install version list arch setup runtime db tool); |
20 |
> |
@dev_cmds=qw(devtest align); |
21 |
> |
|
22 |
> |
if ( $inputcmd ne "" ) { |
23 |
> |
foreach $command ( (@allowed_commands,@dev_cmds) ) { |
24 |
> |
if ( $command=~/^$inputcmd/i) { |
25 |
> |
# Deal with a help request |
26 |
> |
do{ helpheader($command); |
27 |
> |
&{"help_".$command}; exit; } if $ARGV[0]=~/help/i; |
28 |
> |
$rv=&$command; $found='true'; |
29 |
> |
last; |
30 |
> |
} |
31 |
> |
} |
32 |
|
} |
33 |
|
|
34 |
|
if ( ! ( $found=~/true/ ) ) { |
35 |
< |
print "scram help\n--------\n"; |
17 |
< |
print "Recognised Commands: \n"; |
35 |
> |
helpheader('Recognised Commands'); |
36 |
|
foreach $command ( @allowed_commands ) { |
37 |
< |
print " ".$command."\n"; |
37 |
> |
print " $bold scram ".$command.$normal."\n"; |
38 |
> |
} |
39 |
> |
print "\n"; |
40 |
> |
print "Help on individual commands available through\n\n"; |
41 |
> |
print "$bold scram".$normal." command$bold help $normal\n\n"; |
42 |
> |
} |
43 |
> |
exit $rv; |
44 |
> |
|
45 |
> |
sub error { |
46 |
> |
my $string=shift; |
47 |
> |
print "scram : ".$string."\n"; |
48 |
> |
exit 1; |
49 |
> |
} |
50 |
> |
|
51 |
> |
sub versioncheck { |
52 |
> |
my $version; |
53 |
> |
my $thisversion; |
54 |
> |
|
55 |
> |
$thisversion=getversion(); |
56 |
> |
|
57 |
> |
if ( @_ ) { |
58 |
> |
$version=shift; |
59 |
|
} |
60 |
+ |
else { |
61 |
+ |
if ( ! localtop_find() ) { |
62 |
+ |
LoadEnvFile(); |
63 |
+ |
my $versionfile=$ENV{LOCALTOP}."/$ENV{projconfigdir}/scram_version"; |
64 |
+ |
if ( -f $versionfile ) { |
65 |
+ |
open (VERSION, "<".$versionfile); |
66 |
+ |
$version=<VERSION>; |
67 |
+ |
chomp $version; |
68 |
+ |
} |
69 |
+ |
} |
70 |
+ |
} |
71 |
+ |
if ( defined $version ) { |
72 |
+ |
if ( $version ne $thisversion ) { |
73 |
+ |
# first try to use the correct version |
74 |
+ |
if ( -d $scram_top."/".$version ) { |
75 |
+ |
$ENV{SCRAM_HOME}=$scram_top."/".$version; |
76 |
+ |
my $rv=system("scram", @ARGV)/256; |
77 |
+ |
exit $rv; |
78 |
+ |
} |
79 |
+ |
else { # if not then simply warn |
80 |
+ |
print "******* Warning : scram version inconsistent ********\n"; |
81 |
+ |
print "This version: $thisversion; Required version: $version"; |
82 |
+ |
print "*****************************************************\n"; |
83 |
+ |
print "\n"; |
84 |
+ |
} |
85 |
+ |
} |
86 |
+ |
} |
87 |
+ |
} |
88 |
+ |
|
89 |
+ |
sub _processcmds { |
90 |
+ |
my $optionhandler=shift; |
91 |
+ |
my $allowed_commands=shift; |
92 |
+ |
my $cmds=shift; |
93 |
+ |
my @subs=@_; |
94 |
+ |
|
95 |
+ |
my $found='false'; |
96 |
+ |
# make a string from the subcommand levels |
97 |
+ |
my $substring=""; |
98 |
+ |
if ( @subs ) { |
99 |
+ |
$substring= join '_', @subs; |
100 |
+ |
$substring=$substring."_"; |
101 |
+ |
} |
102 |
+ |
|
103 |
+ |
# Process options |
104 |
+ |
if ( defined ${$cmds}[0] ) { |
105 |
+ |
while ( ${$cmds}[0]=~/^-/) { |
106 |
+ |
&{$optionhandler}( ${$cmds}[0],$cmds); |
107 |
+ |
} |
108 |
+ |
|
109 |
+ |
my $inputcmd=shift @{$cmds}; |
110 |
+ |
if ( $inputcmd ne "" ) { |
111 |
+ |
foreach $command ( @{$allowed_commands} ) { |
112 |
+ |
if ( $command=~/^$inputcmd/i) { |
113 |
+ |
# Deal with a help request |
114 |
+ |
if ( ( defined $$cmds[0]) && $$cmds[0]=~/help/i ) { |
115 |
+ |
&helpheader($command,@subs); |
116 |
+ |
&{"help_".$substring.$command}; exit; |
117 |
+ |
} |
118 |
+ |
else { |
119 |
+ |
#print "calling $substring".$command."(@{$cmds})\n"; |
120 |
+ |
&{$substring.$command}(@{$cmds}); $found='true'; |
121 |
+ |
last; |
122 |
+ |
} |
123 |
+ |
} |
124 |
+ |
} |
125 |
+ |
} |
126 |
+ |
} |
127 |
+ |
return $found; |
128 |
+ |
} |
129 |
+ |
|
130 |
+ |
|
131 |
+ |
sub help_build { |
132 |
+ |
&build; |
133 |
+ |
} |
134 |
+ |
|
135 |
+ |
sub align { |
136 |
+ |
_localarea()->align(); |
137 |
|
} |
138 |
|
|
139 |
|
sub build { |
140 |
|
# is this a based or free release? |
141 |
|
FullEnvInit(); |
142 |
< |
use BuildSetup; |
143 |
< |
BuildSetup($ENV{THISDIR},@ARGV); |
144 |
< |
# system("$ENV{TOOL_HOME}/BuildSetup",$ENV{THISDIR},@ARGV); |
142 |
> |
use BuildSystem::BuildSetup; |
143 |
> |
$ENV{MAKETARGETS}=join ' ',@ARGV; |
144 |
> |
my $bs=BuildSystem::BuildSetup->new(toolbox()); |
145 |
> |
$rv=$bs->BuildSetup($ENV{THISDIR},@ARGV); |
146 |
> |
$rv; |
147 |
|
} |
148 |
|
|
149 |
|
sub project { |
150 |
< |
my $project=shift @ARGV; |
151 |
< |
my $version=shift @ARGV; |
152 |
< |
environmentinit(); |
153 |
< |
use File::Copy; |
154 |
< |
use Utilities::AddDir; |
150 |
> |
my @args=@ARGV; |
151 |
> |
|
152 |
> |
my $devareaname=""; |
153 |
> |
use Cwd; |
154 |
> |
my $installarea=cwd(); |
155 |
> |
|
156 |
> |
# process options |
157 |
> |
while ( $args[0]=~"^-" ) { |
158 |
> |
if ( $args[0]=~/-n/ ) { |
159 |
> |
shift @args; |
160 |
> |
$devareaname=shift @args; |
161 |
> |
} |
162 |
> |
elsif ( $args[0]=~/-d/ ) { #installation area directory |
163 |
> |
shift @args; |
164 |
> |
$installarea=$args[0]; |
165 |
> |
if ( ! -d $installarea ) { |
166 |
> |
error("$installarea does not exist"); |
167 |
> |
} |
168 |
> |
shift @args; |
169 |
> |
} |
170 |
> |
else { |
171 |
> |
error("unknown option $args[0] to project command"); |
172 |
> |
} |
173 |
> |
} |
174 |
> |
|
175 |
> |
# -- check what arguments have been passed |
176 |
> |
if ( $#args <0 || $#args>1 ) { |
177 |
> |
error("\"scram project help\" for usage info"); |
178 |
> |
} |
179 |
> |
my $area; #somewhere to store the area object when we have it |
180 |
> |
|
181 |
> |
if ( ( $#args==0 ) && ($args[0]=~/:/) ) { |
182 |
> |
# -- must be a url to bootstrap from |
183 |
> |
$area=scrambasics()->project($args[0], $installarea, |
184 |
> |
$devareaname); |
185 |
> |
scrambasics()->setuptoolsinarea($area); |
186 |
> |
} |
187 |
> |
elsif ( $#args >0 ) { |
188 |
> |
# -- need to create a satellite area |
189 |
> |
$area=scrambasics()->satellite(@args,$installarea, $devareaname); |
190 |
> |
} |
191 |
> |
else { |
192 |
> |
error("\"scram project help\" for usage info"); |
193 |
> |
} |
194 |
|
|
195 |
< |
print "Warning : - you are entering a development zone.". |
196 |
< |
" Don't complain if it don't work\n"; |
197 |
< |
use BootStrapProject; |
198 |
< |
# get the bootstrap files downloaded |
199 |
< |
BootStrapProject("$project\?\?$version"); |
200 |
< |
# Go setup the rest of the environement, now we can |
201 |
< |
chdir $ENV{LOCALTOP}; |
202 |
< |
&localtop; |
203 |
< |
LoadEnvFile(); |
204 |
< |
# |
205 |
< |
# Now create the directories specified in the interface |
206 |
< |
# |
207 |
< |
foreach $key ( keys %ENV ) { |
208 |
< |
if ( $key=~/^INT/ ) { |
209 |
< |
adddir($ENV{$key}); |
210 |
< |
} |
195 |
> |
# |
196 |
> |
# Now create the directories specified in the interface |
197 |
> |
# There should be some better mechanism - TODO |
198 |
> |
# |
199 |
> |
chdir $area->location(); |
200 |
> |
foreach $key ( keys %ENV ) { |
201 |
> |
if ( $key=~/^INT/ ) { |
202 |
> |
AddDir::adddir($ENV{$key}); |
203 |
> |
} |
204 |
> |
} |
205 |
> |
|
206 |
> |
print "\nInstallation Procedure Complete. \n". |
207 |
> |
"Installation Located at:\n".$area->location()."\n"; |
208 |
> |
} |
209 |
> |
|
210 |
> |
sub scrambasics { |
211 |
> |
require Scram::ScramFunctions; |
212 |
> |
if ( ! defined $scramobj ) { |
213 |
> |
environmentinit(); |
214 |
> |
$scramobj=Scram::ScramFunctions->new(); |
215 |
> |
$scramobj->arch($ENV{SCRAM_ARCH}); |
216 |
> |
#$scramobj->verbosity(1); |
217 |
> |
} |
218 |
> |
return $scramobj; |
219 |
> |
} |
220 |
> |
|
221 |
> |
# ------------ tool command -------------------------------------------- |
222 |
> |
sub tool { |
223 |
> |
@_=@ARGV; |
224 |
> |
localtop(); |
225 |
> |
environmentinit(); |
226 |
> |
my @allowed_cmds=qw(info list default); |
227 |
> |
_processcmds("_tooloptions", \@allowed_cmds, \@_, ("tool")); |
228 |
> |
} |
229 |
> |
|
230 |
> |
sub tool_default { |
231 |
> |
if ( $#_ != 1 ) { |
232 |
> |
error("\"scram tool default help\" for usage information"); |
233 |
> |
} |
234 |
> |
my $tool=shift; |
235 |
> |
my $version=shift; |
236 |
> |
print "Setting default version of $tool to $version\n"; |
237 |
> |
# -- adjust the toolbox |
238 |
> |
toolbox()->setdefault($tool,$version); |
239 |
> |
|
240 |
> |
} |
241 |
> |
|
242 |
> |
sub tool_list { |
243 |
> |
my $area=_localarea(); |
244 |
> |
print "Tool List for "; #.$area->name()." ".$area->version()."\n"; |
245 |
> |
print "Location : ".$area->location()."\n"; |
246 |
> |
print "+"x60; |
247 |
> |
print "\n"; |
248 |
> |
foreach $t ( toolbox()->tools() ) { |
249 |
> |
my $vers=join / /, toolbox()->versions($t); |
250 |
> |
print $t." ".$vers." (default=".toolbox()->defaultversion($t).")\n"; |
251 |
> |
} |
252 |
> |
} |
253 |
> |
|
254 |
> |
sub tool_info { |
255 |
> |
my $project=shift; |
256 |
> |
my $area=_localarea(); |
257 |
> |
print "Tool Info as configured in "; |
258 |
> |
#.$area->name()." ".$area->version()."\n"; |
259 |
> |
print "Location : ".$area->location()."\n"; |
260 |
> |
print "+"x60; |
261 |
> |
print "\n"; |
262 |
> |
|
263 |
> |
my @tools=toolbox()->gettool($project,@_); |
264 |
> |
foreach $t ( @tools ) { |
265 |
> |
if ( defined $t ) { |
266 |
> |
print "Name : ".$t->name(); |
267 |
> |
print "\n"; |
268 |
> |
print "Version : ".$t->version(); |
269 |
> |
print "\n"; |
270 |
> |
print "Docfile : ".$t->url(); |
271 |
> |
print "\n"; |
272 |
> |
print "+"x20; |
273 |
> |
print "\n"; |
274 |
> |
@features=$t->features(); |
275 |
> |
foreach $ft ( @features ) { |
276 |
> |
@vals=$t->getfeature($ft); |
277 |
> |
foreach $v ( @vals ) { |
278 |
> |
print $ft. "=$v\n"; |
279 |
> |
} |
280 |
> |
} |
281 |
> |
} |
282 |
> |
} |
283 |
> |
} |
284 |
> |
|
285 |
> |
sub _tooloptions { |
286 |
> |
error("No Options defined for tool subcommand"); |
287 |
> |
} |
288 |
> |
|
289 |
> |
sub help_tool { |
290 |
> |
print <<ENDTEXT; |
291 |
> |
Manage the tools in the scram area that define the areas environment. |
292 |
> |
tool subcommands : |
293 |
> |
list |
294 |
> |
info tool_name |
295 |
> |
default tool_name tool_version |
296 |
> |
|
297 |
> |
ENDTEXT |
298 |
> |
} |
299 |
> |
|
300 |
> |
sub help_tool_info { |
301 |
> |
print <<ENDTEXT; |
302 |
> |
Description: |
303 |
> |
Print out information on the specified tool in the current area |
304 |
> |
configuration. |
305 |
> |
Usage : |
306 |
> |
scram tool info tool_name [tool_version] |
307 |
> |
|
308 |
> |
ENDTEXT |
309 |
> |
} |
310 |
> |
|
311 |
> |
sub help_tool_list { |
312 |
> |
print <<ENDTEXT; |
313 |
> |
Description: |
314 |
> |
List of currently configured tools available in ther current scram |
315 |
> |
area |
316 |
> |
Usage : |
317 |
> |
scram tool list |
318 |
> |
|
319 |
> |
ENDTEXT |
320 |
> |
} |
321 |
> |
|
322 |
> |
sub help_tool_default { |
323 |
> |
print <<ENDTEXT; |
324 |
> |
Description: |
325 |
> |
Change the default version of a tool to be used in the area |
326 |
> |
Usage : |
327 |
> |
scram tool default tool_name tool_version |
328 |
> |
|
329 |
> |
ENDTEXT |
330 |
> |
} |
331 |
> |
|
332 |
> |
# ---------------------------------------------------------------------- |
333 |
> |
sub _requirements { |
334 |
> |
if ( ! defined $reqsobj ) { |
335 |
> |
localtop(); |
336 |
> |
my $area=_localarea(); |
337 |
> |
scrambasics()->arearequirements($area) |
338 |
> |
} |
339 |
> |
return $reqsobj; |
340 |
> |
} |
341 |
> |
|
342 |
> |
sub _allprojectinitsearcher { |
343 |
> |
my $search=_projsearcher(); |
344 |
> |
foreach $proj ( _scramprojdb()->list() ) { |
345 |
> |
$search->addproject($$proj[0],$$proj[1]); |
346 |
> |
} |
347 |
> |
} |
348 |
> |
|
349 |
> |
sub _projsearcher { |
350 |
> |
if ( ! defined $self->{projsearcher} ) { |
351 |
> |
require Scram::ProjectSearcher; |
352 |
> |
$self->{projsearcher}=Scram::ProjectSearcher->new(_scramprojdb()); |
353 |
> |
} |
354 |
> |
return $self->{projsearcher}; |
355 |
> |
} |
356 |
> |
|
357 |
> |
sub _scramprojdb { |
358 |
> |
return scrambasics()->scramprojectdb(); |
359 |
> |
} |
360 |
> |
|
361 |
> |
sub runtime { |
362 |
> |
my $shell; |
363 |
> |
require Runtime; |
364 |
> |
|
365 |
> |
# process options |
366 |
> |
while ( $ARGV[0]=~"^-" ) { |
367 |
> |
if ( $ARGV[0]=~/-sh/ ) { |
368 |
> |
shift @ARGV; |
369 |
> |
$shell="sh"; |
370 |
> |
next; |
371 |
> |
} |
372 |
> |
if ( $ARGV[0]=~/-csh/ ) { #installation area directory |
373 |
> |
shift @ARGV; |
374 |
> |
$shell="csh"; |
375 |
> |
next; |
376 |
> |
} |
377 |
> |
print "Unknown Option $ARGV[0]\n"; |
378 |
> |
exit 1; |
379 |
> |
} |
380 |
> |
|
381 |
> |
FullEnvInit(); |
382 |
> |
if ( @ARGV ) { |
383 |
> |
my $runtime=Runtime->new(); |
384 |
> |
my $arg=shift @ARGV; |
385 |
> |
|
386 |
> |
my $info=0; |
387 |
> |
if ( $arg eq "info" ) { |
388 |
> |
$arg=shift @ARGV; |
389 |
> |
$info=1; |
390 |
> |
} |
391 |
> |
|
392 |
> |
# --- determine filename |
393 |
> |
my $filename; |
394 |
> |
if ( -f $arg ) { # Is it a file? |
395 |
> |
$filename=$arg; |
396 |
|
} |
397 |
< |
use clientfile; |
398 |
< |
BuildClientFile( $ENV{SCRAM_ProjReqsDoc} ); |
397 |
> |
else { |
398 |
> |
# -- lets see if its a BuildFile location |
399 |
> |
$filename=_testfile($ENV{LOCALTOP}."/src/".$arg, |
400 |
> |
$ENV{RELEASETOP}."/src/".$arg, |
401 |
> |
$ENV{LOCALTOP}."/src/".$arg."/BuildFile", |
402 |
> |
$ENV{RELEASETOP}."/src/".$arg."/BuildFile"); |
403 |
> |
if ( $filename eq "" ) { |
404 |
> |
print "Unable to find a file (or BuildFile) relating to ". |
405 |
> |
$arg."\n"; |
406 |
> |
exit 1; |
407 |
> |
} |
408 |
> |
} |
409 |
> |
$runtime->file($filename); |
410 |
> |
if ( ! $info ) { |
411 |
> |
$runtime->printenv($shell); |
412 |
> |
} |
413 |
> |
else { |
414 |
> |
if ( @ARGV ) { #do we have a specific variable request? |
415 |
> |
_printvardoc($runtime,shift @ARGV); |
416 |
> |
} |
417 |
> |
else { |
418 |
> |
foreach $var ( $runtime->list() ) { |
419 |
> |
_printvardoc($runtime,$var); |
420 |
> |
} |
421 |
> |
} |
422 |
> |
} |
423 |
> |
undef $runtime; |
424 |
> |
} |
425 |
> |
else { |
426 |
> |
FullEnvInit(); |
427 |
> |
# We have to clean up from the last runtime cmd - use env history |
428 |
> |
foreach $variable ( %ENV ) { |
429 |
> |
if ( $variable=~/^SCRAMRT_(.*)/ ) { #SCRAMRT are history retaining |
430 |
> |
my $var=$1; |
431 |
> |
$ENV{$var}=~s/\Q$ENV{$variable}\E//g; |
432 |
> |
$ENV{$var}=~s/^:*//; # Deal with any Path variables |
433 |
> |
#print "$variable : $ENV{$variable} \n$var : $ENV{$var}\n"; |
434 |
> |
delete $ENV{$variable}; |
435 |
> |
} |
436 |
> |
} |
437 |
> |
|
438 |
> |
# -- Set SCRAM release area paths |
439 |
> |
addpath("LD_LIBRARY_PATH","$ENV{LOCALTOP}/lib/$ENV{SCRAM_ARCH}"); |
440 |
> |
addpath("LD_LIBRARY_PATH","$ENV{RELEASETOP}/lib/$ENV{SCRAM_ARCH}"); |
441 |
> |
|
442 |
> |
# -- get the tool runtime environments |
443 |
> |
my $toolbox=toolbox(); |
444 |
> |
foreach $tool ( $toolbox->tools() ) { |
445 |
> |
$tool=$toolbox->gettool($tool); |
446 |
> |
|
447 |
> |
if ( defined $tool ) { |
448 |
> |
# -- get runtime paths |
449 |
> |
foreach $f ( $tool->listtype("runtime_path")) { |
450 |
> |
foreach $val ( $tool->getfeature($f) ) { |
451 |
> |
addpath($f,$val); |
452 |
> |
} |
453 |
> |
} |
454 |
> |
# -- get runtime vars |
455 |
> |
foreach $f ( $tool->listtype("runtime")) { |
456 |
> |
foreach $val ( $tool->getfeature($f) ) { |
457 |
> |
$EnvRuntime{$f}=$val; |
458 |
> |
} |
459 |
> |
} |
460 |
> |
} |
461 |
> |
} |
462 |
> |
|
463 |
> |
addpath("PATH","$ENV{LOCALTOP}/bin/$ENV{SCRAM_ARCH}"); |
464 |
> |
addpath("PATH","$ENV{RELEASETOP}/bin/$ENV{SCRAM_ARCH}"); |
465 |
> |
|
466 |
> |
# Now get the general project environment |
467 |
> |
open ( SCRAMENV, "<$ENV{LOCALTOP}/$ENV{projconfigdir}/Runtime" ); |
468 |
> |
while ( <SCRAMENV> ) { |
469 |
> |
chomp; |
470 |
> |
next if /^#/; |
471 |
> |
next if /^\s*$/; |
472 |
> |
($name, $value)=split /=/; |
473 |
> |
addvar($name, (eval $value)," "); |
474 |
> |
} |
475 |
> |
close SCRAMENV; |
476 |
> |
|
477 |
> |
# create new SCRAMRT history vars. |
478 |
> |
foreach $variable ( keys %EnvRuntime ) { |
479 |
> |
printoutenv($shell,"SCRAMRT_$variable",$EnvRuntime{$variable}); |
480 |
> |
#addvar("SCRAMRT_$variable", $EnvRuntime{$variable}, ""); |
481 |
> |
} |
482 |
> |
# Now adapt as necessary - include base environment as well |
483 |
> |
if ( exists $ENV{LD_LIBRARY_PATH} ) { |
484 |
> |
addpath("LD_LIBRARY_PATH","$ENV{LD_LIBRARY_PATH}"); |
485 |
> |
} |
486 |
> |
if ( exists $ENV{MANPATH} ) { |
487 |
> |
addpath("MANPATH","$ENV{MANPATH}"); |
488 |
> |
} |
489 |
> |
addpath("PATH","$ENV{PATH}"); |
490 |
> |
# Print out as reqd |
491 |
> |
foreach $variable ( keys %EnvRuntime ) { |
492 |
> |
printoutenv($shell,$variable,$EnvRuntime{$variable}); |
493 |
> |
} |
494 |
> |
} |
495 |
> |
} |
496 |
> |
|
497 |
> |
# Support rt for runtime |
498 |
> |
|
499 |
> |
sub _testfile { |
500 |
> |
my @files=@_; |
501 |
> |
|
502 |
> |
my $filename=""; |
503 |
> |
foreach $file ( @files ) { |
504 |
> |
if ( -f $file ) { |
505 |
> |
$filename=$file; |
506 |
> |
last; |
507 |
> |
} |
508 |
> |
} |
509 |
> |
return $filename; |
510 |
> |
} |
511 |
> |
|
512 |
> |
sub _printvardoc { |
513 |
> |
my $runtime=shift; |
514 |
> |
my $var=shift; |
515 |
> |
|
516 |
> |
print $var." :\n"; |
517 |
> |
print $runtime->doc($var); |
518 |
> |
print "\n"; |
519 |
|
} |
520 |
+ |
|
521 |
+ |
sub printoutenv { |
522 |
+ |
my $shell=shift; |
523 |
+ |
my $variable=shift; |
524 |
+ |
my $value=shift; |
525 |
+ |
|
526 |
+ |
if ( $shell eq "csh" ) { |
527 |
+ |
print "setenv $variable \"$value\";\n"; |
528 |
+ |
} |
529 |
+ |
elsif ( $shell eq "sh" ) { |
530 |
+ |
print "$variable=\"$value\";\n"; |
531 |
+ |
print "export $variable;\n"; |
532 |
+ |
} |
533 |
+ |
} |
534 |
+ |
|
535 |
+ |
sub addpath { |
536 |
+ |
my $name=shift; |
537 |
+ |
my $val=shift; |
538 |
+ |
|
539 |
+ |
my $n; |
540 |
+ |
my @env; |
541 |
+ |
@env=split /:/, $EnvRuntime{$name}; |
542 |
+ |
foreach $n ( (split /:/, $val ) ){ |
543 |
+ |
if ( ! grep /^\Q$n\E$/, @env ) { |
544 |
+ |
addvar($name,$n,":"); |
545 |
+ |
} |
546 |
+ |
} |
547 |
+ |
} |
548 |
+ |
|
549 |
+ |
sub addvar { |
550 |
+ |
my $name=shift; |
551 |
+ |
my $val=shift; |
552 |
+ |
my $sep=shift; |
553 |
+ |
|
554 |
+ |
if ( $val ne "" ) { |
555 |
+ |
if ( defined $EnvRuntime{$name} ) { |
556 |
+ |
$EnvRuntime{$name}=$EnvRuntime{$name}.$sep.$val; |
557 |
+ |
} |
558 |
+ |
else { |
559 |
+ |
$EnvRuntime{$name}=$val; |
560 |
+ |
} |
561 |
+ |
} |
562 |
+ |
} |
563 |
+ |
|
564 |
|
sub FullEnvInit { |
565 |
|
environmentinit(); |
566 |
|
localtop(); |
580 |
|
$ENV{INTbin}="bin/$ENV{SCRAM_ARCH}"; |
581 |
|
$ENV{INTlog}="logs"; |
582 |
|
|
583 |
< |
if ( ! ( exists $ENV{SCRAM_HOME}) ){ |
584 |
< |
$ENV{SCRAM_HOME}="/afs/cern.ch/user/w/williamc/public/ConfigMan"; |
79 |
< |
print "Warning : Environment Variable SCRAM_HOME not set.\n"; |
80 |
< |
print "Defaulting to $ENV{SCRAM_HOME}\n"; |
81 |
< |
} |
82 |
< |
if ( ! ( exists $ENV{SCRAM_CONFIG} ) ){ |
583 |
> |
($ENV{SCRAM_BASEDIR}=$ENV{SCRAM_HOME})=~s/(.*)\/.*/$1/; |
584 |
> |
if ( ! ( exists $ENV{SCRAM_CONFIG} ) ){ |
585 |
|
$ENV{SCRAM_CONFIG}="$ENV{SCRAM_HOME}/configuration"; |
586 |
|
} |
587 |
|
if ( ! ( exists $ENV{TOOL_HOME} ) ){ |
588 |
|
$ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src"; |
589 |
|
} |
590 |
|
if ( ! ( exists $ENV{SCRAM_LOOKUPDB} ) ){ |
591 |
< |
$ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_CONFIG}/project.lookup"; |
591 |
> |
if ( -d "$ENV{SCRAM_BASEDIR}/scramdb/" ) { |
592 |
> |
$ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_BASEDIR}/scramdb/project.lookup"; |
593 |
> |
} |
594 |
> |
else { |
595 |
> |
$ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_CONFIG}/project.lookup"; |
596 |
> |
} |
597 |
|
} |
598 |
+ |
$ENV{SCRAM_AVAILDIRS}=""; |
599 |
+ |
$ENV{SCRAM_AVAILFILES}=""; |
600 |
|
} |
601 |
|
|
602 |
< |
sub localtop { |
603 |
< |
# find localtop |
604 |
< |
use Cwd; |
605 |
< |
my $thispath=cwd; |
606 |
< |
block: { |
607 |
< |
do { |
608 |
< |
if ( -e "$thispath/.SCRAM" ) { |
609 |
< |
$ENV{LOCALTOP}=$thispath; |
610 |
< |
last block; |
602 |
> |
sub _localarea { |
603 |
> |
if ( ! defined $self->{localarea} ) { |
604 |
> |
require Configuration::ConfigArea; |
605 |
> |
$self->{localarea}=Configuration::ConfigArea->new(); |
606 |
> |
if ( ! defined $ENV{LOCALTOP} ) { |
607 |
> |
if ( $self->{localarea}->bootstrapfromlocation() ) { |
608 |
> |
# Were not in a local area |
609 |
> |
undef $self->{localarea}; |
610 |
> |
} |
611 |
> |
else { |
612 |
> |
$self->{localarea}->archname(scrambasics()->arch()); |
613 |
> |
} |
614 |
> |
} |
615 |
> |
else { |
616 |
> |
$self->{localarea}->bootstrapfromlocation($ENV{LOCALTOP}); |
617 |
|
} |
618 |
< |
} while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./ ); |
618 |
> |
} |
619 |
> |
return $self->{localarea}; |
620 |
> |
} |
621 |
> |
|
622 |
> |
sub localtop_find { |
623 |
> |
my $rv=1; |
624 |
> |
if ( defined _localarea()) { |
625 |
> |
$rv=0; |
626 |
> |
$ENV{LOCALTOP}=_localarea()->location(); |
627 |
> |
} |
628 |
> |
return $rv; |
629 |
> |
} |
630 |
> |
|
631 |
> |
sub localtop { |
632 |
> |
localtop_find(); |
633 |
|
if ( ! (defined $ENV{LOCALTOP}) ) { |
634 |
|
print "Unable to locate the top of local release. Exiting\n"; |
635 |
< |
exit 1 |
635 |
> |
exit 1; |
636 |
|
} |
637 |
< |
} #end block |
109 |
< |
($ENV{THISDIR}=cwd)=~s/^$ENV{LOCALTOP}//; |
637 |
> |
($ENV{THISDIR}=cwd)=~s/^\Q$ENV{LOCALTOP}\L//; |
638 |
|
$ENV{THISDIR}=~s/^\///; |
111 |
– |
$ENV{SCRAM_WORKDIR}="$ENV{LOCALTOP}/.SCRAM"; |
639 |
|
} |
640 |
|
|
641 |
|
sub LoadEnvFile { |
642 |
< |
open ( SCRAMENV, "<$ENV{SCRAM_WORKDIR}/Environment" ) || |
116 |
< |
die "Cant find Environment file $!\n"; |
117 |
< |
while ( <SCRAMENV> ) { |
118 |
< |
chomp; |
119 |
< |
next if /^#/; |
120 |
< |
next if /^\s*$/ ; |
121 |
< |
($name, $value)=split /=/; |
122 |
< |
eval "\$ENV{${name}}=\"$value\""; |
123 |
< |
} |
124 |
< |
close SCRAMENV; |
642 |
> |
_localarea()->copyenv(\%ENV); |
643 |
|
} |
644 |
|
|
645 |
|
sub env { |
646 |
|
print "Sorry - Not yet\n"; |
647 |
|
} |
648 |
|
|
649 |
+ |
sub devtest { |
650 |
+ |
require Utilities::TestClass; |
651 |
+ |
my $class=shift @ARGV; |
652 |
+ |
|
653 |
+ |
my $tester; |
654 |
+ |
my $path; |
655 |
+ |
|
656 |
+ |
#_initproject(); |
657 |
+ |
if ( $class=~/::/ ) { |
658 |
+ |
($path=$class)=~s/(.*)::.*/$1/; |
659 |
+ |
} |
660 |
+ |
$tester=Utilities::TestClass->new($class, |
661 |
+ |
"$ENV{SCRAM_HOME}/src/$path/test/testdata"); |
662 |
+ |
$tester->dotest(@_); |
663 |
+ |
} |
664 |
+ |
|
665 |
|
# |
666 |
|
# Create a lookup tag in the site database |
667 |
|
# |
668 |
< |
sub install ( $tagname, $version ) { |
669 |
< |
my $tagname=shift @ARGV; |
670 |
< |
my $version=shift @ARGV; |
671 |
< |
|
138 |
< |
# create database entry |
139 |
< |
do { &help_install; } if $tagname=~/help/i; |
140 |
< |
&FullEnvInit; |
141 |
< |
if ( $version eq "" ) { |
142 |
< |
$version=$ENV{SCRAM_PROJVERSION}; |
143 |
< |
} |
144 |
< |
if ( $tagname eq "" ) { |
145 |
< |
$tagname=$ENV{SCRAM_PROJECTNAME}; |
146 |
< |
} |
147 |
< |
my $filename="$ENV{SCRAM_CONFIG}/project.lookup"; |
148 |
< |
my $outfile="$ENV{SCRAM_CONFIG}/project.lookup.tmp"; |
149 |
< |
open ( LOCALLOOKUPDB, "<$filename" ); |
150 |
< |
open ( OUTFILE , ">$outfile" ); |
151 |
< |
while ( <LOCALLOOKUPDB> ) { |
152 |
< |
if ( /^$tagname/ ) { |
153 |
< |
print "Related tag :".$_."\n"; |
154 |
< |
if ( /$version/) { |
155 |
< |
print "$tagname $version already exists. Overwrite (y/n)\n"; |
156 |
< |
if ( ! (<STDIN>=~/y/i ) ) { |
157 |
< |
print "Aborting install ...\n"; |
158 |
< |
close OUTFILE; |
159 |
< |
close LOCALLOOKUPDB; |
160 |
< |
exit 1; |
161 |
< |
} |
162 |
< |
} |
163 |
< |
else { |
164 |
< |
print OUTFILE $_; |
165 |
< |
} |
166 |
< |
} |
167 |
< |
else { |
168 |
< |
print OUTFILE $_; |
169 |
< |
} |
170 |
< |
} |
171 |
< |
print OUTFILE "$tagname:$version:file:$ENV{LOCALTOP}". |
172 |
< |
"/.SCRAM/InstallFile\n"; |
173 |
< |
close OUTFILE; |
174 |
< |
close LOCALLOOKUPDB; |
175 |
< |
copy ( "$outfile", "$filename" ) |
176 |
< |
|| die "Unable to copy $! \n"; |
177 |
< |
|
668 |
> |
sub install { |
669 |
> |
localtop(); |
670 |
> |
scrambasics()->addareatoDB(_localarea(),@ARGV); |
671 |
> |
_localarea()->align(); |
672 |
|
} |
673 |
|
|
674 |
|
sub help_install() { |
675 |
|
|
182 |
– |
helpheader("install"); |
676 |
|
print <<ENDTEXT; |
677 |
|
Associates a label with the current release in the SCRAM database. |
678 |
|
This allows other users to refer to a centrally installed project by |
680 |
|
|
681 |
|
Usage: |
682 |
|
|
683 |
< |
scram install [[label] [version]] |
683 |
> |
$bold scram install $normal [project_tag [version_tag]] |
684 |
|
|
685 |
< |
label : override default label (the project name of the current release) |
686 |
< |
version : the version tag of the current release. If version is not |
685 |
> |
porject_tag : override default label (the project name of the current release) |
686 |
> |
version_tag : the version tag of the current release. If version is not |
687 |
|
specified the base release version will be taken by default. |
688 |
|
|
689 |
|
ENDTEXT |
197 |
– |
exit; |
690 |
|
} |
691 |
|
|
692 |
|
sub helpheader ($label) { |
698 |
|
ENDTEXT |
699 |
|
} |
700 |
|
|
701 |
+ |
sub getversion { |
702 |
+ |
($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///; |
703 |
+ |
$scram_top=$1; |
704 |
+ |
$scram_version=$thisversion; |
705 |
+ |
# deal with links |
706 |
+ |
my $version=readlink $ENV{SCRAM_HOME}; |
707 |
+ |
if ( defined $version) { |
708 |
+ |
$scram_version=$version; |
709 |
+ |
} |
710 |
+ |
return $scram_version; |
711 |
+ |
} |
712 |
+ |
|
713 |
|
sub version { |
714 |
< |
print "Scram version : prototype\n"; |
714 |
> |
my $version=shift @ARGV; |
715 |
> |
my $thisversion; |
716 |
> |
my $scram_top; |
717 |
> |
my $cvsobject; |
718 |
> |
|
719 |
> |
($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///; |
720 |
> |
$scram_top=$1; |
721 |
> |
if ( $version eq "" ) { |
722 |
> |
print "$thisversion"; |
723 |
> |
# deal with links |
724 |
> |
$version=readlink $ENV{SCRAM_HOME}; |
725 |
> |
if ( defined $version) { |
726 |
> |
print " ---> $version"; |
727 |
> |
} |
728 |
> |
print "\n"; |
729 |
> |
} |
730 |
> |
else { |
731 |
> |
if ( -d $scram_top."/".$version ) { |
732 |
> |
print "Version $version exists\n"; |
733 |
> |
} |
734 |
> |
else { |
735 |
> |
print "Version $version not available locally\n"; |
736 |
> |
print "Attempting download from the SCRAM repository\n"; |
737 |
> |
# set up and configure the cvs module for SCRAM |
738 |
> |
use Utilities::CVSmodule; |
739 |
> |
$cvsobject=Utilities::CVSmodule->new(); |
740 |
> |
$cvsobject->set_base( |
741 |
> |
"cmscvs.cern.ch:/cvs_server/repositories/SCRAM"); |
742 |
> |
$cvsobject->set_auth("pserver"); |
743 |
> |
$cvsobject->set_user("anonymous"); |
744 |
> |
$cvsobject->set_passkey("AA_:yZZ3e"); |
745 |
> |
# Now check it out in the right place |
746 |
> |
chdir $scram_top or die "Unable to change to $scram_top $!\n"; |
747 |
> |
$cvsobject->invokecvs( ( split / /, |
748 |
> |
"co -d $version -r $version SCRAM" )); |
749 |
> |
|
750 |
> |
# Get rid of cvs object now weve finished |
751 |
> |
$cvsobject=undef; |
752 |
> |
print "\n"; |
753 |
> |
} |
754 |
> |
} |
755 |
> |
0; |
756 |
|
} |
757 |
|
|
758 |
|
sub list { |
759 |
|
&environmentinit; |
760 |
< |
my $filename="$ENV{SCRAM_CONFIG}/project.lookup"; |
761 |
< |
open ( LOCALLOOKUPDB, "<$filename" ); |
760 |
> |
my $filename="$ENV{SCRAM_LOOKUPDB}"; |
761 |
> |
if ( ! -f $ENV{SCRAM_LOOKUPDB} ) { |
762 |
> |
print "No installation database available - perhaps no projects". |
763 |
> |
" have been installed locally\n"; |
764 |
> |
exit 1; |
765 |
> |
} |
766 |
|
print "Installed Projects\n"; |
767 |
|
print "------------------\n"; |
768 |
|
print "|Project Name | Project Version |\n"; |
769 |
|
print "----------------------------------\n"; |
770 |
< |
while ( <LOCALLOOKUPDB> ) { |
771 |
< |
( $name, $version, $type, $url ) = split ":", $_; |
770 |
> |
listdb($filename); |
771 |
> |
} |
772 |
> |
|
773 |
> |
sub db { |
774 |
> |
my $subcmd=shift @ARGV; |
775 |
> |
&environmentinit; |
776 |
> |
|
777 |
> |
switch : { |
778 |
> |
if ( $subcmd eq 'link' ) { |
779 |
> |
dblink($ENV{SCRAM_LOOKUPDB},@ARGV); |
780 |
> |
last switch; |
781 |
> |
} |
782 |
> |
if ( ! -f $ENV{SCRAM_LOOKUPDB} ) { |
783 |
> |
print "No installation database available - perhaps no projects". |
784 |
> |
"have been installed locally\n"; |
785 |
> |
exit 1; |
786 |
> |
} |
787 |
> |
if ( $subcmd eq 'unlink' ) { |
788 |
> |
dbunlink($ENV{SCRAM_LOOKUPDB},@ARGV); |
789 |
> |
last switch; |
790 |
> |
} |
791 |
> |
if ( $subcmd eq 'showlinks' ) { |
792 |
> |
dblinklist($ENV{SCRAM_LOOKUPDB}); |
793 |
> |
last switch; |
794 |
> |
} |
795 |
> |
} # end switch |
796 |
> |
|
797 |
> |
} |
798 |
> |
|
799 |
> |
sub dblinklist { |
800 |
> |
my $filename=shift; |
801 |
> |
open (LOCALLOOKUPDB, "<$filename") or |
802 |
> |
die "Unable to open local database $!"; |
803 |
> |
while (<LOCALLOOKUPDB>) { |
804 |
> |
if ( $_=~/\!DB (.*)/) { |
805 |
> |
print $1,"\n"; |
806 |
> |
} |
807 |
> |
} |
808 |
> |
close LOCALLOOKUPDB; |
809 |
> |
} |
810 |
> |
|
811 |
> |
sub dblink { |
812 |
> |
my $filename=shift; |
813 |
> |
my $newdbfilename=shift; |
814 |
> |
my $exists=0; |
815 |
> |
|
816 |
> |
if ( -e $filename ) { |
817 |
> |
if ( -e $newdbfilename ) { |
818 |
> |
# Check if its already there |
819 |
> |
open (LOCALLOOKUPDB, "<$filename") or |
820 |
> |
die "Unable to open local database $!"; |
821 |
> |
while (<LOCALLOOKUPDB>) { |
822 |
> |
if ( $_=~/\!DB $newdbfilename/ ) { |
823 |
> |
$exists=1; |
824 |
> |
last; |
825 |
> |
} |
826 |
> |
} |
827 |
> |
close LOCALLOOKUPDB; |
828 |
> |
# Add it |
829 |
> |
if ( ! $exists ) { |
830 |
> |
open (LOCALLOOKUPDB, ">>$filename") or |
831 |
> |
die "Unable to open local database $!"; |
832 |
> |
print LOCALLOOKUPDB "\!DB $newdbfilename\n"; |
833 |
> |
close LOCALLOOKUPDB; |
834 |
> |
} |
835 |
> |
} |
836 |
> |
else { |
837 |
> |
print "Unknown file $newdbfilename\n"; |
838 |
> |
exit 1; |
839 |
> |
} |
840 |
> |
} |
841 |
> |
else { |
842 |
> |
print "Unknown file $filename $!\n"; |
843 |
> |
exit 1; |
844 |
> |
} |
845 |
> |
|
846 |
> |
} |
847 |
> |
|
848 |
> |
sub dbunlink { |
849 |
> |
my $filename=shift; |
850 |
> |
my $dbfilename=shift; |
851 |
> |
if ( -e $filename ) { |
852 |
> |
# Check if its already there |
853 |
> |
open (LOCALLOOKUPDB, "<$filename") or |
854 |
> |
die "Unable to open local database $!"; |
855 |
> |
open (DBOUTFILE, ">$filename.tmp") or |
856 |
> |
die "Unable to open working file $!"; |
857 |
> |
while (<LOCALLOOKUPDB>) { |
858 |
> |
if ( $_!~/\!DB $dbfilename/ ) { |
859 |
> |
print DBOUTFILE $_; |
860 |
> |
} |
861 |
> |
} |
862 |
> |
close LOCALLOOKUPDB; |
863 |
> |
close DBOUTFILE; |
864 |
> |
use File::Copy; |
865 |
> |
rename "$filename.tmp", $filename; |
866 |
> |
} |
867 |
> |
} |
868 |
> |
|
869 |
> |
sub listdb { |
870 |
> |
my $filename=shift; |
871 |
> |
my $map; |
872 |
> |
|
873 |
> |
use FileHandle; |
874 |
> |
my $fh=FileHandle->new(); |
875 |
> |
open ( $fh, "<$filename" ); |
876 |
> |
while ( $map=<$fh> ) { |
877 |
> |
if ( $map=~/^\!DB (.*)/ ) { # Check for other DB files |
878 |
> |
my $db=$1; |
879 |
> |
if ( -f $db ) { |
880 |
> |
listdb($db); |
881 |
> |
} |
882 |
> |
next; |
883 |
> |
} |
884 |
> |
( $name, $version, $type, $url ) = split ":", $map; |
885 |
|
printf "%1s",$name; |
886 |
|
printf "%25s\n",$version; |
887 |
|
printf "--> %25s\n",$type.":".$url; |
888 |
|
} |
889 |
< |
close LOCALLOOKUPDB; |
889 |
> |
close $fh; |
890 |
> |
0; |
891 |
|
} |
892 |
|
|
893 |
|
sub arch { |
894 |
|
&environmentinit(); |
895 |
|
print "$ENV{SCRAM_ARCH}\n"; |
896 |
|
} |
897 |
+ |
|
898 |
+ |
|
899 |
+ |
# |
900 |
+ |
# Setup a new tool |
901 |
+ |
# |
902 |
+ |
|
903 |
+ |
sub setup { |
904 |
+ |
my $interactive=0; |
905 |
+ |
|
906 |
+ |
# process options |
907 |
+ |
while ( $ARGV[0]=~"^-" ) { |
908 |
+ |
if ( $ARGV[0]=~/-i/ ) { |
909 |
+ |
shift @ARGV; |
910 |
+ |
$interactive=1; |
911 |
+ |
} |
912 |
+ |
else { |
913 |
+ |
error("scram: unknown option $ARGV[0] to project command"); |
914 |
+ |
} |
915 |
+ |
} |
916 |
+ |
|
917 |
+ |
localtop(); |
918 |
+ |
my $area=_localarea(); |
919 |
+ |
my $toolname=shift @ARGV; |
920 |
+ |
my $insert=0; |
921 |
+ |
toolbox()->interactive($interactive); |
922 |
+ |
|
923 |
+ |
# If no toolname specified then its a full setup |
924 |
+ |
if ( $toolname eq "" ) { |
925 |
+ |
# -- add architecture specific directories |
926 |
+ |
use Utilities::AddDir; |
927 |
+ |
AddDir::adddir($area->location()."/lib/$ENV{SCRAM_ARCH}"); |
928 |
+ |
AddDir::adddir($area->location()."/bin/$ENV{SCRAM_ARCH}"); |
929 |
+ |
|
930 |
+ |
# -- check the releasetop area |
931 |
+ |
# if the releasetop has the files copy them |
932 |
+ |
my $releaseobj=_releasearea(); |
933 |
+ |
if ( $releaseobj->copysetup($ENV{LOCALTOP}) ) { |
934 |
+ |
print "Doing Full Setup\n"; |
935 |
+ |
scrambasics()->setuptoolsinarea($area); |
936 |
+ |
} |
937 |
+ |
} |
938 |
+ |
else { |
939 |
+ |
scrambasics()->setuptoolsinarea($area, $toolname,@ARGV); |
940 |
+ |
} |
941 |
+ |
} |
942 |
+ |
|
943 |
+ |
sub _releasearea { |
944 |
+ |
if ( !defined $self->{releasearea} ) { |
945 |
+ |
require Configuration::ConfigArea; |
946 |
+ |
$self->{releasearea}=Configuration::ConfigArea->new(); |
947 |
+ |
$self->{releasearea}->bootstrapfromlocation($ENV{RELEASETOP}); |
948 |
+ |
} |
949 |
+ |
return $self->{releasearea}; |
950 |
+ |
} |
951 |
+ |
|
952 |
+ |
# get a toolbox object for the local area |
953 |
+ |
sub toolbox { |
954 |
+ |
if ( ! defined $toolbox ) { |
955 |
+ |
localtop(); |
956 |
+ |
my $area=_localarea(); |
957 |
+ |
$toolbox=scrambasics()->areatoolbox($area); |
958 |
+ |
} |
959 |
+ |
return $toolbox; |
960 |
+ |
} |
961 |
+ |
|
962 |
+ |
sub help_db { |
963 |
+ |
print <<ENDTEXT; |
964 |
+ |
scram database administration command. |
965 |
+ |
|
966 |
+ |
Usage: |
967 |
+ |
|
968 |
+ |
$bold scram db $normal subcommand |
969 |
+ |
|
970 |
+ |
subcommands: |
971 |
+ |
link : |
972 |
+ |
Make available an additional database for |
973 |
+ |
project and list operations |
974 |
+ |
|
975 |
+ |
$bold scram db link $normal /a/directory/path/project.lookup |
976 |
+ |
|
977 |
+ |
unlink : |
978 |
+ |
Remove a database from the link list. Note this does |
979 |
+ |
not remove the database, just the link to it in scram. |
980 |
+ |
|
981 |
+ |
$bold scram db unlink $normal /a/directory/path/project.lookup |
982 |
+ |
|
983 |
+ |
showlinks : |
984 |
+ |
List the databases that are linked in |
985 |
+ |
|
986 |
+ |
ENDTEXT |
987 |
+ |
} |
988 |
+ |
|
989 |
+ |
sub help_setup { |
990 |
+ |
|
991 |
+ |
print <<ENDTEXT; |
992 |
+ |
Allows installation/re-installation of a new tool/external package into an |
993 |
+ |
already existing development area. If not toolname is specified, |
994 |
+ |
the complete installation process is initiated. |
995 |
+ |
|
996 |
+ |
Usage: |
997 |
+ |
|
998 |
+ |
$bold scram setup [-i]$normal [toolname] [[version] [url]] |
999 |
+ |
|
1000 |
+ |
toolname : The name of the tool setup file required. |
1001 |
+ |
version : where more than one version exists specify the version |
1002 |
+ |
url : when setting up a completely new tool specify the url too |
1003 |
+ |
|
1004 |
+ |
The -i option turns off the automatic search mechanism allowing for more |
1005 |
+ |
user interaction with the setup mechanism |
1006 |
+ |
ENDTEXT |
1007 |
+ |
} |
1008 |
+ |
|
1009 |
+ |
sub help_list { |
1010 |
+ |
print <<ENDTEXT; |
1011 |
+ |
List the available projects and versions installed in the local SCRAM database |
1012 |
+ |
(see scram install help) |
1013 |
+ |
|
1014 |
+ |
Usage: |
1015 |
+ |
|
1016 |
+ |
$bold scram list $normal |
1017 |
+ |
|
1018 |
+ |
ENDTEXT |
1019 |
+ |
} |
1020 |
+ |
|
1021 |
+ |
sub help_project { |
1022 |
+ |
print <<ENDTEXT; |
1023 |
+ |
Setup a new project development area. The new area will appear in the current |
1024 |
+ |
working directory. |
1025 |
+ |
Usage: |
1026 |
+ |
|
1027 |
+ |
$bold scram project [-d install_area] [-n directory_name]$normal project_url [project_version] |
1028 |
+ |
|
1029 |
+ |
Options: |
1030 |
+ |
|
1031 |
+ |
project_url: The url of a scram bootstrap file. |
1032 |
+ |
Currently supported types are: |
1033 |
+ |
$bold Database label $normal |
1034 |
+ |
Labels can be assigned to bootstrap files for easy |
1035 |
+ |
access (See "scram install" command). If you |
1036 |
+ |
specify a label you must also specify a project_version. |
1037 |
+ |
e.g. |
1038 |
+ |
|
1039 |
+ |
scram project SCRAM V1_0 |
1040 |
+ |
|
1041 |
+ |
scram project ORCA ORCA_1_1_1 |
1042 |
+ |
|
1043 |
+ |
To see the list of installed projects use the |
1044 |
+ |
"scram list" command. |
1045 |
+ |
|
1046 |
+ |
$bold file: $normal A regular file on an accessable file system |
1047 |
+ |
e.g. |
1048 |
+ |
|
1049 |
+ |
file:~/myprojects/projecta/config/BootStrapFile |
1050 |
+ |
|
1051 |
+ |
project_version: |
1052 |
+ |
Only for use with a database label |
1053 |
+ |
|
1054 |
+ |
-d install_area: |
1055 |
+ |
Indicate a project installation area into which the new |
1056 |
+ |
project area should appear. Default is the current working |
1057 |
+ |
directory. |
1058 |
+ |
|
1059 |
+ |
-n directory_name: |
1060 |
+ |
Specify the name of the SCRAM development area you wish to |
1061 |
+ |
create. |
1062 |
+ |
|
1063 |
+ |
ENDTEXT |
1064 |
+ |
} |
1065 |
+ |
|
1066 |
+ |
sub help_version { |
1067 |
+ |
print <<ENDTEXT; |
1068 |
+ |
With now $bold [version] $normal argument given, this command will simply |
1069 |
+ |
print to standard output the current version number. |
1070 |
+ |
|
1071 |
+ |
Providing a version argument will cause that version to be downloaded and |
1072 |
+ |
installed, if not already locally available. |
1073 |
+ |
|
1074 |
+ |
|
1075 |
+ |
Usage: |
1076 |
+ |
$bold scram version [version]$normal |
1077 |
+ |
|
1078 |
+ |
ENDTEXT |
1079 |
+ |
} |
1080 |
+ |
|
1081 |
+ |
sub help_arch { |
1082 |
+ |
print <<ENDTEXT; |
1083 |
+ |
Print out the architecture flag for the current machine. |
1084 |
+ |
|
1085 |
+ |
Usage: |
1086 |
+ |
$bold scram arch $normal |
1087 |
+ |
ENDTEXT |
1088 |
+ |
} |
1089 |
+ |
|
1090 |
+ |
sub help_runtime { |
1091 |
+ |
print <<ENDTEXT; |
1092 |
+ |
Echo to Standard Output the Runtime Environment for the current development area |
1093 |
+ |
Output available in csh or sh flavours |
1094 |
+ |
|
1095 |
+ |
Usage: |
1096 |
+ |
1) $bold scram runtime [-csh|-sh] $normal |
1097 |
+ |
or |
1098 |
+ |
2) $bold scram runtime [-csh|-sh] filename $normal |
1099 |
+ |
or |
1100 |
+ |
3) $bold scram runtime info filename [variable]$normal |
1101 |
+ |
|
1102 |
+ |
1) For the general configuration environment |
1103 |
+ |
2) For environment described in filename or |
1104 |
+ |
areatop/src/directory/BuildFile |
1105 |
+ |
3) Display information concerning the environment in the given file |
1106 |
+ |
(limited to variable if specified) |
1107 |
+ |
|
1108 |
+ |
The file for cases 2) and 3) are searched as follows : |
1109 |
+ |
a) straightforward filename |
1110 |
+ |
b) filename relative to local_area/src |
1111 |
+ |
c) filename relative to release_area/src |
1112 |
+ |
d) BuildFile relative to local_area/src |
1113 |
+ |
e) BuildFile relative to release_area/src |
1114 |
+ |
|
1115 |
+ |
Examples: |
1116 |
+ |
|
1117 |
+ |
Setup the current environment to include the project Runtime Environment |
1118 |
+ |
in a csh environment |
1119 |
+ |
|
1120 |
+ |
$bold eval `scram runtime -csh` $normal |
1121 |
+ |
|
1122 |
+ |
Setup the current environment to include the project Runtime Environment in a |
1123 |
+ |
sh environment |
1124 |
+ |
|
1125 |
+ |
$bold eval `scram runtime -sh` $normal |
1126 |
+ |
|
1127 |
+ |
|
1128 |
+ |
ENDTEXT |
1129 |
+ |
} |