23 |
|
# interactive(0|1) : set the setup mode |
24 |
|
# searcher(SearchObject) : Set the search object for matching tools during setup |
25 |
|
# copytools(ToolBox) : copy tools from this to the supplied toolbox |
26 |
+ |
# toolmakefile(name,version) : Return the location of the tool makefile |
27 |
|
|
28 |
|
package BuildSystem::ToolBox; |
29 |
|
use FileHandle; |
53 |
|
my $config=$top."/".$area->configurationdir(); |
54 |
|
|
55 |
|
my $cache=$area->cache(); |
56 |
< |
if ( defined $cache ) { |
57 |
< |
$self->{urlhandler}=URL::URLhandler->new($cache); |
58 |
< |
} |
56 |
> |
if ( defined $cache ) { |
57 |
> |
$self->{urlhandler}=URL::URLhandler->new($cache); |
58 |
> |
} |
59 |
|
$self->{toolfiledir}="$top/.SCRAM/ToolFiles"; |
60 |
|
$self->{datastore}=$top."/.SCRAM/".$self->{arch}; |
61 |
|
#$self->{datastore}=$area->archdir(); |
68 |
|
# do we have toolfile dir and no admin? if so maybe its an old |
69 |
|
# area and we can attempt to get something from the filenames |
70 |
|
if ( -d $self->{datastore} ) { |
71 |
< |
my $dh=FileHandle->new(); |
71 |
> |
my $dh=DirHandle->new(); |
72 |
|
opendir $dh, $self->{datastore}; |
73 |
|
my @files=grep /.*_.*/, readdir $dh; |
74 |
|
undef $dh; |
146 |
|
} |
147 |
|
$doc->interactive($self->interactive()); |
148 |
|
$tool->reset(); |
149 |
< |
if ( ! $doc->setup($filename,$name,$version) ) { |
149 |
> |
if ( ! $doc->setup($filename,$name,$version,$self) ) { |
150 |
|
$tool->store($self->_toolfile($name,$version)); |
151 |
|
# -- keep an internal record of the tool |
152 |
|
$name=~tr[A-Z][a-z]; |
232 |
|
return undef, if ( ! defined $version ); |
233 |
|
} |
234 |
|
my ($tool,$rv)=$self->_toolobject($product,$version); |
235 |
+ |
if ( $rv != 0 ) { |
236 |
+ |
delete $self->{tools}{$product}{$version}; |
237 |
+ |
} |
238 |
|
return ( $rv==0?$tool:undef ); # only return if already set up |
239 |
|
} |
240 |
|
|
245 |
|
return $self->{defaults}{$product}; |
246 |
|
} |
247 |
|
|
248 |
+ |
sub toolmakefile { |
249 |
+ |
my $self=shift; |
250 |
+ |
my $name=shift; |
251 |
+ |
my $version=shift; |
252 |
+ |
|
253 |
+ |
$name=~tr[A-Z][a-z]; |
254 |
+ |
return $self->{datastore}."/".$name."_$version.mk"; |
255 |
+ |
} |
256 |
+ |
|
257 |
|
sub _toolfile { |
258 |
|
my $self=shift; |
259 |
|
my $name=shift; |
358 |
|
my $rv=0; |
359 |
|
|
360 |
|
if ( ! exists $self->{tools}{$product}{$version} ) { |
361 |
< |
$self->verbose("$product $version being Intitialised"); |
361 |
> |
$self->verbose("$product $version being Initialised"); |
362 |
|
$self->{tools}{$product}{$version}=BuildSystem::Tool->new(); |
363 |
|
my $file=$self->_toolfile($product,$version); |
364 |
|
if ( -f $file ) { # restore it from disk |