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