1 |
sashby |
1.2 |
#____________________________________________________________________
|
2 |
|
|
# File: ToolManager.pm
|
3 |
|
|
#____________________________________________________________________
|
4 |
|
|
#
|
5 |
|
|
# Author: Shaun Ashby <Shaun.Ashby@cern.ch>
|
6 |
|
|
# Update: 2003-11-12 15:04:16+0100
|
7 |
sashby |
1.7 |
# Revision: $Id: ToolManager.pm,v 1.6 2005/04/06 18:10:33 sashby Exp $
|
8 |
sashby |
1.2 |
#
|
9 |
|
|
# Copyright: 2003 (C) Shaun Ashby
|
10 |
|
|
#
|
11 |
|
|
#--------------------------------------------------------------------
|
12 |
|
|
package BuildSystem::ToolManager;
|
13 |
|
|
require 5.004;
|
14 |
|
|
|
15 |
|
|
use Exporter;
|
16 |
|
|
use BuildSystem::ToolCache;
|
17 |
|
|
use BuildSystem::ToolParser;
|
18 |
|
|
use Utilities::AddDir;
|
19 |
|
|
use URL::URLhandler;
|
20 |
|
|
use Utilities::Verbose;
|
21 |
|
|
|
22 |
|
|
@ISA=qw(BuildSystem::ToolCache Utilities::Verbose);
|
23 |
|
|
@EXPORT_OK=qw( );
|
24 |
|
|
#
|
25 |
|
|
#
|
26 |
|
|
sub new
|
27 |
|
|
###############################################################
|
28 |
|
|
# new #
|
29 |
|
|
###############################################################
|
30 |
|
|
# modified : Wed Nov 12 10:34:10 2003 / SFA #
|
31 |
|
|
# params : #
|
32 |
|
|
# : #
|
33 |
|
|
# function : #
|
34 |
|
|
# : #
|
35 |
|
|
###############################################################
|
36 |
|
|
{
|
37 |
|
|
my $proto=shift;
|
38 |
|
|
my $class=ref($proto) || $proto;
|
39 |
|
|
my $self=$class->SUPER::new(); # Inherit from ToolCache
|
40 |
|
|
my $projectarea=shift;
|
41 |
|
|
|
42 |
|
|
bless $self,$class;
|
43 |
|
|
|
44 |
|
|
$self->{arch}=shift;
|
45 |
|
|
$self->{topdir}=$projectarea->location();
|
46 |
|
|
$self->{configdir}=$self->{topdir}."/".$projectarea->configurationdir();
|
47 |
|
|
$self->{cache}=$projectarea->cache(); # Download tool cache
|
48 |
|
|
$self->{toolfiledir}=$self->{topdir}."/.SCRAM/InstalledTools";
|
49 |
|
|
$self->{datastore}=$self->{topdir}."/.SCRAM";
|
50 |
|
|
$self->{archstore}=$self->{topdir}."/.SCRAM/".$ENV{SCRAM_ARCH};
|
51 |
|
|
|
52 |
|
|
# Make sure our tool download dir exists:
|
53 |
|
|
AddDir::adddir($self->{toolfiledir});
|
54 |
|
|
AddDir::adddir($self->{archstore});
|
55 |
|
|
|
56 |
|
|
# Set the tool cache file to read/write:
|
57 |
|
|
$self->name($projectarea->toolcachename());
|
58 |
|
|
|
59 |
|
|
# Check for the downloaded tools cache:
|
60 |
|
|
if (exists($self->{cache}))
|
61 |
|
|
{
|
62 |
|
|
$self->{urlhandler}=URL::URLhandler->new($self->{cache});
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
return $self;
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
sub clone()
|
69 |
|
|
{
|
70 |
|
|
my $self=shift;
|
71 |
|
|
my $projectarea=shift;
|
72 |
sashby |
1.3 |
|
73 |
sashby |
1.2 |
# Change cache settings to reflect the new location:
|
74 |
|
|
$self->{topdir}=$projectarea->location();
|
75 |
|
|
|
76 |
|
|
$self->{configdir}=$self->{topdir}."/".$projectarea->configurationdir();
|
77 |
|
|
$self->{toolfiledir}=$self->{topdir}."/.SCRAM/InstalledTools";
|
78 |
|
|
$self->{datastore}=$self->{topdir}."/.SCRAM";
|
79 |
|
|
$self->{archstore}=$self->{topdir}."/.SCRAM/".$ENV{SCRAM_ARCH};
|
80 |
|
|
|
81 |
|
|
# Change the cache name:
|
82 |
|
|
$self->name($projectarea->toolcachename());
|
83 |
|
|
$self->cloned_tm(1);
|
84 |
|
|
|
85 |
|
|
return $self;
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
sub arch_change_after_copy()
|
89 |
|
|
{
|
90 |
|
|
my $self=shift;
|
91 |
|
|
my ($newarch, $cachename)=@_;
|
92 |
|
|
# Make changes to arch-specific settings when copying tool manager
|
93 |
|
|
# object to another arch during setup:
|
94 |
|
|
$self->{arch} = $newarch;
|
95 |
|
|
$self->{archstore} = $self->{topdir}."/.SCRAM/".$newarch;
|
96 |
|
|
# Change the name of the cache to reflect new (arch-specific) location:
|
97 |
|
|
$self->name($cachename);
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
sub interactive()
|
101 |
|
|
{
|
102 |
|
|
my $self=shift;
|
103 |
|
|
# Interactive mode on/off:
|
104 |
|
|
@_ ? $self->{interactive} = shift
|
105 |
|
|
: ((defined $self->{interactive}) ? $self->{interactive} : 0);
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
sub setupalltools()
|
109 |
|
|
{
|
110 |
|
|
my $self = shift;
|
111 |
|
|
my ($arealocation,$setupopt) = @_;
|
112 |
|
|
my (@localtools);
|
113 |
|
|
my $selected;
|
114 |
|
|
|
115 |
|
|
# Get the selected tool list. Handle the case where there might not be
|
116 |
|
|
# any selected tools: //FIXME: need to handle case where there are no
|
117 |
|
|
# selected tools (not very often but a possibility):
|
118 |
|
|
my $sel = $self->selected();
|
119 |
|
|
|
120 |
|
|
if (defined ($sel))
|
121 |
|
|
{
|
122 |
|
|
$selected = [ keys %{$sel} ];
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
# Setup option "setupopt" directs the setup: 1 is for booting from
|
126 |
|
|
# scratch, 0 is when just doing "scram setup" (in this case we don't
|
127 |
|
|
# want to pick up everything from any scram-managed projects):
|
128 |
|
|
if ($setupopt == 1) # We're booting from scratch
|
129 |
|
|
{
|
130 |
|
|
# Check to see if there are any SCRAM-managed projects in our local requirements:
|
131 |
|
|
my $scramprojects = $::scram->_loadscramdb();
|
132 |
|
|
|
133 |
|
|
# Look for a match in the scram db:
|
134 |
|
|
foreach my $S (@$selected)
|
135 |
|
|
{
|
136 |
|
|
if (exists ($scramprojects->{$S}))
|
137 |
|
|
{
|
138 |
|
|
# Now check the version required exists in
|
139 |
|
|
# list of scram projects with this name:
|
140 |
|
|
while (my ($pdata,$plocation) = each %{$scramprojects->{$S}})
|
141 |
|
|
{
|
142 |
|
|
# Split the $pdata string to get the real name and the version:
|
143 |
|
|
my ($pname,$pversion) = split(":",$pdata);
|
144 |
|
|
if ($pversion eq $self->defaultversion($S))
|
145 |
|
|
{
|
146 |
|
|
# Get the tool manager for the scram project:
|
147 |
|
|
my $sa=$::scram->scramfunctions()->scramprojectdb()->getarea($pname,$pversion);
|
148 |
|
|
# Load the tool cache:
|
149 |
|
|
if ( -r $sa->toolcachename())
|
150 |
|
|
{
|
151 |
|
|
use Cache::CacheUtilities;
|
152 |
|
|
my $satoolmanager=&Cache::CacheUtilities::read($sa->toolcachename());
|
153 |
|
|
# Copy needed content from toolmanager for scram-managed project:
|
154 |
|
|
$self->inheritcontent($satoolmanager);
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
|
|
}
|
158 |
|
|
# Also add this scram-managed project to list of tools to set up:
|
159 |
|
|
push(@localtools,$S);
|
160 |
|
|
}
|
161 |
|
|
else
|
162 |
|
|
{
|
163 |
|
|
# Store other tools in ReqDoc in separate array. We will set up these tools later:
|
164 |
|
|
push(@localtools,$S);
|
165 |
|
|
}
|
166 |
|
|
}
|
167 |
|
|
|
168 |
|
|
# Set up extra tools required in this project, in addition to
|
169 |
|
|
# any scram-managed projects
|
170 |
|
|
foreach my $localtool (@localtools)
|
171 |
|
|
{
|
172 |
|
|
# First check to see if it's already set up (i.e., was contained
|
173 |
|
|
# in list of requirements for scram project):
|
174 |
|
|
if (! $self->definedtool($localtool))
|
175 |
|
|
{
|
176 |
|
|
$self->toolsetup($arealocation,$localtool,$self->defaultversion($localtool));
|
177 |
|
|
$self->addtoselected($localtool);
|
178 |
|
|
}
|
179 |
|
|
else
|
180 |
|
|
{
|
181 |
|
|
print $localtool," already set up.","\n",if ($ENV{SCRAM_DEBUG});
|
182 |
|
|
}
|
183 |
|
|
}
|
184 |
|
|
}
|
185 |
|
|
else
|
186 |
|
|
{
|
187 |
|
|
# Just loop over all tools and setup again:
|
188 |
|
|
foreach my $localtool (@{$selected})
|
189 |
|
|
{
|
190 |
|
|
$self->toolsetup($arealocation,$localtool,$self->defaultversion($localtool));
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
|
194 |
|
|
print "\n";
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
sub coresetup()
|
198 |
|
|
{
|
199 |
|
|
my $self=shift;
|
200 |
|
|
my ($toolname, $toolversion, $toolfile) = @_;
|
201 |
|
|
my ($toolcheck, $toolparser);
|
202 |
|
|
|
203 |
|
|
print "\n";
|
204 |
|
|
print $::bold."Setting up ",$toolname," version ",$toolversion,": ".$::normal,"\n";
|
205 |
|
|
|
206 |
|
|
# New ToolParser object for this tool if there isn't one already.
|
207 |
|
|
# Look in array of raw tools to see if this tool has a ToolParser object:
|
208 |
|
|
$toolcheck=0;
|
209 |
|
|
|
210 |
|
|
map
|
211 |
|
|
{
|
212 |
|
|
if ($_->toolname() eq $toolname) {$toolcheck = 1; $toolparser = $_;}
|
213 |
|
|
} $self->rawtools();
|
214 |
|
|
|
215 |
|
|
# Tool not known so we create a new ToolParser object and parse it:
|
216 |
|
|
if ($toolcheck != 1)
|
217 |
|
|
{
|
218 |
|
|
$toolparser = BuildSystem::ToolParser->new();
|
219 |
|
|
# We only want to store the stuff relevant for one particular version:
|
220 |
|
|
$toolparser->parse($toolname, $toolversion, $toolfile);
|
221 |
|
|
# Store the ToolParser object in the cache:
|
222 |
|
|
$self->store($toolparser);
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
# Next, set up the tool:
|
226 |
|
|
my $store = $toolparser->processrawtool($self->interactive());
|
227 |
|
|
# Make sure that we have this tool in the list of selected tools (just in case this tool was
|
228 |
|
|
# set up by hand afterwards):
|
229 |
|
|
$self->addtoselected($toolname);
|
230 |
|
|
# Store the ToolData object in the cache:
|
231 |
|
|
$self->storeincache($toolparser->toolname(),$store);
|
232 |
|
|
return $self;
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
sub toolsetup()
|
236 |
|
|
{
|
237 |
|
|
my $self=shift;
|
238 |
|
|
my ($arealocation, $toolname, $toolversion, $toolurl) = @_;
|
239 |
|
|
my ($urlcache, $url, $filename, $tfname);
|
240 |
|
|
my $toolfile;
|
241 |
sashby |
1.6 |
|
242 |
sashby |
1.2 |
$toolname =~ tr[A-Z][a-z];
|
243 |
|
|
$toolversion ||= $self->defaultversion($toolname);
|
244 |
|
|
$urlcache=URL::URLcache->new($arealocation."/.SCRAM/cache"); # Download tool cache
|
245 |
sashby |
1.6 |
|
246 |
sashby |
1.2 |
# Check for the downloaded tools cache:
|
247 |
|
|
if (defined($urlcache))
|
248 |
|
|
{
|
249 |
|
|
$self->{urlhandler}=URL::URLhandler->new($urlcache);
|
250 |
|
|
}
|
251 |
sashby |
1.6 |
|
252 |
sashby |
1.2 |
$url = $self->toolurls()->{$toolname};
|
253 |
|
|
$filename = $self->{toolfiledir}."/".$toolname;
|
254 |
|
|
|
255 |
sashby |
1.4 |
# If .SCRAM/InstalledTools doesn't exist, create it:
|
256 |
|
|
if (! -d $self->{toolfiledir})
|
257 |
|
|
{
|
258 |
|
|
AddDir::adddir($self->{toolfiledir});
|
259 |
|
|
}
|
260 |
|
|
|
261 |
sashby |
1.2 |
# First, check to see if there was a tool URL given. If so, we might need to read
|
262 |
|
|
# from http or from a file: type URL:
|
263 |
|
|
if (my ($proto, $urlv) = ($toolurl =~ /(.*):(.*)/))
|
264 |
|
|
{
|
265 |
|
|
# See what kind of URL (file:, http:, cvs:, svn:, .. ):
|
266 |
|
|
if ($proto eq 'file')
|
267 |
|
|
{
|
268 |
|
|
# If the tool url is a file and the file exists,
|
269 |
|
|
# copy it to .SCRAM/InstalledTools and set the
|
270 |
|
|
# filename accordingly:
|
271 |
|
|
if ( -f $urlv)
|
272 |
|
|
{
|
273 |
|
|
use File::Copy;
|
274 |
|
|
copy($urlv, $filename);
|
275 |
sashby |
1.5 |
my $mode = 0644; chmod $mode, $filename;
|
276 |
sashby |
1.2 |
$toolfile=$filename;
|
277 |
|
|
}
|
278 |
|
|
else
|
279 |
|
|
{
|
280 |
|
|
$::scram->scramerror("Unable to set up $toolname from URL $toolurl-- $urlv does not exist!");
|
281 |
|
|
}
|
282 |
|
|
}
|
283 |
|
|
elsif ($proto eq 'http')
|
284 |
|
|
{
|
285 |
|
|
print "SCRAM: downloading $toolname from $toolurl","\n";
|
286 |
|
|
# Download from WWW first:
|
287 |
|
|
use LWP::Simple qw(&getstore);
|
288 |
|
|
my $http_response_val = &getstore($toolurl, $filename);
|
289 |
|
|
|
290 |
|
|
# Check the HTTP status. If doc not found, exit:
|
291 |
|
|
if ($http_response_val != 200)
|
292 |
|
|
{
|
293 |
|
|
my ($server,$doc) = ($urlv =~ m|//(.*?)/(.*)|);
|
294 |
|
|
$::scram->scramerror("Unable to set up $toolname: $doc not found on $server!");
|
295 |
|
|
}
|
296 |
|
|
else
|
297 |
|
|
{
|
298 |
|
|
$toolfile=$filename;
|
299 |
|
|
}
|
300 |
|
|
}
|
301 |
|
|
elsif ($proto eq 'cvs')
|
302 |
|
|
{
|
303 |
|
|
print "SCRAM: downloading $toolname from $urlv using protocol $proto.","\n";
|
304 |
|
|
print "[ not yet supported ]","\n";
|
305 |
|
|
exit(0);
|
306 |
|
|
}
|
307 |
|
|
elsif ($proto eq 'svn')
|
308 |
|
|
{
|
309 |
|
|
print "SCRAM: downloading $toolname from $urlv using protocol $proto.","\n";
|
310 |
|
|
print "[ not yet supported ]","\n";
|
311 |
|
|
exit(0);
|
312 |
|
|
}
|
313 |
|
|
else
|
314 |
|
|
{
|
315 |
|
|
$::scram->scramerror("Unable to download $urlv! Unknown protocol \"$proto\". Bye.");
|
316 |
|
|
}
|
317 |
|
|
}
|
318 |
|
|
else
|
319 |
|
|
{
|
320 |
|
|
# Copy the downloaded tool file to InstalledTools directory:
|
321 |
|
|
if ( ! -f $filename )
|
322 |
|
|
{
|
323 |
sashby |
1.7 |
# If the URL is empty, the chances are that this tool was not downloaded to .SCRAM/InstalledTools.
|
324 |
|
|
# We signal an error and exit:
|
325 |
sashby |
1.6 |
if ($url eq '')
|
326 |
|
|
{
|
327 |
sashby |
1.7 |
$::scram->scramerror("$toolname was selected in project requirements but is not in the configuration!");
|
328 |
sashby |
1.6 |
}
|
329 |
|
|
else
|
330 |
|
|
{
|
331 |
|
|
# Otherwise, we try to download it:
|
332 |
|
|
$self->verbose("Attempting Download of $url");
|
333 |
|
|
# Get file from download cache:
|
334 |
|
|
($url,$filename)=$self->{urlhandler}->get($url);
|
335 |
|
|
use File::Copy;
|
336 |
|
|
$tfname=$self->{toolfiledir}."/".$toolname;
|
337 |
|
|
copy($filename, $tfname);
|
338 |
|
|
my $mode = 0644; chmod $mode, $tfname;
|
339 |
|
|
$toolfile=$tfname;
|
340 |
|
|
}
|
341 |
sashby |
1.2 |
}
|
342 |
|
|
else
|
343 |
|
|
{
|
344 |
|
|
# File already exists in the .SCRAM/InstallTools directory:
|
345 |
|
|
$toolfile=$filename;
|
346 |
|
|
}
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
# Run the core setup routine:
|
350 |
|
|
$self->coresetup($toolname, $toolversion, $toolfile);
|
351 |
|
|
return $self;
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
sub setupself()
|
355 |
|
|
{
|
356 |
|
|
my $self=shift;
|
357 |
|
|
my ($location)=@_;
|
358 |
|
|
# Process the file "Self" in local config directory. This is used to
|
359 |
|
|
# set all the paths/runtime settings for this project:
|
360 |
|
|
my $filename=$location."/config/Self";
|
361 |
|
|
|
362 |
|
|
if ( -f $filename )
|
363 |
|
|
{
|
364 |
|
|
print "\n";
|
365 |
|
|
print $::bold."Setting up SELF:".$::normal,"\n";
|
366 |
|
|
# Self file exists so process it:
|
367 |
|
|
$selfparser = BuildSystem::ToolParser->new();
|
368 |
|
|
$selfparser->parse('self','SELF',$filename);
|
369 |
|
|
|
370 |
|
|
# Next, set up the tool:
|
371 |
|
|
$store = $selfparser->processrawtool($self->interactive());
|
372 |
|
|
|
373 |
|
|
# If we are in a developer area, also add RELEASETOP paths:
|
374 |
|
|
if (exists($ENV{RELEASETOP}))
|
375 |
|
|
{
|
376 |
|
|
print "\nAdding RELEASE area settings to self....OK","\n", if ($ENV{SCRAM_DEBUG});
|
377 |
|
|
$store->addreleasetoself();
|
378 |
|
|
}
|
379 |
|
|
|
380 |
|
|
# Store the ToolData object in the cache:
|
381 |
|
|
$self->storeincache($selfparser->toolname(),$store);
|
382 |
|
|
print "\n";
|
383 |
|
|
}
|
384 |
|
|
else
|
385 |
|
|
{
|
386 |
|
|
print "\n";
|
387 |
|
|
print "SCRAM: No file config/Self...nothing to do.";
|
388 |
|
|
print "\n";
|
389 |
|
|
return;
|
390 |
|
|
}
|
391 |
|
|
}
|
392 |
|
|
|
393 |
|
|
sub defaultversion()
|
394 |
|
|
{
|
395 |
|
|
my $self = shift;
|
396 |
|
|
my ($tool) = @_;
|
397 |
|
|
# Return default versions as taken from configuration:
|
398 |
|
|
return (%{$self->defaultversions()}->{$tool});
|
399 |
|
|
}
|
400 |
|
|
|
401 |
|
|
sub storeincache()
|
402 |
|
|
{
|
403 |
|
|
my $self=shift;
|
404 |
|
|
my ($toolname,$dataobject)=@_;
|
405 |
|
|
|
406 |
|
|
# Store ToolData object (for a set-up tool) in cache:
|
407 |
|
|
if (ref($dataobject) eq 'BuildSystem::ToolData')
|
408 |
|
|
{
|
409 |
|
|
$self->{SETUP}->{$toolname} = $dataobject;
|
410 |
|
|
}
|
411 |
|
|
else
|
412 |
|
|
{
|
413 |
|
|
$::scram->scramerror("ToolManager: BuildSystem::ToolData object reference expected.")
|
414 |
|
|
}
|
415 |
|
|
}
|
416 |
|
|
|
417 |
|
|
sub tools()
|
418 |
|
|
{
|
419 |
|
|
my $self = shift;
|
420 |
|
|
my @tools;
|
421 |
|
|
|
422 |
|
|
map
|
423 |
|
|
{
|
424 |
|
|
if ($_ ne "self")
|
425 |
|
|
{
|
426 |
|
|
push(@tools, $_);
|
427 |
|
|
}
|
428 |
|
|
} keys %{$self->{SETUP}};
|
429 |
|
|
|
430 |
|
|
# Return list of set-up tools:
|
431 |
|
|
return @tools;
|
432 |
|
|
}
|
433 |
|
|
|
434 |
|
|
sub toolsdata()
|
435 |
|
|
{
|
436 |
|
|
my $self = shift;
|
437 |
|
|
my $tooldata = [];
|
438 |
|
|
my $rawsel = $self->selected();
|
439 |
|
|
|
440 |
|
|
foreach my $tool ( sort { %{$rawsel}->{$a}
|
441 |
|
|
<=> %{$rawsel}->{$b}}
|
442 |
|
|
keys %{$rawsel} )
|
443 |
|
|
{
|
444 |
|
|
# Return tool data objects of all set-up tools, skipping the tool "self":
|
445 |
|
|
if ($_ ne "self")
|
446 |
|
|
{
|
447 |
|
|
# Keep only tools that have really been set up:
|
448 |
|
|
if (exists $self->{SETUP}->{$tool})
|
449 |
|
|
{
|
450 |
|
|
push(@tooldata,$self->{SETUP}->{$tool});
|
451 |
|
|
}
|
452 |
|
|
}
|
453 |
|
|
}
|
454 |
|
|
|
455 |
|
|
# Return the array of tools, in order that they appear in RequirementsDoc:
|
456 |
|
|
return @tooldata;
|
457 |
|
|
}
|
458 |
|
|
|
459 |
|
|
sub definedtool()
|
460 |
|
|
{
|
461 |
|
|
my $self=shift;
|
462 |
|
|
my ($tool)=@_;
|
463 |
|
|
|
464 |
|
|
# Check to see if tool X is an external tool:
|
465 |
|
|
grep ($_ eq $tool, keys %{$self->{SETUP}}) ? return 1
|
466 |
|
|
: return 0;
|
467 |
|
|
}
|
468 |
|
|
|
469 |
|
|
sub checkifsetup()
|
470 |
|
|
{
|
471 |
|
|
my $self=shift;
|
472 |
|
|
my ($tool)=@_;
|
473 |
|
|
# Return the ToolData object if the tool has been set up:
|
474 |
|
|
(exists $self->{SETUP}->{$tool}) ? return ($self->{SETUP}->{$tool})
|
475 |
|
|
: return undef;
|
476 |
|
|
}
|
477 |
|
|
|
478 |
|
|
sub cloned_tm()
|
479 |
|
|
{
|
480 |
|
|
my $self=shift;
|
481 |
|
|
# Has this area already been cloned and brought in-line with current location:
|
482 |
|
|
@_ ? $self->{CLONED} = $_[0]
|
483 |
|
|
: $self->{CLONED};
|
484 |
|
|
}
|
485 |
|
|
|
486 |
|
|
sub remove_tool()
|
487 |
|
|
{
|
488 |
|
|
my $self=shift;
|
489 |
|
|
my ($toolname)=@_;
|
490 |
|
|
my $tools = $self->{SETUP};
|
491 |
|
|
my $newtlist = {};
|
492 |
|
|
|
493 |
|
|
while (my ($tool, $tooldata) = each %$tools)
|
494 |
|
|
{
|
495 |
|
|
if ($tool ne $toolname)
|
496 |
|
|
{
|
497 |
|
|
$newtlist->{$tool} = $tooldata;
|
498 |
|
|
}
|
499 |
|
|
else
|
500 |
|
|
{
|
501 |
|
|
print "Deleting $toolname from cache.","\n";
|
502 |
|
|
}
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
$self->{SETUP} = $newtlist;
|
506 |
|
|
|
507 |
|
|
# Now remove from the RAW tool list:
|
508 |
|
|
$self->cleanup_raw($toolname);
|
509 |
|
|
|
510 |
|
|
print "ToolManager: Updating tool cache.","\n";
|
511 |
|
|
$self->writecache();
|
512 |
|
|
}
|
513 |
|
|
|
514 |
|
|
sub scram_projects()
|
515 |
|
|
{
|
516 |
|
|
my $self=shift;
|
517 |
|
|
my $scram_projects={};
|
518 |
|
|
|
519 |
|
|
foreach my $t ($self->tools())
|
520 |
|
|
{
|
521 |
|
|
# Get the ToolData object:
|
522 |
|
|
my $td=$self->{SETUP}->{$t};
|
523 |
|
|
$scram_projects->{$t}=$td->variable_data(uc($t)."_BASE"), if ($td->scram_project());
|
524 |
|
|
}
|
525 |
|
|
|
526 |
|
|
return $scram_projects;
|
527 |
|
|
}
|
528 |
|
|
|
529 |
|
|
1;
|