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.6 by sashby, Thu Nov 15 21:18:15 2001 UTC vs.
Revision 1.13 by sashby, Mon Apr 29 16:09:23 2002 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 <        print ">> In Requirements: setup()\n";
54 <        my $tool;
55 <        print ">> Looping over tools: ";
56 <        foreach $tool ( $self->selectedtools() )
57 <           {
58 <           print "\t\t Tool: ",$tool,"\n";
59 <           $self->verbose("Setting Up Tool $tool");
60 <           print "\t\t\tGoing to run toolsetup...using $toolbox","\n";
61 <           $toolbox->toolsetup($tool, $self->version($tool), $self->toolurl($tool));
62 <           }
63 < }
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;
# Line 194 | Line 288 | sub getreqforarch {
288   }
289  
290  
291 < sub download {
292 <        my $self=shift;
293 <
294 <        my $tool;
295 <        foreach $tool ( $self->tools() ) {
296 <          $self->verbose("Downloading ".$self->toolurl($tool));
297 <          # get into the cache
298 <          $self->{switch}->urlget($self->toolurl($tool));
299 <        }
300 < }
291 > sub download
292 >   {
293 >   my $self=shift;
294 >   my $tool;
295 >   $| = 1; # Unbuffer the output
296 >
297 >   print  "Downloading tool descriptions....","\n";
298 >   print  " ";
299 >   foreach $tool ( $self->tools() )
300 >      {
301 >      print "#";
302 >      $self->verbose("Downloading ".$self->toolurl($tool));
303 >      # get into the cache
304 >      $self->{switch}->urlget($self->toolurl($tool));
305 >      }
306 >   print "\nDone.","\n","\n";
307 >   }
308  
309   sub _autoselect {
310          my $self=shift;
# Line 233 | Line 334 | sub Restrict_start {
334   sub Restrict_end {
335          my $self=shift;
336          my $name=shift;
337 <
337 >        
338          if ( $self->{Arch} ) {
339          if ( $#{$self->{restrictstack}} >= 0 ) {
340            $self->_autoselect(pop @{$self->{restrictstack}});
# Line 252 | Line 353 | sub require_start {
353          $self->{switch}->checktag( $name, $hashref, 'version');
354          $self->{switch}->checktag( $name, $hashref, 'name');
355          $self->{switch}->checktag( $name, $hashref, 'url');
356 <
356 >        
357          if ( $self->{reqcontext} == 1 ) {
358            $self->{switch}->parseerror(
359 <                "Open new $name conext without previous </$name>");
359 >                "Open new $name context without previous </$name>");
360          }
361          $self->{reqcontext}=1;
362          $$hashref{'name'}=~tr[A-Z][a-z];
# Line 265 | Line 366 | sub require_start {
366          my $urlobj=$self->{switch}->expandurl($$hashref{'url'});
367          $self->{url}{$$hashref{'name'}}=$urlobj->url();
368  
369 <        # -- selection
370 <        if ( $self->{Arch} ) {
371 <          if ( $self->_autoselect() ) {
372 <             $self->{selected}{$$hashref{'name'}}=1;
373 <          }
374 <          else {
375 <             $self->{selected}{$$hashref{'name'}}=0;
376 <          }
377 <        }
369 >
370 >        # Disable the auto select mechanism. Now, we start with
371 >        # all tools having a flag "UNSELECTED". Then we choose
372 >        # which we wish to select:
373 >        if ( $self->{Arch} )
374 >           {
375 >            $self->{selected}{$$hashref{'name'}}="UNSELECTED";
376 >           }
377 >        # Output the tool name here with the value
378 >        # of its' select flag:
379 >        $self->verbose(">> Tool name: ".$$hashref{'name'}." sel/desel flag value: ".
380 >                       $self->{selected}{$$hashref{'name'}} ." ");
381 >
382          $self->{creqtool}=$$hashref{'name'};
383          $self->{creqversion}=$$hashref{'version'};
384          $self->{reqtext}{$self->{creqtool}}{$self->{creqversion}}="";
# Line 303 | Line 408 | sub require_end {
408          }
409   }
410  
411 < sub select_start {
412 <        my $self=shift;
413 <        my $name=shift;
414 <        my $hashref=shift;
415 <
416 <        $self->{switch}->checktag( $name, $hashref, 'name');
417 <        $$hashref{'name'}=~tr[A-Z][a-z];
418 <        if ( $self->{Arch} ) {
419 <           $self->verbose("Selecting ".$$hashref{'name'});
420 <           $self->{selected}{$$hashref{'name'}}=1;
421 <        }
422 < }
423 <
424 < sub deselect_start {
425 <        my $self=shift;
426 <        my $name=shift;
427 <        my $hashref=shift;
428 <
429 <        $self->{switch}->checktag( $name, $hashref, 'name');
430 <        $$hashref{'name'}=~tr[A-Z][a-z];
431 <        if ( $self->{Arch} ) {
432 <           $self->verbose("Deselecting ".$$hashref{'name'});
433 <           $self->{selected}{$$hashref{'name'}}=0;
434 <        }
435 < }
411 > sub select_start
412 >   {
413 >   my $self=shift;
414 >   my $name=shift;
415 >   my $hashref=shift;
416 >
417 >   $self->{switch}->checktag( $name, $hashref, 'name');
418 >   $$hashref{'name'}=~tr[A-Z][a-z];
419 >   if ( $self->{Arch} )
420 >      {
421 >      $self->verbose("Selecting ".$$hashref{'name'});
422 >      $self->{selected}{$$hashref{'name'}} = "SELECTED";
423 >      $self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n");
424 >      }
425 >   }
426 >
427 > sub deselect_start
428 >   {
429 >   my $self=shift;
430 >   my $name=shift;
431 >   my $hashref=shift;
432 >  
433 >   $self->{switch}->checktag( $name, $hashref, 'name');
434 >   $$hashref{'name'}=~tr[A-Z][a-z];
435 >   if ( $self->{Arch} )
436 >      {
437 >      $self->verbose("Deselecting ".$$hashref{'name'});
438 >      $self->{selected}{$$hashref{'name'}} = "DESELECTED";
439 >      $self->verbose(">> Tool select flag = ".$self->{selected}{$$hashref{'name'}}."\n");
440 >      }
441 >   }
442  
443   sub Arch_Start {
444          my $self=shift;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines