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

Comparing COMP/SCRAM/src/Scram/ScramProjectDB.pm (file contents):
Revision 1.3 by williamc, Wed Nov 15 10:08:27 2000 UTC vs.
Revision 1.6 by sashby, Mon Jun 18 15:19:51 2001 UTC

# Line 41 | Line 41 | sub file {
41   }
42  
43   sub getarea {
44 <        my $self=shift;
44 >        require Configuration::ConfigArea;
45 >        my $self=shift;
46          my $name=shift;
47          my $version=shift;
48  
# Line 86 | Line 87 | sub addarea {
87          my $area=shift;
88  
89          my $rv=1;
89
90        #my $type="_location"; not ready for this yet
90          my $type="file";
91          my $url=$area->location()."/.SCRAM/InstallFile";
92          # -- check for duplicates
93          for ( my $index=0; $index<=$#{$self->{projects}}; $index++ ) {
94           if  ( $self->{projects}[$index][0] eq $name ) {
95            if ( $self->{projects}[$index][1] eq $version ) {
96 <            print "$name $version alreay exists. Overwrite (y/n)\n";
96 >            print "$name $version already exists. Overwrite? (y/n) :";
97              if ( ! (<STDIN>=~/y/i ) ) {
98                          print "Aborting install ...\n";
99                          return 1;
# Line 143 | Line 142 | sub listall {
142          return @list;
143   }
144  
145 < sub removearea {
146 <        my $self=shift;
147 <        my $name=shift;
148 <        my $version=shift;
149 <
150 <        print "Not yet implemented\n";
151 < }
145 > sub removearea
146 >   {
147 >   ###############################################################
148 >   # removearea(name,version)                                    #
149 >   ###############################################################
150 >   # modified : Mon May 28 11:24:29 2001 / SFA                   #
151 >   # params   :                                                  #
152 >   #          :                                                  #
153 >   #          :                                                  #
154 >   #          :                                                  #
155 >   # function : Remove project area from scramdb file.           #
156 >   #          :                                                  #
157 >   #          :                                                  #
158 >   ###############################################################
159 >   my $self=shift;
160 >   my $name=shift;
161 >   my $version=shift;
162 >   my $vfound=0;
163 >   my $nfound=0;
164 >  
165 >   print "\n","Going to remove $name $version from the current scram database.....","\n";
166 >   print "\n";
167 >
168 >   for ( my $index=0; $index<=$#{$self->{projects}}; $index++ )
169 >      {
170 >      # Look for a project with name $name:
171 >      if  ( $self->{projects}[$index][0] eq $name )
172 >         {
173 >         $nfound=1;
174 >         # Check the version:
175 >         if ( $self->{projects}[$index][1] eq $version )
176 >            {
177 >            # We have a match for project name and version:
178 >            $vfound=1;
179 >            print "Project $name Version $version exists. Remove it? (y/n): ";
180 >            if ( ! (<STDIN>=~/y/i ) )
181 >               {
182 >               print "\n","Aborting project removal...bye.\n\n";
183 >               return 1;
184 >               }
185 >            else
186 >               {
187 >               # Remove the project:
188 >               print "\n";
189 >               print "Removing project:\t$name\t$version","\n\n";
190 >               splice(@{$self->{projects}},$index,1);
191 >               }
192 >            }
193 >         }
194 >      }
195 >  
196 >   if ( ! $nfound || ! $vfound )
197 >      {
198 >      # There was a problem finding either the
199 >      # named project or the desired version:
200 >      print "ERROR: Unable to find project $name with version $version in the database.","\n\n";
201 >      return 1;
202 >      }
203 >  
204 >   print "\n";  
205 >   # Save our new array:
206 >   $self->_save();
207 >   return 0;
208 >   }
209  
210   sub link {
211          my $self=shift;
# Line 163 | Line 219 | sub link {
219   sub unlink {
220          my $self=shift;
221          my $file=shift;
166
222          my $db;
223 +        
224          for (my $i=0; $i<=$#{$self->{linkeddbs}}; $i++ ) {
225             $db=${$self->{linkeddbs}}[$i];
226             if  ( $db->file() eq $file ) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines