22 |
|
@ISA=qw(BuildSystem::ToolCache Utilities::Verbose); |
23 |
|
@EXPORT_OK=qw( ); |
24 |
|
# |
25 |
< |
# |
25 |
> |
|
26 |
|
sub new |
27 |
|
############################################################### |
28 |
|
# new # |
277 |
|
# See what kind of URL (file:, http:, cvs:, svn:, .. ): |
278 |
|
if ($proto eq 'file') |
279 |
|
{ |
280 |
+ |
# Check to see if there is a ~ and substitute the user |
281 |
+ |
# home directory if there is: |
282 |
+ |
my ($urlpath) = ($urlv =~ m|^\~/(.*)$|); |
283 |
+ |
$urlv = $ENV{HOME}."/".$urlpath; |
284 |
+ |
|
285 |
|
# If the tool url is a file and the file exists, |
286 |
|
# copy it to .SCRAM/InstalledTools and set the |
287 |
|
# filename accordingly: |
515 |
|
} |
516 |
|
else |
517 |
|
{ |
518 |
< |
print "Deleting $toolname from cache.","\n"; |
518 |
> |
# Is this tool a compiler? |
519 |
> |
if ($tooldata->scram_compiler() == 1) |
520 |
> |
{ |
521 |
> |
# Also remove this from the compiler info if there happens to be an entry: |
522 |
> |
while (my ($langtype, $ctool) = each %{$self->{SCRAM_COMPILER}}) |
523 |
> |
{ |
524 |
> |
if ($toolname eq $ctool->[0]) |
525 |
> |
{ |
526 |
> |
delete $self->{SCRAM_COMPILER}->{$langtype}; |
527 |
> |
print "Deleting compiler $toolname from cache.","\n"; |
528 |
> |
} |
529 |
> |
} |
530 |
> |
} |
531 |
> |
else |
532 |
> |
{ |
533 |
> |
print "Deleting $toolname from cache.","\n"; |
534 |
> |
} |
535 |
|
} |
536 |
|
} |
537 |
|
|
538 |
|
$self->{SETUP} = $newtlist; |
539 |
< |
|
539 |
> |
|
540 |
|
# Now remove from the RAW tool list: |
541 |
|
$self->cleanup_raw($toolname); |
521 |
– |
|
542 |
|
print "ToolManager: Updating tool cache.","\n"; |
543 |
|
$self->writecache(); |
544 |
|
} |
577 |
|
} |
578 |
|
} |
579 |
|
|
580 |
+ |
sub updatetool() |
581 |
+ |
{ |
582 |
+ |
my $self=shift; |
583 |
+ |
my ($name, $obj) = @_; |
584 |
+ |
|
585 |
+ |
# Replace the existing copy of the tool with the new one: |
586 |
+ |
if (exists $self->{SETUP}->{$name}) |
587 |
+ |
{ |
588 |
+ |
# Check to make sure that we were really passed a compiler with |
589 |
+ |
# the desired name: |
590 |
+ |
if ($obj->toolname() eq $name) |
591 |
+ |
{ |
592 |
+ |
print "ToolManager: Updating the cached copy of ".$name."\n"; |
593 |
+ |
delete $self->{SETUP}->{$name}; |
594 |
+ |
$self->{SETUP}->{$name} = $obj; |
595 |
+ |
$self->writecache(); |
596 |
+ |
} |
597 |
+ |
else |
598 |
+ |
{ |
599 |
+ |
print "WARNING: Tool name (".$name.") and tool obj name (".$obj->toolname().") don't match!","\n"; |
600 |
+ |
print " Not making any changes.","\n"; |
601 |
+ |
} |
602 |
+ |
} |
603 |
+ |
else |
604 |
+ |
{ |
605 |
+ |
print "WARNING: No entry in cache for ".$name.". Not making any updates.\n"; |
606 |
+ |
} |
607 |
+ |
} |
608 |
+ |
|
609 |
|
1; |