19 |
|
# setuptoolsinarea($area[,$toolname[,$toolversion[,toolfile]) : setup |
20 |
|
# arch() : get/set the architecture string |
21 |
|
# scramobjectinterface(Class) : print out the interface of a scram class |
22 |
< |
# webget(area,url) : get the url into the cache of the specified area |
22 |
> |
# webget(area,url) : get the url into the cache of the specified area |
23 |
|
# getversion() : return the current scram version |
24 |
|
# spawnversion(version,@args) : spawn the scram version with the given args |
25 |
+ |
# classverbose(classstring,setting) : Set the class verbosity level |
26 |
+ |
# toolruntime(ConfigArea): Get a runtime object withthe settings from |
27 |
+ |
# the specified toolbox |
28 |
|
|
29 |
|
package Scram::ScramFunctions; |
30 |
|
use URL::URLcache; |
28 |
– |
use URL::URLhandler; |
31 |
|
use Utilities::Verbose; |
32 |
|
require 5.004; |
33 |
|
|
45 |
|
return $self; |
46 |
|
} |
47 |
|
|
48 |
+ |
sub classverbose { |
49 |
+ |
my $self=shift; |
50 |
+ |
my $class=shift; |
51 |
+ |
my $val=shift; |
52 |
+ |
|
53 |
+ |
$ENV{"VERBOSE_".$class}=$val; |
54 |
+ |
} |
55 |
+ |
|
56 |
|
sub project { |
57 |
|
my $self=shift; |
58 |
|
my $url=shift; |
90 |
|
|
91 |
|
# -- create a new toolbox object |
92 |
|
my $toolbox=$self->areatoolbox($area); |
93 |
< |
$toolbox->searcher($self->_projsearcher()); |
93 |
> |
$toolbox->searcher($self->_allprojectinitsearcher()); |
94 |
|
|
95 |
|
if ( @_ ) { |
96 |
|
# -- specific tool specified |
159 |
|
return $area; |
160 |
|
} |
161 |
|
|
162 |
< |
sub webget { |
162 |
> |
sub toolruntime { |
163 |
|
my $self=shift; |
164 |
|
my $area=shift; |
155 |
– |
my $url=shift; |
165 |
|
|
166 |
< |
my $handler=URL::URLhandler->new($area->cache()); |
167 |
< |
return ($handler->get($url)); |
166 |
> |
my $name=$area->location(); |
167 |
> |
if ( ! defined $self->{toolruntime}{$name} ) { |
168 |
> |
require Runtime; |
169 |
> |
my $toolbox=$self->areatoolbox($area); |
170 |
> |
$self->{toolruntime}{$name}=Runtime->new(); |
171 |
> |
|
172 |
> |
# -- add scram area specific runtimes |
173 |
> |
$self->{toolruntime}{$name}->addvar("LD_LIBRARY_PATH", |
174 |
> |
$area->location()."/lib/".$self->arch(),"path"); |
175 |
> |
$self->{toolruntime}{$name}->addvar("PATH", |
176 |
> |
$area->location()."/bin/".$self->arch(),"path"); |
177 |
> |
if ( defined $area->linkarea() ) { |
178 |
> |
my $reltop=$area->linkarea()->location(); |
179 |
> |
$self->{toolruntime}{$name}->addvar("LD_LIBRARY_PATH", |
180 |
> |
$reltop."/lib/".$self->arch(),"path"); |
181 |
> |
$self->{toolruntime}{$name}->addvar("PATH", |
182 |
> |
$reltop."/bin/".$self->arch(),"path"); |
183 |
> |
} |
184 |
> |
|
185 |
> |
# -- get the runtime environment from all the tools |
186 |
> |
my $tool; |
187 |
> |
foreach $toolname ( $toolbox->tools() ) { |
188 |
> |
$tool=$toolbox->gettool($toolname); |
189 |
> |
if ( defined $tool ) { |
190 |
> |
# -- get runtime paths |
191 |
> |
foreach $f ( $tool->listtype("runtime_path")) { |
192 |
> |
foreach $val ( $tool->getfeature($f) ) { |
193 |
> |
$self->{toolruntime}{$name}->addvar($f,$val,"path"); |
194 |
> |
} |
195 |
> |
} |
196 |
> |
# -- get runtime vars |
197 |
> |
foreach $f ( $tool->listtype("runtime")) { |
198 |
> |
foreach $val ( $tool->getfeature($f) ) { |
199 |
> |
$self->{toolruntime}{$name}->addvar($f,$val); |
200 |
> |
} |
201 |
> |
} |
202 |
> |
} |
203 |
> |
} |
204 |
> |
|
205 |
> |
# -- Get the project level environment |
206 |
> |
my $runtimefile=$area->location()."/".$area->configurationdir() |
207 |
> |
."/Runtime"; |
208 |
> |
if ( -f $runtimefile ) { |
209 |
> |
$self->{toolruntime}{$name}->file($runtimefile); |
210 |
> |
} |
211 |
> |
} |
212 |
> |
return $self->{toolruntime}{$name}; |
213 |
> |
} |
214 |
> |
|
215 |
> |
sub webget { |
216 |
> |
my $self=shift; |
217 |
> |
my $area=shift; |
218 |
> |
my $url=shift; |
219 |
> |
|
220 |
> |
require URL::URLhandler; |
221 |
> |
my $handler=URL::URLhandler->new($area->cache()); |
222 |
> |
return ($handler->download($url)); |
223 |
|
} |
224 |
|
|
225 |
|
sub addareatoDB { |
361 |
|
} |
362 |
|
|
363 |
|
sub scramobjectinterface { |
364 |
< |
my $self=shift; |
365 |
< |
my $class=shift; |
364 |
> |
my $self=shift; |
365 |
> |
my $class=shift; |
366 |
|
|
367 |
< |
my $file; |
368 |
< |
($file=$class."\.pm")=~s/::/\//g; |
369 |
< |
$file=$ENV{TOOL_HOME}."/".$file; |
367 |
> |
my $file; |
368 |
> |
($file=$class."\.pm")=~s/::/\//g; |
369 |
> |
$file=$ENV{TOOL_HOME}."/".$file; |
370 |
|
|
371 |
< |
if ( ! -f $file ) { |
372 |
< |
$self->error("Unable to find $class in ".$ENV{TOOL_HOME}); |
373 |
< |
} |
374 |
< |
print "--------------------- $class ------------------\n"; |
375 |
< |
my $fh=FileHandle->new(); |
371 |
> |
if ( ! -f $file ) { |
372 |
> |
$self->error("Unable to find $class in ".$ENV{TOOL_HOME}); |
373 |
> |
} |
374 |
> |
print "--------------------- $class ------------------\n"; |
375 |
> |
my $fh=FileHandle->new(); |
376 |
|
$fh->open("<$file"); |
377 |
|
while ( <$fh> ) { |
378 |
|
if ( $_=~/#\s*Interface/g ) { |
396 |
|
} |
397 |
|
} |
398 |
|
print "\n"; |
399 |
< |
undef $fh; |
399 |
> |
undef $fh; |
400 |
|
} |
401 |
|
|
402 |
|
# -------------- Support Routines ------------------------------ |
409 |
|
$search->addproject($$proj[0],$$proj[1]); |
410 |
|
} |
411 |
|
} |
412 |
+ |
return $self->{projsearcher}; |
413 |
|
} |
414 |
|
|
415 |
|
sub _projsearcher { |