238 |
|
my ($arealocation, $toolname, $toolversion, $toolurl) = @_; |
239 |
|
my ($urlcache, $url, $filename, $tfname); |
240 |
|
my $toolfile; |
241 |
< |
|
241 |
> |
|
242 |
|
$toolname =~ tr[A-Z][a-z]; |
243 |
|
$toolversion ||= $self->defaultversion($toolname); |
244 |
|
$urlcache=URL::URLcache->new($arealocation."/.SCRAM/cache"); # Download tool cache |
245 |
< |
|
245 |
> |
|
246 |
|
# Check for the downloaded tools cache: |
247 |
|
if (defined($urlcache)) |
248 |
|
{ |
249 |
|
$self->{urlhandler}=URL::URLhandler->new($urlcache); |
250 |
|
} |
251 |
< |
|
251 |
> |
|
252 |
|
$url = $self->toolurls()->{$toolname}; |
253 |
|
$filename = $self->{toolfiledir}."/".$toolname; |
254 |
|
|
320 |
|
# Copy the downloaded tool file to InstalledTools directory: |
321 |
|
if ( ! -f $filename ) |
322 |
|
{ |
323 |
< |
$self->verbose("Attempting Download of $url"); |
324 |
< |
# Get file from download cache: |
325 |
< |
($url,$filename)=$self->{urlhandler}->get($url); |
326 |
< |
use File::Copy; |
327 |
< |
$tfname=$self->{toolfiledir}."/".$toolname; |
328 |
< |
copy($filename, $tfname); |
329 |
< |
my $mode = 0644; chmod $mode, $tfname; |
330 |
< |
$toolfile=$tfname; |
323 |
> |
# If the URL is empty, the chances are that this tool was not downloaded to .SCRAM/InstalledTools. We |
324 |
> |
# give a warning and continue: |
325 |
> |
if ($url eq '') |
326 |
> |
{ |
327 |
> |
$::scram->scramerror("$toolname was selected in project requirements but is not in the configuration."); |
328 |
> |
} |
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 |
|
} |
342 |
|
else |
343 |
|
{ |