ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Requirements.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/Requirements.pm (file contents):
Revision 1.8 by sashby, Thu Nov 29 12:56:11 2001 UTC vs.
Revision 1.14 by sashby, Fri Oct 11 14:23:24 2002 UTC

# Line 65 | Line 65 | sub tools {
65          return @{$self->{tools}};
66   }
67  
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 @toollist=();
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;
171 >   return \(@toollist, @deseltoollist, @unseltoollist);
172     }
173  
174 +
175   sub toolcomment {
176          my $self=shift;
177          my $tool=shift;
# Line 167 | Line 259 | sub init {
259  
260   sub arch {
261          my $self=shift;
262 +        # $self->arch is the SCRAM_ARCH value:
263          if ( @_ ) {
264            $self->{arch}=shift
265          }
# Line 196 | Line 289 | sub getreqforarch {
289   }
290  
291  
292 < sub download {
293 <        my $self=shift;
292 > sub download
293 >   {
294 >   my $self=shift;
295 >   my $tool;
296 >   $| = 1; # Unbuffer the output
297  
298 <        my $tool;
299 <        foreach $tool ( $self->tools() ) {
300 <          $self->verbose("Downloading ".$self->toolurl($tool));
301 <          # get into the cache
302 <          $self->{switch}->urlget($self->toolurl($tool));
303 <        }
304 < }
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;
# Line 235 | Line 335 | sub Restrict_start {
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}});
# Line 254 | Line 354 | sub require_start {
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}}="";
# Line 337 | Line 442 | sub deselect_start
442        }
443     }
444  
445 < sub Arch_Start {
446 <        my $self=shift;
447 <        my $name=shift;
448 <        my $hashref=shift;
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 <        $self->{switch}->checktag($name, $hashref,'name');
470 <        
471 <        ( ($self->arch()=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
472 <                                                : ($self->{Arch}=0);
473 <        $self->verbose(($self->{Arch}?"OK":"skipping")." ".$$hashref{name});
350 <        push @{$self->{ARCHBLOCK}}, $self->{Arch};
351 <        push @{$self->{ArchStack}}, $$hashref{'name'};
352 < }
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines