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 |
muzaffar |
1.20 |
# Revision: $Id: ToolManager.pm,v 1.19.2.2.2.5 2010/12/02 15:57:31 muzaffar 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 Utilities::Verbose;
|
20 |
muzaffar |
1.19 |
use SCRAM::MsgLog;
|
21 |
sashby |
1.2 |
|
22 |
|
|
@ISA=qw(BuildSystem::ToolCache Utilities::Verbose);
|
23 |
|
|
@EXPORT_OK=qw( );
|
24 |
|
|
#
|
25 |
sashby |
1.9 |
|
26 |
sashby |
1.2 |
sub new
|
27 |
|
|
{
|
28 |
|
|
my $proto=shift;
|
29 |
|
|
my $class=ref($proto) || $proto;
|
30 |
|
|
my $self=$class->SUPER::new(); # Inherit from ToolCache
|
31 |
|
|
bless $self,$class;
|
32 |
muzaffar |
1.20 |
$self->init (shift);
|
33 |
sashby |
1.2 |
return $self;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
muzaffar |
1.20 |
sub init ()
|
37 |
sashby |
1.2 |
{
|
38 |
|
|
my $self=shift;
|
39 |
|
|
my $projectarea=shift;
|
40 |
|
|
$self->{topdir}=$projectarea->location();
|
41 |
|
|
$self->{configdir}=$self->{topdir}."/".$projectarea->configurationdir();
|
42 |
muzaffar |
1.20 |
$self->{archstore}=$projectarea->archdir();
|
43 |
|
|
$self->{toolcache}=$self->{configdir}."/toolbox/".$projectarea->arch()."/tools";
|
44 |
sashby |
1.2 |
$self->name($projectarea->toolcachename());
|
45 |
muzaffar |
1.20 |
$self->dirty();
|
46 |
sashby |
1.2 |
}
|
47 |
muzaffar |
1.20 |
|
48 |
sashby |
1.2 |
sub setupalltools()
|
49 |
|
|
{
|
50 |
|
|
my $self = shift;
|
51 |
muzaffar |
1.20 |
my @selected=();
|
52 |
|
|
my $tooldir=$self->{toolcache}."/selected";
|
53 |
|
|
foreach my $tool (@{&getfileslist($tooldir)})
|
54 |
sashby |
1.2 |
{
|
55 |
muzaffar |
1.20 |
if ($tool=~/^(.+)\.xml$/) {push @selected,$1;}
|
56 |
sashby |
1.2 |
}
|
57 |
muzaffar |
1.20 |
foreach my $tool (@selected){$self->coresetup("${tooldir}/${tool}.xml");}
|
58 |
muzaffar |
1.19 |
scramlogmsg("\n");
|
59 |
sashby |
1.2 |
}
|
60 |
|
|
|
61 |
|
|
sub coresetup()
|
62 |
|
|
{
|
63 |
|
|
my $self=shift;
|
64 |
muzaffar |
1.20 |
my ($toolfile) = @_;
|
65 |
sashby |
1.2 |
|
66 |
muzaffar |
1.20 |
my $toolparser = BuildSystem::ToolParser->new();
|
67 |
|
|
$toolparser->filehead('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::ToolDoc" version="1.0">');
|
68 |
|
|
$toolparser->filetail('</doc>');
|
69 |
|
|
$toolparser->parse($toolfile);
|
70 |
|
|
my $toolname = $toolparser->toolname();
|
71 |
|
|
my $toolversion = $toolparser->toolversion();
|
72 |
muzaffar |
1.19 |
scramlogmsg("\n",$::bold."Setting up ",$toolname," version ",$toolversion,": ".$::normal,"\n");
|
73 |
sashby |
1.2 |
|
74 |
|
|
# Next, set up the tool:
|
75 |
muzaffar |
1.20 |
my $store = $toolparser->processrawtool();
|
76 |
sashby |
1.8 |
|
77 |
|
|
# Check to see if this tool is a compiler. If so, store it.
|
78 |
|
|
# Also store the language that this compiler supprots, and a
|
79 |
|
|
# compiler name (e.g. gcc323) which, in conjunction with a stem
|
80 |
|
|
# architecture name like slc3_ia32_, can be used to build a complete arch string:
|
81 |
|
|
if ($store->scram_compiler() == 1)
|
82 |
|
|
{
|
83 |
|
|
my @supported_language = $store->flags("SCRAM_LANGUAGE_TYPE");
|
84 |
|
|
my @compilername = $store->flags("SCRAM_COMPILER_NAME");
|
85 |
|
|
$self->scram_compiler($supported_language[0],$toolname,$compilername[0]);
|
86 |
|
|
}
|
87 |
|
|
|
88 |
sashby |
1.16 |
# Store the ToolData object in the cache:
|
89 |
muzaffar |
1.20 |
$self->storeincache($toolname,$store);
|
90 |
|
|
my $srcfile=Utilities::AddDir::fixpath($toolfile);
|
91 |
|
|
my $desfile=Utilities::AddDir::fixpath($self->{toolcache}."/selected/${toolname}.xml");
|
92 |
|
|
use File::Copy;
|
93 |
|
|
if ($srcfile ne $desfile)
|
94 |
|
|
{
|
95 |
|
|
use File::Copy;
|
96 |
|
|
my $desfile1=Utilities::AddDir::fixpath($self->{toolcache}."/available/${toolname}.xml");
|
97 |
|
|
if ($srcfile ne $desfile1)
|
98 |
|
|
{
|
99 |
|
|
copy($srcfile,$desfile1);
|
100 |
sashby |
1.2 |
}
|
101 |
muzaffar |
1.20 |
if (-e $desfile) { unlink($desfile);}
|
102 |
|
|
symlink("../available/${toolname}.xml",$desfile);
|
103 |
sashby |
1.2 |
}
|
104 |
muzaffar |
1.20 |
scramlogclean();
|
105 |
sashby |
1.2 |
return $self;
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
sub setupself()
|
109 |
|
|
{
|
110 |
|
|
my $self=shift;
|
111 |
|
|
# Process the file "Self" in local config directory. This is used to
|
112 |
|
|
# set all the paths/runtime settings for this project:
|
113 |
muzaffar |
1.20 |
my $filename=$self->{configdir}."/Self.xml";
|
114 |
sashby |
1.16 |
|
115 |
sashby |
1.2 |
if ( -f $filename )
|
116 |
|
|
{
|
117 |
muzaffar |
1.19 |
scramlogmsg("\n",$::bold."Setting up SELF:".$::normal,"\n");
|
118 |
sashby |
1.2 |
# Self file exists so process it:
|
119 |
|
|
$selfparser = BuildSystem::ToolParser->new();
|
120 |
muzaffar |
1.18 |
$selfparser->filehead ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::ToolDoc" version="1.0">');
|
121 |
|
|
$selfparser->filehead ('</doc>');
|
122 |
muzaffar |
1.20 |
$selfparser->parse($filename);
|
123 |
sashby |
1.2 |
|
124 |
|
|
# Next, set up the tool:
|
125 |
muzaffar |
1.20 |
$store = $selfparser->processrawtool();
|
126 |
muzaffar |
1.19 |
|
127 |
sashby |
1.2 |
# If we are in a developer area, also add RELEASETOP paths:
|
128 |
|
|
if (exists($ENV{RELEASETOP}))
|
129 |
|
|
{
|
130 |
|
|
print "\nAdding RELEASE area settings to self....OK","\n", if ($ENV{SCRAM_DEBUG});
|
131 |
|
|
$store->addreleasetoself();
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
# Store the ToolData object in the cache:
|
135 |
|
|
$self->storeincache($selfparser->toolname(),$store);
|
136 |
muzaffar |
1.19 |
scramlogmsg("\n");
|
137 |
sashby |
1.2 |
}
|
138 |
|
|
else
|
139 |
|
|
{
|
140 |
muzaffar |
1.19 |
scramlogdump();
|
141 |
sashby |
1.2 |
print "\n";
|
142 |
sashby |
1.16 |
print "SCRAM: No file config/Self.xml...nothing to do.";
|
143 |
sashby |
1.2 |
print "\n";
|
144 |
|
|
return;
|
145 |
|
|
}
|
146 |
|
|
}
|
147 |
|
|
|
148 |
muzaffar |
1.20 |
sub update()
|
149 |
sashby |
1.2 |
{
|
150 |
muzaffar |
1.20 |
my $self=shift;
|
151 |
|
|
my $area=shift;
|
152 |
|
|
$self->init($area);
|
153 |
|
|
$self->setupself();
|
154 |
|
|
$self->dirty ()
|
155 |
sashby |
1.2 |
}
|
156 |
muzaffar |
1.20 |
|
157 |
sashby |
1.2 |
sub storeincache()
|
158 |
|
|
{
|
159 |
|
|
my $self=shift;
|
160 |
|
|
my ($toolname,$dataobject)=@_;
|
161 |
|
|
|
162 |
|
|
# Store ToolData object (for a set-up tool) in cache:
|
163 |
|
|
if (ref($dataobject) eq 'BuildSystem::ToolData')
|
164 |
|
|
{
|
165 |
sashby |
1.16 |
$self->updatetooltimestamp($dataobject, $toolname);
|
166 |
muzaffar |
1.20 |
delete $self->{SETUP}->{$toolname};
|
167 |
sashby |
1.2 |
$self->{SETUP}->{$toolname} = $dataobject;
|
168 |
|
|
}
|
169 |
|
|
else
|
170 |
|
|
{
|
171 |
|
|
$::scram->scramerror("ToolManager: BuildSystem::ToolData object reference expected.")
|
172 |
|
|
}
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
sub tools()
|
176 |
|
|
{
|
177 |
|
|
my $self = shift;
|
178 |
|
|
my @tools;
|
179 |
|
|
|
180 |
|
|
map
|
181 |
|
|
{
|
182 |
|
|
if ($_ ne "self")
|
183 |
|
|
{
|
184 |
|
|
push(@tools, $_);
|
185 |
|
|
}
|
186 |
|
|
} keys %{$self->{SETUP}};
|
187 |
|
|
|
188 |
|
|
# Return list of set-up tools:
|
189 |
|
|
return @tools;
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
sub toolsdata()
|
193 |
|
|
{
|
194 |
|
|
my $self = shift;
|
195 |
|
|
my $tooldata = [];
|
196 |
muzaffar |
1.20 |
$self->{internal}{donetools}={};
|
197 |
|
|
$self->{internal}{scram_tools}={};
|
198 |
|
|
foreach my $tool (sort keys %{$self->{SETUP}})
|
199 |
sashby |
1.2 |
{
|
200 |
muzaffar |
1.20 |
if ($self->{SETUP}{$tool}->scram_project()) {$self->{internal}{scram_tools}{$tool}=1;}
|
201 |
|
|
elsif ($tool ne "self")
|
202 |
sashby |
1.2 |
{
|
203 |
muzaffar |
1.20 |
$self->_toolsdata($tool,$tooldata);
|
204 |
|
|
}
|
205 |
|
|
}
|
206 |
|
|
foreach my $tool (keys %{$self->{internal}{scram_tools}})
|
207 |
|
|
{
|
208 |
|
|
$self->_toolsdata_scram($tool,$tooldata);
|
209 |
|
|
}
|
210 |
|
|
delete $self->{internal}{donetools};
|
211 |
|
|
delete $self->{internal}{scram_tools};
|
212 |
|
|
my $data=[];
|
213 |
|
|
foreach my $d (@$tooldata)
|
214 |
|
|
{
|
215 |
|
|
if (ref($d) eq "ARRAY")
|
216 |
|
|
{
|
217 |
|
|
foreach my $t (@$d) {push @$data,$t;}
|
218 |
|
|
}
|
219 |
|
|
}
|
220 |
|
|
return $data;
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
sub _toolsdata()
|
224 |
|
|
{
|
225 |
|
|
my $self = shift;
|
226 |
|
|
my $tool=shift;
|
227 |
|
|
my $data=shift || [];
|
228 |
|
|
my $order=-1;
|
229 |
|
|
if(exists $self->{internal}{donetools}{$tool}){return $self->{internal}{donetools}{$tool};}
|
230 |
|
|
$self->{internal}{donetools}{$tool}=$order;
|
231 |
|
|
if (exists $self->{SETUP}{$tool})
|
232 |
|
|
{
|
233 |
|
|
if (exists $self->{SETUP}{$tool}{USE})
|
234 |
|
|
{
|
235 |
|
|
foreach my $use (@{$self->{SETUP}{$tool}{USE}})
|
236 |
sashby |
1.2 |
{
|
237 |
muzaffar |
1.20 |
my $o=$self->_toolsdata(lc($use),$data);
|
238 |
|
|
if ($o>$order){$order=$o;}
|
239 |
sashby |
1.2 |
}
|
240 |
|
|
}
|
241 |
muzaffar |
1.20 |
$order++;
|
242 |
|
|
if(!defined $data->[$order]){$data->[$order]=[];}
|
243 |
|
|
push @{$data->[$order]},$self->{SETUP}{$tool};
|
244 |
|
|
$self->{internal}{donetools}{$tool}=$order;
|
245 |
sashby |
1.2 |
}
|
246 |
muzaffar |
1.20 |
return $order;
|
247 |
sashby |
1.2 |
}
|
248 |
|
|
|
249 |
muzaffar |
1.20 |
sub _toolsdata_scram()
|
250 |
sashby |
1.2 |
{
|
251 |
muzaffar |
1.20 |
my $self = shift;
|
252 |
|
|
my $tool=shift;
|
253 |
|
|
my $data=shift || [];
|
254 |
|
|
my $order=-1;
|
255 |
|
|
if(exists $self->{internal}{donetools}{$tool}){return $self->{internal}{donetools}{$tool};}
|
256 |
|
|
$self->{internal}{donetools}{$tool}=$order;
|
257 |
|
|
if(!exists $self->{internal}{scram_tools}{$tool}){return $order;}
|
258 |
|
|
use Configuration::ConfigArea;
|
259 |
|
|
use Cache::CacheUtilities;
|
260 |
|
|
my $cache=uc($tool)."_BASE";
|
261 |
|
|
$cache=$self->{SETUP}{$tool}{$cache};
|
262 |
|
|
if (!-d $cache)
|
263 |
|
|
{
|
264 |
|
|
print "ERROR: Release area \"$cache\" for \"$tool\" is not available.\n";
|
265 |
|
|
return $order;
|
266 |
|
|
}
|
267 |
|
|
my $area=Configuration::ConfigArea->new();
|
268 |
|
|
$area->location($cache);
|
269 |
|
|
my $cachefile=$area->toolcachename();
|
270 |
|
|
if (!-f $cachefile)
|
271 |
|
|
{
|
272 |
|
|
print "ERROR: Tools cache file for release area \"$cache\" is not available.\n";
|
273 |
|
|
return $order;
|
274 |
|
|
}
|
275 |
|
|
$cache=&Cache::CacheUtilities::read($cachefile);
|
276 |
|
|
my $tools=$cache->setup();
|
277 |
|
|
$order=scalar(@$data)-1;
|
278 |
|
|
foreach my $use (keys %$tools)
|
279 |
|
|
{
|
280 |
|
|
if ($tools->{$use}->scram_project() == 1)
|
281 |
|
|
{
|
282 |
|
|
my $o=$self->_toolsdata_scram($use,$data);
|
283 |
|
|
if ($o>$order){$order=$o;}
|
284 |
|
|
}
|
285 |
|
|
}
|
286 |
|
|
$order++;
|
287 |
|
|
if(!defined $data->[$order]){$data->[$order]=[];}
|
288 |
|
|
push @{$data->[$order]},$self->{SETUP}{$tool};
|
289 |
|
|
$self->{internal}{donetools}{$tool}=$order;
|
290 |
|
|
return $order;
|
291 |
|
|
}
|
292 |
sashby |
1.2 |
|
293 |
|
|
sub checkifsetup()
|
294 |
|
|
{
|
295 |
|
|
my $self=shift;
|
296 |
|
|
my ($tool)=@_;
|
297 |
|
|
# Return the ToolData object if the tool has been set up:
|
298 |
|
|
(exists $self->{SETUP}->{$tool}) ? return ($self->{SETUP}->{$tool})
|
299 |
|
|
: return undef;
|
300 |
|
|
}
|
301 |
|
|
|
302 |
|
|
sub remove_tool()
|
303 |
|
|
{
|
304 |
|
|
my $self=shift;
|
305 |
|
|
my ($toolname)=@_;
|
306 |
muzaffar |
1.20 |
my $tool = $self->{SETUP}{$toolname};
|
307 |
|
|
if ($tool->scram_compiler() == 1)
|
308 |
sashby |
1.2 |
{
|
309 |
muzaffar |
1.20 |
while (my ($langtype, $ctool) = each %{$self->{SCRAM_COMPILER}})
|
310 |
|
|
{
|
311 |
|
|
if ($toolname eq $ctool->[0]){delete $self->{SCRAM_COMPILER}->{$langtype};}
|
312 |
sashby |
1.2 |
}
|
313 |
|
|
}
|
314 |
muzaffar |
1.20 |
delete $self->{SETUP}{$toolname};
|
315 |
|
|
print "Deleting $toolname from cache.","\n";
|
316 |
|
|
$self->updatetooltimestamp (undef, $toolname);
|
317 |
sashby |
1.2 |
$self->writecache();
|
318 |
muzaffar |
1.20 |
my $file1=$self->{toolcache}."/selected/${toolname}.xml";
|
319 |
|
|
my $file2=$self->{toolcache}."/available/${toolname}.xml";
|
320 |
|
|
if ((!-f $file2) && (-f $file1))
|
321 |
|
|
{
|
322 |
|
|
use File::Copy;
|
323 |
|
|
copy ($file1,$file2);
|
324 |
|
|
}
|
325 |
|
|
unlink ($file1);
|
326 |
sashby |
1.2 |
}
|
327 |
|
|
|
328 |
|
|
sub scram_projects()
|
329 |
|
|
{
|
330 |
|
|
my $self=shift;
|
331 |
|
|
my $scram_projects={};
|
332 |
|
|
|
333 |
|
|
foreach my $t ($self->tools())
|
334 |
|
|
{
|
335 |
|
|
# Get the ToolData object:
|
336 |
|
|
my $td=$self->{SETUP}->{$t};
|
337 |
|
|
$scram_projects->{$t}=$td->variable_data(uc($t)."_BASE"), if ($td->scram_project());
|
338 |
|
|
}
|
339 |
|
|
|
340 |
|
|
return $scram_projects;
|
341 |
|
|
}
|
342 |
|
|
|
343 |
sashby |
1.8 |
sub scram_compiler()
|
344 |
|
|
{
|
345 |
|
|
my $self=shift;
|
346 |
|
|
my ($langtype, $toolname, $compilername)=@_;
|
347 |
|
|
|
348 |
|
|
if ($langtype)
|
349 |
|
|
{
|
350 |
|
|
# Store the compiler info according to supported
|
351 |
|
|
# language types.
|
352 |
|
|
#
|
353 |
|
|
# ---------------------- e.g C++ cxxcompiler gcc323
|
354 |
|
|
$self->{SCRAM_COMPILER}->{$langtype}=[ $toolname, $compilername ];
|
355 |
|
|
}
|
356 |
|
|
else
|
357 |
|
|
{
|
358 |
|
|
return $self->{SCRAM_COMPILER};
|
359 |
|
|
}
|
360 |
|
|
}
|
361 |
|
|
|
362 |
sashby |
1.16 |
sub updatetooltimestamp ()
|
363 |
|
|
{
|
364 |
|
|
my $self=shift;
|
365 |
|
|
my $obj=shift;
|
366 |
|
|
my $toolname=shift;
|
367 |
|
|
my $samevalues=0;
|
368 |
muzaffar |
1.18 |
my $stampdir = $self->{archstore}."/timestamps";
|
369 |
|
|
my $stampfile="${stampdir}/${toolname}";
|
370 |
sashby |
1.16 |
if (exists $self->{SETUP}->{$toolname})
|
371 |
|
|
{
|
372 |
|
|
$samevalues=$self->comparetoolsdata($self->{SETUP}->{$toolname},$obj);
|
373 |
|
|
}
|
374 |
muzaffar |
1.20 |
if ($toolname ne "self")
|
375 |
|
|
{
|
376 |
|
|
my $instdir = $self->{archstore}."/InstalledTools";
|
377 |
|
|
my $tfile = "${instdir}/${toolname}";
|
378 |
|
|
if ((!defined $obj) && (-f $tfile)) {unlink $tfile;}
|
379 |
|
|
elsif ((defined $obj) && (!-f $tfile))
|
380 |
|
|
{
|
381 |
|
|
Utilities::AddDir::adddir($instdir);
|
382 |
|
|
my $ref;
|
383 |
|
|
open($ref,">$tfile");
|
384 |
|
|
close($ref);
|
385 |
|
|
}
|
386 |
|
|
}
|
387 |
muzaffar |
1.18 |
if ((!$samevalues) || (!-f $stampfile))
|
388 |
sashby |
1.16 |
{
|
389 |
muzaffar |
1.18 |
if (!-d $stampdir)
|
390 |
sashby |
1.16 |
{
|
391 |
muzaffar |
1.20 |
Utilities::AddDir::adddir($stampdir);
|
392 |
sashby |
1.16 |
}
|
393 |
muzaffar |
1.20 |
my $ref;
|
394 |
|
|
open($ref,">$stampfile");
|
395 |
|
|
close($ref);
|
396 |
|
|
if (!$samevalues){$self->dirty();}
|
397 |
sashby |
1.16 |
}
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
sub comparetoolsdata ()
|
401 |
|
|
{
|
402 |
|
|
my $self=shift;
|
403 |
|
|
my $data1=shift || ();
|
404 |
|
|
my $data2=shift || ();
|
405 |
|
|
|
406 |
|
|
my $ref1=ref($data1);
|
407 |
|
|
my $ref2=ref($data2);
|
408 |
|
|
|
409 |
|
|
if ($ref1 ne $ref2)
|
410 |
|
|
{
|
411 |
|
|
return 0;
|
412 |
|
|
}
|
413 |
|
|
elsif ($ref1 eq "CODE")
|
414 |
|
|
{
|
415 |
|
|
return 1;
|
416 |
|
|
}
|
417 |
|
|
elsif(($ref1 eq "SCALAR") || ($ref1 eq ""))
|
418 |
|
|
{
|
419 |
|
|
if ($data1 eq $data2)
|
420 |
|
|
{
|
421 |
|
|
return 1;
|
422 |
|
|
}
|
423 |
|
|
return 0;
|
424 |
|
|
}
|
425 |
|
|
elsif ($ref1 eq "ARRAY")
|
426 |
|
|
{
|
427 |
|
|
my $count = scalar(@$data1);
|
428 |
|
|
if ($count != scalar(@$data2))
|
429 |
|
|
{
|
430 |
|
|
return 0;
|
431 |
|
|
}
|
432 |
|
|
for (my $i=0; $i<$count; $i++)
|
433 |
|
|
{
|
434 |
|
|
if (! $self->comparetoolsdata($data1->[$i],$data2->[$i]))
|
435 |
|
|
{
|
436 |
|
|
return 0;
|
437 |
|
|
}
|
438 |
|
|
}
|
439 |
|
|
return 1;
|
440 |
|
|
}
|
441 |
|
|
else
|
442 |
|
|
{
|
443 |
|
|
foreach my $k (keys %{$data1})
|
444 |
|
|
{
|
445 |
|
|
if (! exists $data2->{$k})
|
446 |
|
|
{
|
447 |
|
|
return 0;
|
448 |
|
|
}
|
449 |
|
|
}
|
450 |
|
|
foreach my $k (keys %{$data2})
|
451 |
|
|
{
|
452 |
|
|
if (! exists $data1->{$k})
|
453 |
|
|
{
|
454 |
|
|
return 0;
|
455 |
|
|
}
|
456 |
|
|
}
|
457 |
|
|
foreach my $k (keys %{$data2})
|
458 |
|
|
{
|
459 |
|
|
if (! $self->comparetoolsdata($data1->{$k},$data2->{$k}))
|
460 |
|
|
{
|
461 |
|
|
return 0;
|
462 |
|
|
}
|
463 |
|
|
}
|
464 |
|
|
return 1;
|
465 |
|
|
}
|
466 |
|
|
}
|
467 |
|
|
|
468 |
sashby |
1.2 |
1;
|