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.13.2.6.2.3 by williamc, Tue Aug 8 11:11:58 2000 UTC vs.
Revision 1.13.2.6.2.7.2.4 by williamc, Mon Oct 9 17:36:59 2000 UTC

# Line 38 | Line 38
38   # linkto(location)              : link the current area to that at location
39   # unlinkarea()                  : destroy link (autosave)
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
44 + # objectstore()         : return the objectStore object of the area
45   # - temporary
46   # align()                       : adjust hard paths to suit local loaction
47  
# Line 46 | Line 50 | require 5.004;
50   use URL::URLcache;
51   use Utilities::AddDir;
52   use Utilities::Verbose;
53 + use ObjectUtilities::ObjectStore;
54   use Cwd;
55   @ISA=qw(Utilities::Verbose);
56  
# Line 57 | Line 62 | sub new {
62          # data init
63          $self->{admindir}=".SCRAM";
64          $self->{cachedir}="cache";
65 +        $self->{dbdir}="ObjectDB";
66          undef $self->{linkarea};
67  
68          return $self;
# Line 64 | Line 70 | sub new {
70  
71   sub cache {
72          my $self=shift;
73 +
74          if ( @_ ) {
75 <          $self->{cache}=shift;
75 >           $self->{cache}=shift;
76          }
77 <        elsif ( ! defined $self->{cache} ) {
77 >        if ( ! defined $self->{cache} ) {
78            my $loc=$self->location()."/".$self->{admindir}."/".$self->{cachedir};
79 <          $self->{cache}=URL::URLcache->new($loc);
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};
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 + }
102 +
103 + sub objectstore {
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}
119 + }
120 +
121   sub name {
122          my $self=shift;
123          @_?$self->{name}=shift
# Line 119 | Line 163 | sub setup {
163          AddDir::adddir($workloc);
164  
165          # -- add a cache
166 <        $self->cache();
166 >        $self->_newcache();
167 >
168 >        # -- add an Objectstore
169 >        $self->_newobjectstore();
170  
171          # -- Save Environment File
172          $self->_SaveEnvFile();
# Line 137 | 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 236 | Line 283 | sub searchlocation {
283          return $rv?$thispath:undef;
284   }
285  
286 + sub archname {
287 +        my $self=shift;
288 +        if ( @_ ) {
289 +          $self->{archname}=shift;
290 +        }
291 +        return $self->{archname};
292 + }
293 +
294 + sub archdir {
295 +        my $self=shift;
296 +        if ( @_ ) {
297 +          $self->{archdir}=shift;
298 +        }
299 +        if ( ! defined $self->{archdir} ) {
300 +         if ( defined $self->{archname} ) {
301 +          $self->{archdir}=$self->location()."/".$self->{admindir}."/".
302 +                                                        $self->{archname};
303 +         }
304 +         else {
305 +          $self->error("ConfigArea : cannot create arch directory - ".
306 +                                                "architecture name not set")
307 +         }
308 +        }
309 +        return $self->{archdir};
310 + }
311 +
312   sub satellite {
313          my $self=shift;
314  
# Line 247 | Line 320 | sub satellite {
320          $sat->configurationdir($self->configurationdir());
321          $sat->setup(@_);
322  
323 <        # -- copy across the cache
324 <        copy($self->cache()->location(),$sat->cache()->location());
323 >        # -- copy across the cache and ObjectStore
324 >        # -- make sure we dont try building new caches in release areas
325 >        my $rcache=$self->cache();
326 >        if ( defined $rcache ) {
327 >          copy($rcache->location(),$sat->cache()->location());
328 >        }
329 >
330 >        # -- make sure we dont try building new objectstores in release areas
331 >        my $rostore=$self->objectstore();
332 >        if ( defined $rostore ) {
333 >          copy($rostore->location(),$sat->objectstore()->location());
334 >        }
335 >
336          # and make sure in reinitialises
337          undef ($sat->{cache});
338  
339          # -- link it to this area
340          $sat->linkarea($self);
341 +        
342 +        # -- save it
343 +        $sat->save();
344  
345 +        return $sat;
346   }
347  
348   sub copy {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines