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.36 by muzaffar, Fri Jan 14 17:36:42 2011 UTC vs.
Revision 1.40 by muzaffar, Tue Mar 12 15:19:44 2013 UTC

# Line 9 | Line 9 | sub new {
9          my $class=shift;
10          my $self={};
11          bless $self, $class;
12 <        $self->{admindir}=".SCRAM";
12 >        $self->{admindir}=".SCRAM";
13          $self->{configurationdir} = "config";
14 <        $self->archname(shift || $ENV{SCRAM_ARCH});
14 >        $self->{forcearch} = shift || "";
15 >        $self->{arch} = $self->{forcearch} || $ENV{SCRAM_ARCH};
16          return $self;
17   }
18  
# Line 36 | Line 37 | sub symlinks {
37   sub calchksum {
38          my $self=shift;
39          my $dir=$self->location()."/".$self->configurationdir();
40 <        push @INC,$dir;
41 <        require SCRAM::Plugins::ProjectChkSum;
42 <        my $sum=&SCRAM::Plugins::ProjectChkSum::chksum($dir);
43 <        pop @INC;
40 >        my $sum="";
41 >        if (-f "${dir}/config_tag")
42 >           {
43 >           my $ref;
44 >           open ($ref, "${dir}/config_tag");
45 >           $sum=<$ref>;
46 >           close($ref);
47 >           chomp $sum;
48 >           }
49 >        else
50 >           {
51 >           push @INC,$dir;
52 >           require SCRAM::Plugins::ProjectChkSum;
53 >           $sum=&SCRAM::Plugins::ProjectChkSum::chksum($dir);
54 >           pop @INC;
55 >           }
56          return $sum;
57   }
58  
# Line 77 | Line 90 | sub setup {
90             {
91             if ((!-defined $locarea) && (-f "${location}/${areaname}/".$self->admindir()."/Environment"))
92                {
93 <              $locarea=Configuration::ConfigArea->new($self->arch());
93 >              $locarea=Configuration::ConfigArea->new();
94                $locarea->bootstrapfromlocation("${location}/${areaname}");
95                }
96             if ((defined $locarea) && ($locarea->configchksum() != $self->configchksum()))
97                {
98 <              print "ERROR: Can not setup your current working area for SCRAM_ARCH:".$self->arch().".\n",
98 >              print "ERROR: Can not setup your current working area for SCRAM_ARCH: $ENV{SCRAM_ARCH}\n",
99                      "Your current development area ${location}/${areaname}\n",
100                      "is using a different ${areaname}/config then the one used for\n",
101                      $self->releasetop(),".\n";
# Line 143 | Line 156 | sub location {
156  
157          if ( @_ ) {
158            $self->{location}=shift;
159 <          $self->archname($self->{archname});
159 >          delete $self->{archs};
160 >          $self->_setAreaArch();
161          }
162          elsif ( ! defined $self->{location} ) {
163            # try and find the release location
164            $self->{location}=$self->searchlocation();
165            if (defined $self->{location})
166               {
167 <             $self->archname($self->{archname});
167 >             $self->_setAreaArch()
168               }
169          }
170          return  $self->{location};
# Line 190 | Line 204 | sub searchlocation {
204   sub archname {
205          my $self=shift;
206          if ( @_ ) {
207 <          $self->{archname}=shift;
207 >          $self->{arch} = shift;
208            if (defined $self->{location}) {
209 <             $self->archdir($self->{location}."/".$self->{admindir}."/".$self->{archname});
209 >             $self->archdir($self->{location}."/".$self->{admindir}."/".$self->{arch});
210            }
211          }
212 <        return $self->{archname};
212 >        return $self->{arch};
213   }
214  
215   sub archdir {
# Line 209 | Line 223 | sub archdir {
223   sub satellite {
224          my $self=shift;
225          my $relloc = $self->location();
226 <        my $sat=Configuration::ConfigArea->new($self->arch());
226 >        my $sat=Configuration::ConfigArea->new($ENV{SCRAM_ARCH});
227          $sat->name($self->name());
228          $sat->version($self->version());
229          $sat->configurationdir($self->configurationdir());
# Line 233 | Line 247 | sub satellite {
247             {
248             $sat->save ();
249             }
250 <        Utilities::AddDir::copydir("${relconf}/toolbox/".$self->arch(),"${devconf}/toolbox/".$sat->arch());
250 >        Utilities::AddDir::copydir("${relconf}/toolbox/".$self->{arch},"${devconf}/toolbox/".$self->{arch});
251          Utilities::AddDir::adddir ($sat->location()."/".$sat->sourcedir());
252          return $sat;
253   }
# Line 268 | Line 282 | sub copyenv {
282  
283   sub arch {
284          my $self=shift;
285 <        return $self->{archname};
285 >        return $self->{arch};
286   }
287  
288   sub save {
# Line 278 | Line 292 | sub save {
292  
293   # ---- support routines
294  
295 + sub _setAreaArch {
296 +  my ($self) = @_;
297 +  my $arch = $self->{forcearch};
298 +  if ($arch eq "")
299 +  {
300 +    if (!exists $self->{archs})
301 +    {
302 +      $self->{archs}=[];
303 +      my $toolbox = $self->{location}.'/'.$self->{configurationdir}.'/toolbox';
304 +      foreach my $arch (glob("${toolbox}/*")) {
305 +        if (-d "${arch}/tools") {
306 +          $arch=~s/^$toolbox\///;
307 +          push @{$self->{archs}},$arch;
308 +        }
309 +      }
310 +    }
311 +    if ((!-d "${toolbox}/".$self->{arch}) && (scalar(@{$self->{archs}})==1)) { $arch = $self->{archs}[0]; }
312 +  }
313 +  $self->archname($arch || $self->{arch});
314 +  return;
315 + }
316 +
317   sub _SaveEnvFile
318     {
319     my $self=shift;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines