53 |
|
my $toolbox=shift; |
54 |
|
my $tool; |
55 |
|
|
56 |
< |
foreach $tool ( $self->selectedtools() ) |
56 |
> |
# Only for arch of interest: |
57 |
> |
if ($self->{Arch}) |
58 |
|
{ |
59 |
< |
$self->verbose("Setting Up Tool $tool"); |
60 |
< |
$toolbox->toolsetup($tool, $self->version($tool), $self->toolurl($tool)); |
59 |
> |
# Loop over selected tools: |
60 |
> |
foreach $tool ( $self->selectedtools() ) |
61 |
> |
{ |
62 |
> |
$self->verbose("Setting Up Tool $tool"); |
63 |
> |
# Check to see if we have multiple versions of |
64 |
> |
# this tool (e.g. compilers)-just look for a colon |
65 |
> |
# which is used to separate the version entries: |
66 |
> |
if ( $self->version($tool) =~ /.*:.*$/) |
67 |
> |
{ |
68 |
> |
# If so, extract versions: |
69 |
> |
my @versions=split /:/,$self->version($tool); |
70 |
> |
# Loop over versions of this tool and configure them: |
71 |
> |
foreach my $tversion (@versions) |
72 |
> |
{ |
73 |
> |
$self->verbose(">> Treating multiple versions of tool $tool: $tversion <<"); |
74 |
> |
$toolbox->toolsetup($tool, $tversion, $self->toolurl($tool)); |
75 |
> |
} |
76 |
> |
} |
77 |
> |
else |
78 |
> |
{ |
79 |
> |
$toolbox->toolsetup($tool, $self->version($tool), $self->toolurl($tool)); |
80 |
> |
} |
81 |
> |
} |
82 |
> |
} |
83 |
> |
else |
84 |
> |
{ |
85 |
> |
print "No tools defined for this arch.","\n"; |
86 |
> |
return; |
87 |
|
} |
88 |
|
} |
89 |
|
|
92 |
|
return @{$self->{tools}}; |
93 |
|
} |
94 |
|
|
95 |
< |
sub selectedtools { |
96 |
< |
my $self=shift; |
97 |
< |
my @toollist=(); |
98 |
< |
foreach $tool ( @{$self->{tools}} ) { |
99 |
< |
if ( $self->{selected}{$tool} == 1 ) { |
100 |
< |
push @toollist, $tool; |
101 |
< |
} |
102 |
< |
} |
103 |
< |
return @toollist; |
104 |
< |
} |
95 |
> |
|
96 |
> |
sub selectedtools |
97 |
> |
{ |
98 |
> |
############################################################### |
99 |
> |
# selectedtools() # |
100 |
> |
############################################################### |
101 |
> |
# modified : Wed Dec 5 15:39:39 2001 / SFA # |
102 |
> |
# params : # |
103 |
> |
# : # |
104 |
> |
# : # |
105 |
> |
# : # |
106 |
> |
# function : New version of routine. Return a list of tools # |
107 |
> |
# : that were selected after parsing RequirementsDoc # |
108 |
> |
# : # |
109 |
> |
# : # |
110 |
> |
############################################################### |
111 |
> |
my $self=shift; |
112 |
> |
my @toolarray = (); |
113 |
> |
|
114 |
> |
# Grab the arrays of tools: |
115 |
> |
my ($toolref,$deseltoolref,$unseltoolref) = $self->grabtools(); |
116 |
> |
|
117 |
> |
my @tools = @{$toolref}; |
118 |
> |
my @deseltools = @{$deseltoolref}; |
119 |
> |
my @unseltools = @{$unseltoolref}; |
120 |
> |
|
121 |
> |
if ($#tools == -1) |
122 |
> |
{ |
123 |
> |
$self->verbose(">> No tools SELECTED. Checking for DESELECTED tools"); |
124 |
> |
|
125 |
> |
# No tools "SELECTED". We return the tools that were "UNSELECTED" |
126 |
> |
# (these are the tools that remain after unwanted tools are deselected): |
127 |
> |
if ($#unseltools != -1) |
128 |
> |
{ |
129 |
> |
$self->verbose(">> Using the tools remaining after DESELECTION ops"); |
130 |
> |
# The array has elements: |
131 |
> |
return @unseltools; |
132 |
> |
} |
133 |
> |
else |
134 |
> |
{ |
135 |
> |
$self->verbose(">> No UNSELECTED tools....."); |
136 |
> |
} |
137 |
> |
} |
138 |
> |
else |
139 |
> |
{ |
140 |
> |
# We will return the selected tools but only after checking |
141 |
> |
# for subsequently deselected tools (unlikely but...): |
142 |
> |
foreach $selected (@tools) |
143 |
> |
{ |
144 |
> |
# If the tool exists in the deselected tool array, pass. |
145 |
> |
if ( ! grep /$selected/, @deseltools) |
146 |
> |
{ |
147 |
> |
push @toolarray, $selected; |
148 |
> |
} |
149 |
> |
else |
150 |
> |
{ |
151 |
> |
$self->verbose(">> Tool $selected was subsequently deselected."); |
152 |
> |
} |
153 |
> |
} |
154 |
> |
} |
155 |
> |
return @toolarray; |
156 |
> |
} |
157 |
> |
|
158 |
> |
|
159 |
> |
sub grabtools |
160 |
> |
{ |
161 |
> |
############################################################### |
162 |
> |
# grabtools() # |
163 |
> |
############################################################### |
164 |
> |
# modified : Wed Dec 5 14:41:56 2001 / SFA # |
165 |
> |
# params : # |
166 |
> |
# : # |
167 |
> |
# : # |
168 |
> |
# : # |
169 |
> |
# function : Loop over the tools read from RequirementsDoc # |
170 |
> |
# : and fill arrays for selected, deselected and # |
171 |
> |
# : unselected tools. # |
172 |
> |
# : # |
173 |
> |
############################################################### |
174 |
> |
my $self=shift; |
175 |
> |
my @toollist=(); |
176 |
> |
my @deseltoollist=(); |
177 |
> |
my @unseltoollist=(); |
178 |
> |
|
179 |
> |
foreach $tool ( @{$self->{tools}} ) |
180 |
> |
{ |
181 |
> |
if ( $self->{selected}{$tool} eq "SELECTED" ) |
182 |
> |
{ |
183 |
> |
push @toollist, $tool; |
184 |
> |
} |
185 |
> |
elsif ( $self->{selected}{$tool} eq "DESELECTED" ) |
186 |
> |
{ |
187 |
> |
push @deseltoollist, $tool; |
188 |
> |
} |
189 |
> |
elsif ( $self->{selected}{$tool} eq "UNSELECTED" ) |
190 |
> |
{ |
191 |
> |
push @unseltoollist, $tool; |
192 |
> |
} |
193 |
> |
else |
194 |
> |
{ |
195 |
> |
$self->verbose(">> Looks like an unknown sel flag for tool ".$tool." "); |
196 |
> |
} |
197 |
> |
} |
198 |
> |
return \(@toollist, @deseltoollist, @unseltoollist); |
199 |
> |
} |
200 |
> |
|
201 |
|
|
202 |
|
sub toolcomment { |
203 |
|
my $self=shift; |
286 |
|
|
287 |
|
sub arch { |
288 |
|
my $self=shift; |
289 |
+ |
# $self->arch is the SCRAM_ARCH value: |
290 |
|
if ( @_ ) { |
291 |
|
$self->{arch}=shift |
292 |
|
} |
316 |
|
} |
317 |
|
|
318 |
|
|
319 |
< |
sub download { |
320 |
< |
my $self=shift; |
319 |
> |
sub download |
320 |
> |
{ |
321 |
> |
my $self=shift; |
322 |
> |
my $tool; |
323 |
> |
$| = 1; # Unbuffer the output |
324 |
|
|
325 |
< |
my $tool; |
326 |
< |
foreach $tool ( $self->tools() ) { |
327 |
< |
$self->verbose("Downloading ".$self->toolurl($tool)); |
328 |
< |
# get into the cache |
329 |
< |
$self->{switch}->urlget($self->toolurl($tool)); |
330 |
< |
} |
331 |
< |
} |
325 |
> |
print "Downloading tool descriptions....","\n"; |
326 |
> |
print " "; |
327 |
> |
foreach $tool ( $self->tools() ) |
328 |
> |
{ |
329 |
> |
print "#"; |
330 |
> |
$self->verbose("Downloading ".$self->toolurl($tool)); |
331 |
> |
# get into the cache |
332 |
> |
$self->{switch}->urlget($self->toolurl($tool)); |
333 |
> |
} |
334 |
> |
print "\nDone.","\n","\n"; |
335 |
> |
} |
336 |
|
|
337 |
|
sub _autoselect { |
338 |
|
my $self=shift; |
362 |
|
sub Restrict_end { |
363 |
|
my $self=shift; |
364 |
|
my $name=shift; |
365 |
< |
|
365 |
> |
|
366 |
|
if ( $self->{Arch} ) { |
367 |
|
if ( $#{$self->{restrictstack}} >= 0 ) { |
368 |
|
$self->_autoselect(pop @{$self->{restrictstack}}); |
381 |
|
$self->{switch}->checktag( $name, $hashref, 'version'); |
382 |
|
$self->{switch}->checktag( $name, $hashref, 'name'); |
383 |
|
$self->{switch}->checktag( $name, $hashref, 'url'); |
384 |
< |
|
384 |
> |
|
385 |
|
if ( $self->{reqcontext} == 1 ) { |
386 |
|
$self->{switch}->parseerror( |
387 |
< |
"Open new $name conext without previous </$name>"); |
387 |
> |
"Open new $name context without previous </$name>"); |
388 |
|
} |
389 |
|
$self->{reqcontext}=1; |
390 |
|
$$hashref{'name'}=~tr[A-Z][a-z]; |
391 |
+ |
# Add tool to the tool array: |
392 |
|
push @{$self->{tools}}, $$hashref{'name'}; |
393 |
< |
$self->{version}{$$hashref{'name'}}=$$hashref{'version'}; |
393 |
> |
# If the tool already has an entry, modify the version string to |
394 |
> |
# include both versions. The versions can later be separated and |
395 |
> |
# parsed as normal: |
396 |
> |
if (defined $self->{version}{$$hashref{'name'}}) |
397 |
> |
{ |
398 |
> |
# Don't need an extra entry for this tool onto tool array: |
399 |
> |
pop @{$self->{tools}}, $$hashref{'name'}; |
400 |
> |
# Modify the version string to append the other tool version. |
401 |
> |
# Separate using a colon: |
402 |
> |
my $newversion=$self->{version}{$$hashref{'name'}}.":".$$hashref{'version'}; |
403 |
> |
$self->{version}{$$hashref{'name'}}=$newversion; |
404 |
> |
} |
405 |
> |
else |
406 |
> |
{ |
407 |
> |
$self->{version}{$$hashref{'name'}}=$$hashref{'version'}; |
408 |
> |
} |
409 |
|
# -- make sure the full url is taken |
410 |
|
my $urlobj=$self->{switch}->expandurl($$hashref{'url'}); |
411 |
|
$self->{url}{$$hashref{'name'}}=$urlobj->url(); |
412 |
+ |
# Disable the auto select mechanism. Now, we start with |
413 |
+ |
# all tools having a flag "UNSELECTED". Then we choose |
414 |
+ |
# which we wish to select: |
415 |
+ |
if ( $self->{Arch} ) |
416 |
+ |
{ |
417 |
+ |
$self->{selected}{$$hashref{'name'}}="UNSELECTED"; |
418 |
+ |
} |
419 |
+ |
# Output the tool name here with the value |
420 |
+ |
# of its' select flag: |
421 |
+ |
$self->verbose(">> Tool name: ".$$hashref{'name'}." sel/desel flag value: ". |
422 |
+ |
$self->{selected}{$$hashref{'name'}} ." "); |
423 |
|
|
266 |
– |
# -- selection |
267 |
– |
if ( $self->{Arch} ) { |
268 |
– |
if ( $self->_autoselect() ) { |
269 |
– |
$self->{selected}{$$hashref{'name'}}=1; |
270 |
– |
} |
271 |
– |
else { |
272 |
– |
$self->{selected}{$$hashref{'name'}}=0; |
273 |
– |
} |
274 |
– |
} |
424 |
|
$self->{creqtool}=$$hashref{'name'}; |
425 |
|
$self->{creqversion}=$$hashref{'version'}; |
426 |
|
$self->{reqtext}{$self->{creqtool}}{$self->{creqversion}}=""; |
450 |
|
} |
451 |
|
} |
452 |
|
|
453 |
< |
sub select_start { |
454 |
< |
my $self=shift; |
455 |
< |
my $name=shift; |
456 |
< |
my $hashref=shift; |
457 |
< |
|
458 |
< |
$self->{switch}->checktag( $name, $hashref, 'name'); |
459 |
< |
$$hashref{'name'}=~tr[A-Z][a-z]; |
460 |
< |
if ( $self->{Arch} ) { |
461 |
< |
$self->verbose("Selecting ".$$hashref{'name'}); |
462 |
< |
$self->{selected}{$$hashref{'name'}}=1; |
463 |
< |
} |
464 |
< |
} |
465 |
< |
|
466 |
< |
sub deselect_start { |
467 |
< |
my $self=shift; |
319 |
< |
my $name=shift; |
320 |
< |
my $hashref=shift; |
321 |
< |
|
322 |
< |
$self->{switch}->checktag( $name, $hashref, 'name'); |
323 |
< |
$$hashref{'name'}=~tr[A-Z][a-z]; |
324 |
< |
if ( $self->{Arch} ) { |
325 |
< |
$self->verbose("Deselecting ".$$hashref{'name'}); |
326 |
< |
$self->{selected}{$$hashref{'name'}}=0; |
327 |
< |
} |
328 |
< |
} |
453 |
> |
sub select_start |
454 |
> |
{ |
455 |
> |
my $self=shift; |
456 |
> |
my $name=shift; |
457 |
> |
my $hashref=shift; |
458 |
> |
|
459 |
> |
$self->{switch}->checktag( $name, $hashref, 'name'); |
460 |
> |
$$hashref{'name'}=~tr[A-Z][a-z]; |
461 |
> |
if ( $self->{Arch} ) |
462 |
> |
{ |
463 |
> |
$self->verbose("Selecting ".$$hashref{'name'}); |
464 |
> |
$self->{selected}{$$hashref{'name'}} = "SELECTED"; |
465 |
> |
$self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n"); |
466 |
> |
} |
467 |
> |
} |
468 |
|
|
469 |
< |
sub Arch_Start { |
470 |
< |
my $self=shift; |
471 |
< |
my $name=shift; |
472 |
< |
my $hashref=shift; |
469 |
> |
sub deselect_start |
470 |
> |
{ |
471 |
> |
my $self=shift; |
472 |
> |
my $name=shift; |
473 |
> |
my $hashref=shift; |
474 |
> |
|
475 |
> |
$self->{switch}->checktag( $name, $hashref, 'name'); |
476 |
> |
$$hashref{'name'}=~tr[A-Z][a-z]; |
477 |
> |
if ( $self->{Arch} ) |
478 |
> |
{ |
479 |
> |
$self->verbose("Deselecting ".$$hashref{'name'}); |
480 |
> |
$self->{selected}{$$hashref{'name'}} = "DESELECTED"; |
481 |
> |
$self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n"); |
482 |
> |
} |
483 |
> |
} |
484 |
|
|
485 |
< |
$self->{switch}->checktag($name, $hashref,'name'); |
486 |
< |
|
487 |
< |
( ($self->arch()=~/$$hashref{name}.*/) )? ($self->{Arch}=1) |
488 |
< |
: ($self->{Arch}=0); |
489 |
< |
$self->verbose(($self->{Arch}?"OK":"skipping")." ".$$hashref{name}); |
490 |
< |
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
491 |
< |
push @{$self->{ArchStack}}, $$hashref{'name'}; |
492 |
< |
} |
485 |
> |
sub Arch_Start |
486 |
> |
{ |
487 |
> |
my $self=shift; |
488 |
> |
my $name=shift; |
489 |
> |
my $hashref=shift; |
490 |
> |
# Check the architecture tag: |
491 |
> |
$self->{switch}->checktag($name, $hashref,'name'); |
492 |
> |
# Look for a match between the architecture flag read |
493 |
> |
# from the RequirementsDoc ($$hashref{name}) and scram arch: |
494 |
> |
if ($self->arch() =~ /$$hashref{name}$/) |
495 |
> |
{ |
496 |
> |
print "OK: Arch matches current---","\n"; |
497 |
> |
print "HASHREFNAME= ",$$hashref{name},"\n"; # The tag read from RequirementsDoc |
498 |
> |
print "Scram arch()? ",$self->arch(),"\n"; # Also SCRAM_ARCH |
499 |
> |
# ( ($self->arch()=~/$$hashref{name}.*/) )? ($self->{Arch}=1) |
500 |
> |
# : ($self->{Arch}=0); |
501 |
> |
$self->{Arch}=1; |
502 |
> |
} |
503 |
> |
else |
504 |
> |
{ |
505 |
> |
$self->{Arch}=0; |
506 |
> |
} |
507 |
> |
#elsif ($self->arch() =~ /$$hashref{name}/) |
508 |
> |
# { |
509 |
> |
# } |
510 |
> |
#else |
511 |
> |
# { |
512 |
> |
# } |
513 |
> |
|
514 |
> |
|
515 |
> |
|
516 |
> |
$self->verbose(($self->{Arch}?"OK":"skipping")." ".$$hashref{name}); |
517 |
> |
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
518 |
> |
push @{$self->{ArchStack}}, $$hashref{'name'}; |
519 |
> |
print "ARCHBLOCK: ",@{$self->{ARCHBLOCK}},"\n"; |
520 |
> |
print "ArchStack: ",@{$self->{ArchStack}},"\n"; |
521 |
> |
} |
522 |
|
|
523 |
|
sub Arch_End { |
524 |
|
my $self=shift; |
526 |
|
|
527 |
|
pop @{$self->{ARCHBLOCK}}; |
528 |
|
$self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}]; |
529 |
+ |
print "ARCHBLOCK end: ",@{$self->{ARCHBLOCK}},"\n"; |
530 |
+ |
print "Arch end: ",$self->{Arch},"\n"; |
531 |
|
} |
532 |
|
|
533 |
|
sub disttag { |