47 |
|
return $self->{file} |
48 |
|
} |
49 |
|
|
50 |
< |
sub setup { |
51 |
< |
my $self=shift; |
52 |
< |
my $toolbox=shift; |
53 |
< |
|
54 |
< |
my $tool; |
55 |
< |
foreach $tool ( $self->selectedtools() ) { |
56 |
< |
$self->verbose("Setting Up Tool $tool"); |
57 |
< |
$toolbox->toolsetup($tool, $self->version($tool), $self->toolurl($tool)); |
58 |
< |
} |
59 |
< |
} |
50 |
> |
sub setup |
51 |
> |
{ |
52 |
> |
my $self=shift; |
53 |
> |
my $toolbox=shift; |
54 |
> |
my $tool; |
55 |
> |
|
56 |
> |
foreach $tool ( $self->selectedtools() ) |
57 |
> |
{ |
58 |
> |
$self->verbose("Setting Up Tool $tool"); |
59 |
> |
$toolbox->toolsetup($tool, $self->version($tool), $self->toolurl($tool)); |
60 |
> |
} |
61 |
> |
} |
62 |
|
|
63 |
|
sub tools { |
64 |
|
my $self=shift; |
65 |
|
return @{$self->{tools}}; |
66 |
|
} |
67 |
|
|
68 |
< |
sub selectedtools { |
69 |
< |
my $self=shift; |
70 |
< |
my @toollist=(); |
71 |
< |
foreach $tool ( @{$self->{tools}} ) { |
72 |
< |
if ( $self->{selected}{$tool} == 1 ) { |
73 |
< |
push @toollist, $tool; |
74 |
< |
} |
75 |
< |
} |
76 |
< |
return @toollist; |
77 |
< |
} |
68 |
> |
|
69 |
> |
sub selectedtools |
70 |
> |
{ |
71 |
> |
############################################################### |
72 |
> |
# selectedtools() # |
73 |
> |
############################################################### |
74 |
> |
# modified : Wed Dec 5 15:39:39 2001 / SFA # |
75 |
> |
# params : # |
76 |
> |
# : # |
77 |
> |
# : # |
78 |
> |
# : # |
79 |
> |
# function : New version of routine. Return a list of tools # |
80 |
> |
# : that were selected after parsing RequirementsDoc # |
81 |
> |
# : # |
82 |
> |
# : # |
83 |
> |
############################################################### |
84 |
> |
my $self=shift; |
85 |
> |
my @toolarray = (); |
86 |
> |
|
87 |
> |
# Grab the arrays of tools: |
88 |
> |
my ($toolref,$deseltoolref,$unseltoolref) = $self->grabtools(); |
89 |
> |
|
90 |
> |
my @tools = @{$toolref}; |
91 |
> |
my @deseltools = @{$deseltoolref}; |
92 |
> |
my @unseltools = @{$unseltoolref}; |
93 |
> |
|
94 |
> |
if ($#tools == -1) |
95 |
> |
{ |
96 |
> |
$self->verbose(">> No tools SELECTED. Checking for DESELECTED tools"); |
97 |
> |
|
98 |
> |
# No tools "SELECTED". We return the tools that were "UNSELECTED" |
99 |
> |
# (these are the tools that remain after unwanted tools are deselected): |
100 |
> |
if ($#unseltools != -1) |
101 |
> |
{ |
102 |
> |
$self->verbose(">> Using the tools remaining after DESELECTION ops"); |
103 |
> |
# The array has elements: |
104 |
> |
return @unseltools; |
105 |
> |
} |
106 |
> |
else |
107 |
> |
{ |
108 |
> |
$self->verbose(">> No UNSELECTED tools....."); |
109 |
> |
} |
110 |
> |
} |
111 |
> |
else |
112 |
> |
{ |
113 |
> |
# We will return the selected tools but only after checking |
114 |
> |
# for subsequently deselected tools (unlikely but...): |
115 |
> |
foreach $selected (@tools) |
116 |
> |
{ |
117 |
> |
# If the tool exists in the deselected tool array, pass. |
118 |
> |
if ( ! grep /$selected/, @deseltools) |
119 |
> |
{ |
120 |
> |
push @toolarray, $selected; |
121 |
> |
} |
122 |
> |
else |
123 |
> |
{ |
124 |
> |
$self->verbose(">> Tool $selected was subsequently deselected."); |
125 |
> |
} |
126 |
> |
} |
127 |
> |
} |
128 |
> |
return @toolarray; |
129 |
> |
} |
130 |
> |
|
131 |
> |
|
132 |
> |
sub grabtools |
133 |
> |
{ |
134 |
> |
############################################################### |
135 |
> |
# grabtools() # |
136 |
> |
############################################################### |
137 |
> |
# modified : Wed Dec 5 14:41:56 2001 / SFA # |
138 |
> |
# params : # |
139 |
> |
# : # |
140 |
> |
# : # |
141 |
> |
# : # |
142 |
> |
# function : Loop over the tools read from RequirementsDoc # |
143 |
> |
# : and fill arrays for selected, deselected and # |
144 |
> |
# : unselected tools. # |
145 |
> |
# : # |
146 |
> |
############################################################### |
147 |
> |
my $self=shift; |
148 |
> |
my @toollist=(); |
149 |
> |
my @deseltoollist=(); |
150 |
> |
my @unseltoollist=(); |
151 |
> |
|
152 |
> |
foreach $tool ( @{$self->{tools}} ) |
153 |
> |
{ |
154 |
> |
if ( $self->{selected}{$tool} eq "SELECTED" ) |
155 |
> |
{ |
156 |
> |
push @toollist, $tool; |
157 |
> |
} |
158 |
> |
elsif ( $self->{selected}{$tool} eq "DESELECTED" ) |
159 |
> |
{ |
160 |
> |
push @deseltoollist, $tool; |
161 |
> |
} |
162 |
> |
elsif ( $self->{selected}{$tool} eq "UNSELECTED" ) |
163 |
> |
{ |
164 |
> |
push @unseltoollist, $tool; |
165 |
> |
} |
166 |
> |
else |
167 |
> |
{ |
168 |
> |
$self->verbose(">> Looks like an unknown sel flag for tool ".$tool." "); |
169 |
> |
} |
170 |
> |
} |
171 |
> |
return \(@toollist, @deseltoollist, @unseltoollist); |
172 |
> |
} |
173 |
> |
|
174 |
|
|
175 |
|
sub toolcomment { |
176 |
|
my $self=shift; |
259 |
|
|
260 |
|
sub arch { |
261 |
|
my $self=shift; |
262 |
+ |
# $self->arch is the SCRAM_ARCH value: |
263 |
|
if ( @_ ) { |
264 |
|
$self->{arch}=shift |
265 |
|
} |
289 |
|
} |
290 |
|
|
291 |
|
|
292 |
< |
sub download { |
293 |
< |
my $self=shift; |
294 |
< |
|
295 |
< |
my $tool; |
296 |
< |
foreach $tool ( $self->tools() ) { |
297 |
< |
$self->verbose("Downloading ".$self->toolurl($tool)); |
298 |
< |
# get into the cache |
299 |
< |
$self->{switch}->urlget($self->toolurl($tool)); |
300 |
< |
} |
301 |
< |
} |
292 |
> |
sub download |
293 |
> |
{ |
294 |
> |
my $self=shift; |
295 |
> |
my $tool; |
296 |
> |
$| = 1; # Unbuffer the output |
297 |
> |
|
298 |
> |
print "Downloading tool descriptions....","\n"; |
299 |
> |
print " "; |
300 |
> |
foreach $tool ( $self->tools() ) |
301 |
> |
{ |
302 |
> |
print "#"; |
303 |
> |
$self->verbose("Downloading ".$self->toolurl($tool)); |
304 |
> |
# get into the cache |
305 |
> |
$self->{switch}->urlget($self->toolurl($tool)); |
306 |
> |
} |
307 |
> |
print "\nDone.","\n","\n"; |
308 |
> |
} |
309 |
|
|
310 |
|
sub _autoselect { |
311 |
|
my $self=shift; |
335 |
|
sub Restrict_end { |
336 |
|
my $self=shift; |
337 |
|
my $name=shift; |
338 |
< |
|
338 |
> |
|
339 |
|
if ( $self->{Arch} ) { |
340 |
|
if ( $#{$self->{restrictstack}} >= 0 ) { |
341 |
|
$self->_autoselect(pop @{$self->{restrictstack}}); |
354 |
|
$self->{switch}->checktag( $name, $hashref, 'version'); |
355 |
|
$self->{switch}->checktag( $name, $hashref, 'name'); |
356 |
|
$self->{switch}->checktag( $name, $hashref, 'url'); |
357 |
< |
|
357 |
> |
|
358 |
|
if ( $self->{reqcontext} == 1 ) { |
359 |
|
$self->{switch}->parseerror( |
360 |
< |
"Open new $name conext without previous </$name>"); |
360 |
> |
"Open new $name context without previous </$name>"); |
361 |
|
} |
362 |
|
$self->{reqcontext}=1; |
363 |
|
$$hashref{'name'}=~tr[A-Z][a-z]; |
364 |
+ |
print "Adding ",$$hashref{'name'}," to the tool stack","\n"; |
365 |
|
push @{$self->{tools}}, $$hashref{'name'}; |
366 |
|
$self->{version}{$$hashref{'name'}}=$$hashref{'version'}; |
367 |
+ |
print " version: ",$self->{version}{$$hashref{'name'}},"\n"; |
368 |
|
# -- make sure the full url is taken |
369 |
|
my $urlobj=$self->{switch}->expandurl($$hashref{'url'}); |
370 |
|
$self->{url}{$$hashref{'name'}}=$urlobj->url(); |
371 |
|
|
372 |
< |
# -- selection |
373 |
< |
if ( $self->{Arch} ) { |
374 |
< |
if ( $self->_autoselect() ) { |
375 |
< |
$self->{selected}{$$hashref{'name'}}=1; |
376 |
< |
} |
377 |
< |
else { |
378 |
< |
$self->{selected}{$$hashref{'name'}}=0; |
379 |
< |
} |
380 |
< |
} |
372 |
> |
# Disable the auto select mechanism. Now, we start with |
373 |
> |
# all tools having a flag "UNSELECTED". Then we choose |
374 |
> |
# which we wish to select: |
375 |
> |
if ( $self->{Arch} ) |
376 |
> |
{ |
377 |
> |
$self->{selected}{$$hashref{'name'}}="UNSELECTED"; |
378 |
> |
} |
379 |
> |
# Output the tool name here with the value |
380 |
> |
# of its' select flag: |
381 |
> |
$self->verbose(">> Tool name: ".$$hashref{'name'}." sel/desel flag value: ". |
382 |
> |
$self->{selected}{$$hashref{'name'}} ." "); |
383 |
> |
|
384 |
|
$self->{creqtool}=$$hashref{'name'}; |
385 |
|
$self->{creqversion}=$$hashref{'version'}; |
386 |
|
$self->{reqtext}{$self->{creqtool}}{$self->{creqversion}}=""; |
410 |
|
} |
411 |
|
} |
412 |
|
|
413 |
< |
sub select_start { |
414 |
< |
my $self=shift; |
415 |
< |
my $name=shift; |
416 |
< |
my $hashref=shift; |
417 |
< |
|
418 |
< |
$self->{switch}->checktag( $name, $hashref, 'name'); |
419 |
< |
$$hashref{'name'}=~tr[A-Z][a-z]; |
420 |
< |
if ( $self->{Arch} ) { |
421 |
< |
$self->verbose("Selecting ".$$hashref{'name'}); |
422 |
< |
$self->{selected}{$$hashref{'name'}}=1; |
423 |
< |
} |
424 |
< |
} |
425 |
< |
|
426 |
< |
sub deselect_start { |
427 |
< |
my $self=shift; |
428 |
< |
my $name=shift; |
429 |
< |
my $hashref=shift; |
430 |
< |
|
431 |
< |
$self->{switch}->checktag( $name, $hashref, 'name'); |
432 |
< |
$$hashref{'name'}=~tr[A-Z][a-z]; |
433 |
< |
if ( $self->{Arch} ) { |
434 |
< |
$self->verbose("Deselecting ".$$hashref{'name'}); |
435 |
< |
$self->{selected}{$$hashref{'name'}}=0; |
436 |
< |
} |
437 |
< |
} |
438 |
< |
|
439 |
< |
sub Arch_Start { |
440 |
< |
my $self=shift; |
441 |
< |
my $name=shift; |
442 |
< |
my $hashref=shift; |
443 |
< |
|
444 |
< |
$self->{switch}->checktag($name, $hashref,'name'); |
445 |
< |
|
446 |
< |
( ($self->arch()=~/$$hashref{name}.*/) )? ($self->{Arch}=1) |
447 |
< |
: ($self->{Arch}=0); |
448 |
< |
$self->verbose(($self->{Arch}?"OK":"skipping")." ".$$hashref{name}); |
449 |
< |
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
450 |
< |
push @{$self->{ArchStack}}, $$hashref{'name'}; |
451 |
< |
} |
413 |
> |
sub select_start |
414 |
> |
{ |
415 |
> |
my $self=shift; |
416 |
> |
my $name=shift; |
417 |
> |
my $hashref=shift; |
418 |
> |
|
419 |
> |
$self->{switch}->checktag( $name, $hashref, 'name'); |
420 |
> |
$$hashref{'name'}=~tr[A-Z][a-z]; |
421 |
> |
if ( $self->{Arch} ) |
422 |
> |
{ |
423 |
> |
$self->verbose("Selecting ".$$hashref{'name'}); |
424 |
> |
$self->{selected}{$$hashref{'name'}} = "SELECTED"; |
425 |
> |
$self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n"); |
426 |
> |
} |
427 |
> |
} |
428 |
> |
|
429 |
> |
sub deselect_start |
430 |
> |
{ |
431 |
> |
my $self=shift; |
432 |
> |
my $name=shift; |
433 |
> |
my $hashref=shift; |
434 |
> |
|
435 |
> |
$self->{switch}->checktag( $name, $hashref, 'name'); |
436 |
> |
$$hashref{'name'}=~tr[A-Z][a-z]; |
437 |
> |
if ( $self->{Arch} ) |
438 |
> |
{ |
439 |
> |
$self->verbose("Deselecting ".$$hashref{'name'}); |
440 |
> |
$self->{selected}{$$hashref{'name'}} = "DESELECTED"; |
441 |
> |
$self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n"); |
442 |
> |
} |
443 |
> |
} |
444 |
> |
|
445 |
> |
sub Arch_Start |
446 |
> |
{ |
447 |
> |
my $self=shift; |
448 |
> |
my $name=shift; |
449 |
> |
my $hashref=shift; |
450 |
> |
# Check the architecture tag: |
451 |
> |
$self->{switch}->checktag($name, $hashref,'name'); |
452 |
> |
# Look for a match between the architecture flag read |
453 |
> |
# from the RequirementsDoc ($$hashref{name}) and scram arch: |
454 |
> |
#if ($self->arch() =~ /$$hashref{name}.*/) |
455 |
> |
# { |
456 |
> |
|
457 |
> |
# } |
458 |
> |
#elsif ($self->arch() =~ /$$hashref{name}/) |
459 |
> |
# { |
460 |
> |
# } |
461 |
> |
#else |
462 |
> |
# { |
463 |
> |
# } |
464 |
> |
( ($self->arch()=~/$$hashref{name}.*/) )? ($self->{Arch}=1) |
465 |
> |
: ($self->{Arch}=0); |
466 |
> |
# ( ($self->arch()=~/$$hashref{name}[BLAH]/) )? ($self->{Arch}=1) |
467 |
> |
# : ($self->{Arch}=0); |
468 |
> |
|
469 |
> |
|
470 |
> |
$self->verbose(($self->{Arch}?"OK":"skipping")." ".$$hashref{name}); |
471 |
> |
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
472 |
> |
push @{$self->{ArchStack}}, $$hashref{'name'}; |
473 |
> |
} |
474 |
|
|
475 |
|
sub Arch_End { |
476 |
|
my $self=shift; |