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

Comparing COMP/SCRAM/src/Scram/ScramFunctions.pm (file contents):
Revision 1.7 by williamc, Wed Sep 13 15:46:18 2000 UTC vs.
Revision 1.8 by williamc, Thu Sep 21 13:44:26 2000 UTC

# Line 20 | Line 20
20   # arch()                : get/set the architecture string
21   # scramobjectinterface(Class)  : print out the interface of a scram class
22   # webget(area,url)      : get the url into the cache of the specified area
23 + # getversion()          : return the current scram version
24 + # spawnversion(version,@args) : spawn the scram version with the given args
25  
26   package Scram::ScramFunctions;
27   use URL::URLcache;
# Line 35 | Line 37 | sub new {
37          # -- default settings
38          $self->{cachedir}=$ENV{HOME}."/.scramrc/globalcache";
39          $self->{scramprojectsdbdir}=$ENV{SCRAM_LOOKUPDB};
40 +        ($self->{scram_top})=( $ENV{SCRAM_HOME}=~/(.*)\//) ;
41 +
42          return $self;
43   }
44  
# Line 171 | Line 175 | sub addareatoDB {
175          $self->scramprojectdb()->addarea($tagname,$version,$area);
176   }
177  
178 + sub spawnversion {
179 +        my $self=shift;
180 +        my $version=shift;
181 +
182 +        my $rv=0;
183 +        my $thisversion=$self->getversion();
184 +        if ( defined $version ) {
185 +          if ( $version ne $thisversion ) {
186 +              # first try to use the correct version
187 +              if ( -d $self->{scram_top}."/".$version ) {
188 +                $ENV{SCRAM_HOME}=$self->{scram_top}."/".$version;
189 +                $ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src";
190 +                $self->verbose("Spawning SCRAM version $version");
191 +                my $rv=system("scram", @_)/256;
192 +                exit $rv;
193 +              }
194 +              else { # if not then simply warn
195 +               print "******* Warning : scram version inconsistent ********\n";
196 +               print "This version: $thisversion; Required version: $version\n";
197 +               print "*****************************************************\n";
198 +               print "\n";
199 +              }
200 +           }
201 +        }
202 +        else {
203 +           $self->error("Undefined value for version requested");
204 +           $rv=1;
205 +        }
206 +        return $rv;
207 + }
208 +
209   sub globalcache {
210          my $self=shift;
211          if ( @_ ) {
# Line 196 | Line 231 | sub scramprojectdb {
231          }
232          return $self->{scramprojectsdb};
233   }
234 +
235 + sub getversion {
236 +        my $self=shift;
237 +        
238 +        my $thisversion;
239 +        ($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///;
240 +        my $scram_top=$1;
241 +        my $scram_version=$thisversion;
242 +        # deal with links
243 +        my $version=readlink $ENV{SCRAM_HOME};
244 +        if ( defined $version)  {
245 +          $scram_version=$version;
246 +        }
247 +        return $scram_version;
248 + }
249  
250   sub areatoolbox {
251          my $self=shift;
# Line 205 | Line 255 | sub areatoolbox {
255          if ( ! defined $self->{toolboxes}{$name} ) {
256            # -- create a new toolbox object
257            require BuildSystem::ToolBox;
258 <          $self->{toolboxes}{$name}=BuildSystem::ToolBox->new($area);
258 >          $self->{toolboxes}{$name}=BuildSystem::ToolBox->new($area,
259 >                                                        $self->arch());
260            $self->{toolboxes}{$name}->verbosity($self->verbosity());
261          }
262          return $self->{toolboxes}{$name};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines