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()); |
141 |
|
my $scramprojects = $::scram->_loadscramdb(); |
142 |
|
|
143 |
|
# Look for a match in the scram db: |
144 |
< |
foreach my $S (@$selected) |
145 |
< |
{ |
146 |
< |
if (exists ($scramprojects->{$S})) |
147 |
< |
{ |
148 |
< |
# Now check the version required exists in |
149 |
< |
# list of scram projects with this name: |
150 |
< |
while (my ($pdata,$plocation) = each %{$scramprojects->{$S}}) |
151 |
< |
{ |
152 |
< |
# Split the $pdata string to get the real name and the version: |
153 |
< |
my ($pname,$pversion) = split(":",$pdata); |
154 |
< |
if ($pversion eq $self->defaultversion($S)) |
155 |
< |
{ |
156 |
< |
# Get the tool manager for the scram project: |
157 |
< |
my $sa=$::scram->scramfunctions()->scramprojectdb()->getarea($pname,$pversion); |
158 |
< |
# Load the tool cache: |
159 |
< |
if ( -r $sa->toolcachename()) |
160 |
< |
{ |
161 |
< |
use Cache::CacheUtilities; |
162 |
< |
my $satoolmanager=&Cache::CacheUtilities::read($sa->toolcachename()); |
163 |
< |
# Copy needed content from toolmanager for scram-managed project only |
164 |
< |
# if the projects have compatible configurations (compare first set of |
165 |
< |
# digits): |
166 |
< |
if ($self->check_compatibility($satoolmanager)) |
167 |
< |
{ |
158 |
< |
print "DEBUG: $pname and current project have compatible configurations.\n"; |
159 |
< |
$self->inheritcontent($satoolmanager); |
160 |
< |
} |
161 |
< |
else |
162 |
< |
{ |
163 |
< |
print "DEBUG: $pname and current project do NOT have compatible configurations. Skipping...\n"; |
164 |
< |
} |
165 |
< |
} |
144 |
> |
foreach my $S (@$selected) { |
145 |
> |
if (exists ($scramprojects->{$S})) { |
146 |
> |
# Check for environment SCRAM_INHERIT_COMPAT_CONFIG: |
147 |
> |
if (exists($ENV{SCRAM_INHERIT_COMPAT_CONFIG})) { |
148 |
> |
# Now check the version required exists in |
149 |
> |
# list of scram projects with this name: |
150 |
> |
while (my ($pdata,$plocation) = each %{$scramprojects->{$S}}) { |
151 |
> |
# Split the $pdata string to get the real name and the version: |
152 |
> |
my ($pname,$pversion) = split(":",$pdata); |
153 |
> |
if ($pversion eq $self->defaultversion($S)) { |
154 |
> |
# Get the tool manager for the scram project: |
155 |
> |
my $sa=$::scram->scramfunctions()->scramprojectdb()->getarea($pname,$pversion); |
156 |
> |
# Load the tool cache: |
157 |
> |
if ( -r $sa->toolcachename()) { |
158 |
> |
use Cache::CacheUtilities; |
159 |
> |
my $satoolmanager=&Cache::CacheUtilities::read($sa->toolcachename()); |
160 |
> |
# Copy needed content from toolmanager for scram-managed project only |
161 |
> |
# if the projects have compatible configurations (compare first set of |
162 |
> |
# digits): |
163 |
> |
if ($self->check_compatibility($satoolmanager)) { |
164 |
> |
$self->inheritcontent($satoolmanager); |
165 |
> |
} |
166 |
> |
} |
167 |
> |
} |
168 |
|
} |
169 |
< |
} |
170 |
< |
# Also add this scram-managed project to list of tools to set up: |
171 |
< |
push(@localtools,$S); |
172 |
< |
} |
173 |
< |
else |
174 |
< |
{ |
175 |
< |
# Store other tools in ReqDoc in separate array. We will set up these tools later: |
176 |
< |
push(@localtools,$S); |
175 |
< |
} |
176 |
< |
} |
169 |
> |
} |
170 |
> |
# Also add this scram-managed project to list of tools to set up: |
171 |
> |
push(@localtools,$S); |
172 |
> |
} else { |
173 |
> |
# Store other tools in ReqDoc in separate array. We will set up these tools later: |
174 |
> |
push(@localtools,$S); |
175 |
> |
} |
176 |
> |
} |
177 |
|
|
178 |
|
# Set up extra tools required in this project, in addition to |
179 |
|
# any scram-managed projects |
250 |
|
$self->scram_compiler($supported_language[0],$toolname,$compilername[0]); |
251 |
|
} |
252 |
|
|
253 |
< |
# Store the ToolData object in the cache: |
253 |
> |
# Store the ToolData object in the cache: |
254 |
|
$self->storeincache($toolparser->toolname(),$store); |
255 |
|
return $self; |
256 |
|
} |
399 |
|
my ($location)=@_; |
400 |
|
# Process the file "Self" in local config directory. This is used to |
401 |
|
# set all the paths/runtime settings for this project: |
402 |
< |
my $filename=$location."/config/Self"; |
402 |
> |
my $filename=$location."/config/Self.xml"; |
403 |
|
|
404 |
|
if ( -f $filename ) |
405 |
|
{ |
426 |
|
else |
427 |
|
{ |
428 |
|
print "\n"; |
429 |
< |
print "SCRAM: No file config/Self...nothing to do."; |
429 |
> |
print "SCRAM: No file config/Self.xml...nothing to do."; |
430 |
|
print "\n"; |
431 |
|
return; |
432 |
|
} |
448 |
|
# Store ToolData object (for a set-up tool) in cache: |
449 |
|
if (ref($dataobject) eq 'BuildSystem::ToolData') |
450 |
|
{ |
451 |
+ |
$self->updatetooltimestamp($dataobject, $toolname); |
452 |
|
$self->{SETUP}->{$toolname} = $dataobject; |
453 |
|
} |
454 |
|
else |
562 |
|
} |
563 |
|
|
564 |
|
$self->{SETUP} = $newtlist; |
565 |
< |
|
565 |
> |
$self->updatetooltimestamp ("", $toolname); |
566 |
|
# Now remove from the RAW tool list: |
567 |
|
$self->cleanup_raw($toolname); |
568 |
|
print "ToolManager: Updating tool cache.","\n"; |
615 |
|
# the desired name: |
616 |
|
if ($obj->toolname() eq $name) |
617 |
|
{ |
618 |
+ |
$self->updatetooltimestamp ($obj, $name); |
619 |
|
print "ToolManager: Updating the cached copy of ".$name."\n"; |
620 |
|
delete $self->{SETUP}->{$name}; |
621 |
|
$self->{SETUP}->{$name} = $obj; |
660 |
|
: $self->{CONFIGVERSION}; |
661 |
|
} |
662 |
|
|
663 |
+ |
sub updatetooltimestamp () |
664 |
+ |
{ |
665 |
+ |
my $self=shift; |
666 |
+ |
my $obj=shift; |
667 |
+ |
my $toolname=shift; |
668 |
+ |
my $samevalues=0; |
669 |
+ |
if (exists $self->{SETUP}->{$toolname}) |
670 |
+ |
{ |
671 |
+ |
$samevalues=$self->comparetoolsdata($self->{SETUP}->{$toolname},$obj); |
672 |
+ |
} |
673 |
+ |
if (!$samevalues) |
674 |
+ |
{ |
675 |
+ |
if (!-d $self->{tooltimestamp}) |
676 |
+ |
{ |
677 |
+ |
AddDir::adddir($self->{tooltimestamp}); |
678 |
+ |
} |
679 |
+ |
open(TIMESTAMPFILE,">".$self->{tooltimestamp}."/$toolname"); |
680 |
+ |
close(TIMESTAMPFILE); |
681 |
+ |
} |
682 |
+ |
} |
683 |
+ |
|
684 |
+ |
sub comparetoolsdata () |
685 |
+ |
{ |
686 |
+ |
my $self=shift; |
687 |
+ |
my $data1=shift || (); |
688 |
+ |
my $data2=shift || (); |
689 |
+ |
|
690 |
+ |
my $ref1=ref($data1); |
691 |
+ |
my $ref2=ref($data2); |
692 |
+ |
|
693 |
+ |
if ($ref1 ne $ref2) |
694 |
+ |
{ |
695 |
+ |
return 0; |
696 |
+ |
} |
697 |
+ |
elsif ($ref1 eq "CODE") |
698 |
+ |
{ |
699 |
+ |
return 1; |
700 |
+ |
} |
701 |
+ |
elsif(($ref1 eq "SCALAR") || ($ref1 eq "")) |
702 |
+ |
{ |
703 |
+ |
if ($data1 eq $data2) |
704 |
+ |
{ |
705 |
+ |
return 1; |
706 |
+ |
} |
707 |
+ |
return 0; |
708 |
+ |
} |
709 |
+ |
elsif ($ref1 eq "ARRAY") |
710 |
+ |
{ |
711 |
+ |
my $count = scalar(@$data1); |
712 |
+ |
if ($count != scalar(@$data2)) |
713 |
+ |
{ |
714 |
+ |
return 0; |
715 |
+ |
} |
716 |
+ |
for (my $i=0; $i<$count; $i++) |
717 |
+ |
{ |
718 |
+ |
if (! $self->comparetoolsdata($data1->[$i],$data2->[$i])) |
719 |
+ |
{ |
720 |
+ |
return 0; |
721 |
+ |
} |
722 |
+ |
} |
723 |
+ |
return 1; |
724 |
+ |
} |
725 |
+ |
else |
726 |
+ |
{ |
727 |
+ |
foreach my $k (keys %{$data1}) |
728 |
+ |
{ |
729 |
+ |
if (! exists $data2->{$k}) |
730 |
+ |
{ |
731 |
+ |
return 0; |
732 |
+ |
} |
733 |
+ |
} |
734 |
+ |
foreach my $k (keys %{$data2}) |
735 |
+ |
{ |
736 |
+ |
if (! exists $data1->{$k}) |
737 |
+ |
{ |
738 |
+ |
return 0; |
739 |
+ |
} |
740 |
+ |
} |
741 |
+ |
foreach my $k (keys %{$data2}) |
742 |
+ |
{ |
743 |
+ |
if (! $self->comparetoolsdata($data1->{$k},$data2->{$k})) |
744 |
+ |
{ |
745 |
+ |
return 0; |
746 |
+ |
} |
747 |
+ |
} |
748 |
+ |
return 1; |
749 |
+ |
} |
750 |
+ |
} |
751 |
+ |
|
752 |
|
1; |