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

Comparing COMP/SCRAM/src/Configuration/ConfigArea.pm (file contents):
Revision 1.18 by williamc, Fri Sep 22 08:05:47 2000 UTC vs.
Revision 1.22 by sashby, Tue Dec 4 19:24:04 2001 UTC

# Line 37 | Line 37
37   # save()                        : save changes permanently
38   # linkto(location)              : link the current area to that at location
39   # unlinkarea()                  : destroy link (autosave)
40 < # linkarea([ConfigArea])        : get/set a link from the current area to the apec Area Object
40 > # linkarea([ConfigArea])        : link the current area to the apec Area Object
41   # archname()            : get/set a string to indicate architecture
42   # archdir()             : return the location of the administration arch dep
43   #                         directory
# Line 71 | Line 71 | sub new {
71   sub cache {
72          my $self=shift;
73  
74 <        if ( @_ ) {
75 <           $self->{cache}=shift;
76 <        }
77 <        if ( ! defined $self->{cache} ) {
78 <          my $loc=$self->location()."/".$self->{admindir}."/".$self->{cachedir};
79 <          if ( -e $loc  ) {
80 <            $self->{cache}=URL::URLcache->new($loc);
81 <          }
82 <          else {
83 <            $self->{cache}=undef;
84 <          }
85 <        }
86 <        return $self->{cache};
74 >        if ( @_ ) {
75 >           $self->{cache}=shift;
76 >        }
77 >        if ( ! defined $self->{cache} ) {
78 >          my $loc=$self->location()."/".$self->{admindir}."/".$self->{cachedir};
79 >          if ( -e $loc  ) {
80 >            $self->{cache}=URL::URLcache->new($loc);
81 >          }
82 >          else {
83 >            $self->{cache}=undef;
84 >          }
85 >        }
86 >        return $self->{cache};
87   }
88  
89   sub _newcache {
90 <        my $self=shift;
91 <        my $loc=$self->location()."/".$self->{admindir}."/".$self->{cachedir};
92 <        $self->{cache}=URL::URLcache->new($loc);
93 <        return $self->{cache};
90 >        my $self=shift;
91 >        my $loc=$self->location()."/".$self->{admindir}."/".$self->{cachedir};
92 >        $self->{cache}=URL::URLcache->new($loc);
93 >        return $self->{cache};
94   }
95  
96   sub _newobjectstore {
97 <        my $self=shift;
98 <        my $loc=$self->location()."/".$self->{admindir}."/".$self->{dbdir};
99 <        $self->{dbstore}=ObjectUtilities::ObjectStore->new($loc);
100 <        return $self->{dbstore};
101 < }
97 >        my $self=shift;
98 >        my $loc=$self->location()."/".$self->{admindir}."/".$self->{dbdir};
99 >        $self->{dbstore}=ObjectUtilities::ObjectStore->new($loc);
100 >        return $self->{dbstore};
101 > }
102  
103   sub objectstore {
104 <        my $self=shift;
104 >        my $self=shift;
105  
106 <        if ( @_ ) {
107 <            $self->{dbstore}=shift;
108 <        }
109 <        if ( ! defined $self->{dbstore} ) {
110 <          my $loc=$self->location()."/".$self->{admindir}."/".$self->{dbdir};
111 <          if ( -e $loc ) {
112 <            $self->{dbstore}=ObjectUtilities::ObjectStore->new($loc);
113 <          }
114 <          else {
115 <            $self->{dbstore}=undef;
116 <          }
117 <        }
118 <        return $self->{dbstore}
106 >        if ( @_ ) {
107 >            $self->{dbstore}=shift;
108 >        }
109 >        if ( ! defined $self->{dbstore} ) {
110 >          my $loc=$self->location()."/".$self->{admindir}."/".$self->{dbdir};
111 >          if ( -e $loc ) {
112 >            $self->{dbstore}=ObjectUtilities::ObjectStore->new($loc);
113 >          }
114 >          else {
115 >            $self->{dbstore}=undef;
116 >          }
117 >        }
118 >        return $self->{dbstore}
119   }
120  
121   sub name {
# Line 165 | Line 165 | sub setup {
165          # -- add a cache
166          $self->_newcache();
167  
168 <        # -- add an Objectstore
169 <        $self->_newobjectstore();
168 >        # -- add an Objectstore
169 >        $self->_newobjectstore();
170  
171          # -- Save Environment File
172          $self->_SaveEnvFile();
# Line 184 | Line 184 | sub configurationdir {
184   sub toolbox {
185          my $self=shift;
186          if ( ! defined $self->{toolbox} ) {
187 <          $self->{toolbox}=BuildSystem::ToolBox->new($self);
187 >          $self->{toolbox}=BuildSystem::ToolBox->new($self, $ENV{SCRAM_ARCH});
188          }
189          return $self->{toolbox};
190   }
# Line 220 | Line 220 | sub scramversion {
220          return $self->{scramversion};
221   }
222  
223 + sub sitename
224 +   {
225 +   ###############################################################
226 +   # sitename()                                                  #
227 +   ###############################################################
228 +   # modified : Mon Dec  3 15:45:35 2001 / SFA                   #
229 +   # params   :                                                  #
230 +   #          :                                                  #
231 +   #          :                                                  #
232 +   #          :                                                  #
233 +   # function : Read the site name from config/site/sitename and #
234 +   #          : export it.                                       #
235 +   #          :                                                  #
236 +   #          :                                                  #
237 +   ###############################################################
238 +   my $self = shift;
239 +   my $sitefile = $self->location()."/".$self->configurationdir()."/site/sitename";
240 +
241 +   $self->{sitename} = 'CERN'; # Use CERN as the default site name
242 +
243 +   use FileHandle;
244 +   my $sitefh = FileHandle->new();
245 +
246 +   # Be verbose and print file we're going to read:
247 +   $self->verbose(">> Going to try to get sitename from: ".$sitefile." ");
248 +  
249 +   # See if we can read from the file. If not, just
250 +   # use default site name:
251 +   open($sitefh,"<".$sitefile) ||
252 +      do
253 +         {
254 +         $self->verbose(">> Unable to read a site name definition file. Using \'CERN\' as the site name.");
255 +         return $self->{sitename};
256 +         };
257 +  
258 +   $sitename = <$sitefh>;
259 +   chomp($sitename);
260 +   $self->{sitename} = $sitename;
261 +  
262 +   # Close the file (be tidy!);
263 +   close($sitefile);
264 +   # Return:
265 +   return $self->{sitename};
266 +   }
267 +
268 +
269   sub bootstrapfromlocation {
270          my $self=shift;
271  
# Line 254 | Line 300 | sub location {
300  
301   sub searchlocation {
302          my $self=shift;
303 <
303 >        
304          #start search in current directory if not specified
305          my $thispath;
306          if ( @_ ) {
# Line 263 | Line 309 | sub searchlocation {
309          else {
310            $thispath=cwd();
311          }
312 <
312 >        
313          my $rv=0;
314  
315          # chop off any files - we only want dirs
# Line 279 | Line 325 | sub searchlocation {
325              last Sloop;
326            }
327          } while ( ($thispath=~s/(.*)\/.*/$1/)=~/./ ) };
328 <
328 >      
329          return $rv?$thispath:undef;
330   }
331  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines