48 |
|
$self->{toolfiledir}=$self->{topdir}."/.SCRAM/InstalledTools"; |
49 |
|
$self->{datastore}=$self->{topdir}."/.SCRAM"; |
50 |
|
$self->{archstore}=$self->{topdir}."/.SCRAM/".$ENV{SCRAM_ARCH}; |
51 |
+ |
|
52 |
+ |
if (exists $ENV{SCRAM_TOOL_TIMESTAMP_DIR}) |
53 |
+ |
{ |
54 |
+ |
$self->{tooltimestamp}=$ENV{SCRAM_TOOL_TIMESTAMP_DIR}; |
55 |
+ |
} |
56 |
+ |
else |
57 |
+ |
{ |
58 |
+ |
$self->{tooltimestamp}=$self->{archstore}."/timestamps"; |
59 |
+ |
} |
60 |
|
|
61 |
|
# Make sure our tool download dir exists: |
62 |
|
AddDir::adddir($self->{toolfiledir}); |
63 |
|
AddDir::adddir($self->{archstore}); |
64 |
+ |
AddDir::adddir($self->{tooltimestamp}); |
65 |
|
|
66 |
|
# Set the tool cache file to read/write: |
67 |
|
$self->name($projectarea->toolcachename()); |
255 |
|
$self->scram_compiler($supported_language[0],$toolname,$compilername[0]); |
256 |
|
} |
257 |
|
|
258 |
< |
# Store the ToolData object in the cache: |
258 |
> |
# Store the ToolData object in the cache: |
259 |
|
$self->storeincache($toolparser->toolname(),$store); |
260 |
|
return $self; |
261 |
|
} |
404 |
|
my ($location)=@_; |
405 |
|
# Process the file "Self" in local config directory. This is used to |
406 |
|
# set all the paths/runtime settings for this project: |
407 |
< |
my $filename=$location."/config/Self"; |
408 |
< |
|
407 |
> |
my $filename=$location."/config/Self.xml"; |
408 |
> |
|
409 |
|
if ( -f $filename ) |
410 |
|
{ |
411 |
|
print "\n"; |
431 |
|
else |
432 |
|
{ |
433 |
|
print "\n"; |
434 |
< |
print "SCRAM: No file config/Self...nothing to do."; |
434 |
> |
print "SCRAM: No file config/Self.xml...nothing to do."; |
435 |
|
print "\n"; |
436 |
|
return; |
437 |
|
} |
453 |
|
# Store ToolData object (for a set-up tool) in cache: |
454 |
|
if (ref($dataobject) eq 'BuildSystem::ToolData') |
455 |
|
{ |
456 |
+ |
$self->updatetooltimestamp($dataobject, $toolname); |
457 |
|
$self->{SETUP}->{$toolname} = $dataobject; |
458 |
|
} |
459 |
|
else |
567 |
|
} |
568 |
|
|
569 |
|
$self->{SETUP} = $newtlist; |
570 |
< |
|
570 |
> |
$self->updatetooltimestamp ("", $toolname); |
571 |
|
# Now remove from the RAW tool list: |
572 |
|
$self->cleanup_raw($toolname); |
573 |
|
print "ToolManager: Updating tool cache.","\n"; |
620 |
|
# the desired name: |
621 |
|
if ($obj->toolname() eq $name) |
622 |
|
{ |
623 |
+ |
$self->updatetooltimestamp ($obj, $name); |
624 |
|
print "ToolManager: Updating the cached copy of ".$name."\n"; |
625 |
|
delete $self->{SETUP}->{$name}; |
626 |
|
$self->{SETUP}->{$name} = $obj; |
665 |
|
: $self->{CONFIGVERSION}; |
666 |
|
} |
667 |
|
|
668 |
+ |
sub updatetooltimestamp () |
669 |
+ |
{ |
670 |
+ |
my $self=shift; |
671 |
+ |
my $obj=shift; |
672 |
+ |
my $toolname=shift; |
673 |
+ |
my $samevalues=0; |
674 |
+ |
if (exists $self->{SETUP}->{$toolname}) |
675 |
+ |
{ |
676 |
+ |
$samevalues=$self->comparetoolsdata($self->{SETUP}->{$toolname},$obj); |
677 |
+ |
} |
678 |
+ |
if (!$samevalues) |
679 |
+ |
{ |
680 |
+ |
if (!-d $self->{tooltimestamp}) |
681 |
+ |
{ |
682 |
+ |
AddDir::adddir($self->{tooltimestamp}); |
683 |
+ |
} |
684 |
+ |
open(TIMESTAMPFILE,">".$self->{tooltimestamp}."/$toolname"); |
685 |
+ |
close(TIMESTAMPFILE); |
686 |
+ |
} |
687 |
+ |
} |
688 |
+ |
|
689 |
+ |
sub comparetoolsdata () |
690 |
+ |
{ |
691 |
+ |
my $self=shift; |
692 |
+ |
my $data1=shift || (); |
693 |
+ |
my $data2=shift || (); |
694 |
+ |
|
695 |
+ |
my $ref1=ref($data1); |
696 |
+ |
my $ref2=ref($data2); |
697 |
+ |
|
698 |
+ |
if ($ref1 ne $ref2) |
699 |
+ |
{ |
700 |
+ |
return 0; |
701 |
+ |
} |
702 |
+ |
elsif ($ref1 eq "CODE") |
703 |
+ |
{ |
704 |
+ |
return 1; |
705 |
+ |
} |
706 |
+ |
elsif(($ref1 eq "SCALAR") || ($ref1 eq "")) |
707 |
+ |
{ |
708 |
+ |
if ($data1 eq $data2) |
709 |
+ |
{ |
710 |
+ |
return 1; |
711 |
+ |
} |
712 |
+ |
return 0; |
713 |
+ |
} |
714 |
+ |
elsif ($ref1 eq "ARRAY") |
715 |
+ |
{ |
716 |
+ |
my $count = scalar(@$data1); |
717 |
+ |
if ($count != scalar(@$data2)) |
718 |
+ |
{ |
719 |
+ |
return 0; |
720 |
+ |
} |
721 |
+ |
for (my $i=0; $i<$count; $i++) |
722 |
+ |
{ |
723 |
+ |
if (! $self->comparetoolsdata($data1->[$i],$data2->[$i])) |
724 |
+ |
{ |
725 |
+ |
return 0; |
726 |
+ |
} |
727 |
+ |
} |
728 |
+ |
return 1; |
729 |
+ |
} |
730 |
+ |
else |
731 |
+ |
{ |
732 |
+ |
foreach my $k (keys %{$data1}) |
733 |
+ |
{ |
734 |
+ |
if (! exists $data2->{$k}) |
735 |
+ |
{ |
736 |
+ |
return 0; |
737 |
+ |
} |
738 |
+ |
} |
739 |
+ |
foreach my $k (keys %{$data2}) |
740 |
+ |
{ |
741 |
+ |
if (! exists $data1->{$k}) |
742 |
+ |
{ |
743 |
+ |
return 0; |
744 |
+ |
} |
745 |
+ |
} |
746 |
+ |
foreach my $k (keys %{$data2}) |
747 |
+ |
{ |
748 |
+ |
if (! $self->comparetoolsdata($data1->{$k},$data2->{$k})) |
749 |
+ |
{ |
750 |
+ |
return 0; |
751 |
+ |
} |
752 |
+ |
} |
753 |
+ |
return 1; |
754 |
+ |
} |
755 |
+ |
} |
756 |
+ |
|
757 |
|
1; |