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.5 by sashby, Mon Oct 1 16:11:07 2001 UTC vs.
Revision 1.11 by sashby, Wed Dec 5 16:09:40 2001 UTC

# Line 47 | Line 47 | sub url {
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 <           {
57 <           $self->verbose("Setting Up Tool $tool");
58 <           $toolbox->toolsetup($tool, $self->version($tool), $self->toolurl($tool));
59 <           }
60 < }
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 > #  sub selectedtools
69 > #     {
70 > #     my $self=shift;
71 > #     my @toollist=();
72 >
73 > #     foreach $tool (  @{$self->{tools}} )
74 > #        {
75 > #        if ( $self->{selected}{$tool} eq "UNSELECTED" )
76 > #        {
77 > #        $self->verbose(">> Adding tool $tool to list of selected tools");
78 > #        push @toollist, $tool;
79 > #        }
80 > #        $self->verbose(">> Tool $tool was deselected");
81 > #        }
82 > #     return @toollist;
83 > #     }
84 >
85 > ##############################################################
86 >
87 > sub selectedtools
88 >   {
89 >   ###############################################################
90 >   # selectedtools()                                             #
91 >   ###############################################################
92 >   # modified : Wed Dec  5 15:39:39 2001 / SFA                   #
93 >   # params   :                                                  #
94 >   #          :                                                  #
95 >   #          :                                                  #
96 >   #          :                                                  #
97 >   # function : New version of routine. Return a list of tools   #
98 >   #          : that were selected after parsing RequirementsDoc #
99 >   #          :                                                  #
100 >   #          :                                                  #
101 >   ###############################################################
102 >   my $self=shift;
103 >   my @toolarray = ();
104 >  
105 >   # Grab the arrays of tools:
106 >   my ($toolref,$deseltoolref,$unseltoolref) = $self->grabtools();
107 >  
108 >   my @tools = @{$toolref};
109 >   my @deseltools = @{$deseltoolref};
110 >   my @unseltools = @{$unseltoolref};
111 >  
112 >   if ($#tools == -1)
113 >      {
114 >      $self->verbose(">> No tools SELECTED. Checking for DESELECTED tools");
115 >      
116 >      # No tools "SELECTED". We return the tools that were "UNSELECTED"
117 >      # (these are the tools that remain after unwanted tools are deselected):
118 >      if ($#unseltools != -1)
119 >         {
120 >         $self->verbose(">> Using the tools remaining after DESELECTION ops");
121 >         # The array has elements:
122 >         return @unseltools;
123 >         }
124 >      else
125 >         {
126 >         $self->verbose(">> No UNSELECTED tools.....");
127 >         }
128 >      }
129 >   else
130 >      {
131 >      # We will return the selected tools but only after checking
132 >      # for subsequently deselected tools (unlikely but...):
133 >      foreach $selected (@tools)
134 >         {
135 >         # If the tool exists in the deselected tool array, pass.
136 >         if ( ! grep /$selected/, @deseltools)
137 >            {
138 >            push @toolarray, $selected;  
139 >            }
140 >         else
141 >            {
142 >            $self->verbose(">> Tool $selected was subsequently deselected.");
143 >            }
144 >         }
145 >      }
146 >   return @toolarray;
147 >   }
148 >
149 >
150 > sub grabtools
151 >   {
152 >   ###############################################################
153 >   # grabtools()                                                 #
154 >   ###############################################################
155 >   # modified : Wed Dec  5 14:41:56 2001 / SFA                   #
156 >   # params   :                                                  #
157 >   #          :                                                  #
158 >   #          :                                                  #
159 >   #          :                                                  #
160 >   # function : Loop over the tools read from RequirementsDoc    #
161 >   #          : and fill arrays for selected, deselected and     #
162 >   #          : unselected tools.                                #
163 >   #          :                                                  #
164 >   ###############################################################
165 >   my $self=shift;
166 >   my @toollist=();
167 >   my @deseltoollist=();
168 >   my @unseltoollist=();
169 >  
170 >   foreach $tool (  @{$self->{tools}} )
171 >      {
172 >      if ( $self->{selected}{$tool} eq "SELECTED" )
173 >         {
174 >         push @toollist, $tool;
175 >         }
176 >      elsif ( $self->{selected}{$tool} eq "DESELECTED" )
177 >         {
178 >         push @deseltoollist, $tool;
179 >         }
180 >      elsif ( $self->{selected}{$tool} eq "UNSELECTED" )
181 >         {
182 >         push @unseltoollist, $tool;
183 >         }
184 >      else
185 >         {
186 >         $self->verbose(">> Looks like an unknown sel flag for tool ".$tool." ");
187 >         }
188 >      }
189 >   return \(@toollist, @deseltoollist, @unseltoollist);
190 >   }
191 >
192 > ####################################################################
193  
194   sub toolcomment {
195          my $self=shift;
# Line 230 | Line 346 | sub Restrict_start {
346   sub Restrict_end {
347          my $self=shift;
348          my $name=shift;
349 <
349 >        
350          if ( $self->{Arch} ) {
351          if ( $#{$self->{restrictstack}} >= 0 ) {
352            $self->_autoselect(pop @{$self->{restrictstack}});
# Line 249 | Line 365 | sub require_start {
365          $self->{switch}->checktag( $name, $hashref, 'version');
366          $self->{switch}->checktag( $name, $hashref, 'name');
367          $self->{switch}->checktag( $name, $hashref, 'url');
368 <
368 >        
369          if ( $self->{reqcontext} == 1 ) {
370            $self->{switch}->parseerror(
371 <                "Open new $name conext without previous </$name>");
371 >                "Open new $name context without previous </$name>");
372          }
373          $self->{reqcontext}=1;
374          $$hashref{'name'}=~tr[A-Z][a-z];
# Line 262 | Line 378 | sub require_start {
378          my $urlobj=$self->{switch}->expandurl($$hashref{'url'});
379          $self->{url}{$$hashref{'name'}}=$urlobj->url();
380  
381 +
382 +        # Disable the auto select mechanism. Now, we start with
383 +        # all tools having a flag "UNSELECTED". Then we choose
384 +        # which we wish to select:
385 +        if ( $self->{Arch} )
386 +           {
387 +            $self->{selected}{$$hashref{'name'}}="UNSELECTED";
388 +           }
389 +
390          # -- selection
391 <        if ( $self->{Arch} ) {
392 <          if ( $self->_autoselect() ) {
393 <             $self->{selected}{$$hashref{'name'}}=1;
394 <          }
395 <          else {
396 <             $self->{selected}{$$hashref{'name'}}=0;
397 <          }
398 <        }
391 > #       if ( $self->{Arch} ) {
392 > #         if ( $self->_autoselect() ) {
393 > #            $self->{selected}{$$hashref{'name'}}="UNSELECTED";
394 > #         }
395 > #         else {
396 > #            $self->{selected}{$$hashref{'name'}}="DESELECTED";
397 > #         }
398 > #       }
399 >
400 >        # Output the tool name here with the value
401 >        # of its' select flag:
402 >        $self->verbose(">> Tool name: ".$$hashref{'name'}." sel/desel flag value: ".
403 >                       $self->{selected}{$$hashref{'name'}} ." ");
404 >
405          $self->{creqtool}=$$hashref{'name'};
406          $self->{creqversion}=$$hashref{'version'};
407          $self->{reqtext}{$self->{creqtool}}{$self->{creqversion}}="";
# Line 300 | Line 431 | sub require_end {
431          }
432   }
433  
434 < sub select_start {
435 <        my $self=shift;
436 <        my $name=shift;
437 <        my $hashref=shift;
438 <
439 <        $self->{switch}->checktag( $name, $hashref, 'name');
440 <        $$hashref{'name'}=~tr[A-Z][a-z];
441 <        if ( $self->{Arch} ) {
442 <           $self->verbose("Selecting ".$$hashref{'name'});
443 <           $self->{selected}{$$hashref{'name'}}=1;
444 <        }
445 < }
446 <
447 < sub deselect_start {
448 <        my $self=shift;
449 <        my $name=shift;
450 <        my $hashref=shift;
451 <
452 <        $self->{switch}->checktag( $name, $hashref, 'name');
453 <        $$hashref{'name'}=~tr[A-Z][a-z];
454 <        if ( $self->{Arch} ) {
455 <           $self->verbose("Deselecting ".$$hashref{'name'});
456 <           $self->{selected}{$$hashref{'name'}}=0;
457 <        }
458 < }
434 > sub select_start
435 >   {
436 >   my $self=shift;
437 >   my $name=shift;
438 >   my $hashref=shift;
439 >
440 >   $self->{switch}->checktag( $name, $hashref, 'name');
441 >   $$hashref{'name'}=~tr[A-Z][a-z];
442 >   if ( $self->{Arch} )
443 >      {
444 >      $self->verbose("Selecting ".$$hashref{'name'});
445 >      $self->{selected}{$$hashref{'name'}} = "SELECTED";
446 >      $self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n");
447 >      }
448 >   }
449 >
450 > sub deselect_start
451 >   {
452 >   my $self=shift;
453 >   my $name=shift;
454 >   my $hashref=shift;
455 >  
456 >   $self->{switch}->checktag( $name, $hashref, 'name');
457 >   $$hashref{'name'}=~tr[A-Z][a-z];
458 >   if ( $self->{Arch} )
459 >      {
460 >      $self->verbose("Deselecting ".$$hashref{'name'});
461 >      $self->{selected}{$$hashref{'name'}} = "DESELECTED";
462 >      $self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n");
463 >      }
464 >   }
465  
466   sub Arch_Start {
467          my $self=shift;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines