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.6 by williamc, Wed Sep 6 08:14:46 2000 UTC vs.
Revision 1.9 by williamc, Fri Oct 20 11:31:43 2000 UTC

# Line 19 | Line 19
19   # setuptoolsinarea($area[,$toolname[,$toolversion[,toolfile]) : setup
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;
28 + use URL::URLhandler;
29   use Utilities::Verbose;
30   require 5.004;
31  
# Line 34 | Line 38 | sub new {
38          # -- default settings
39          $self->{cachedir}=$ENV{HOME}."/.scramrc/globalcache";
40          $self->{scramprojectsdbdir}=$ENV{SCRAM_LOOKUPDB};
41 +        ($self->{scram_top})=( $ENV{SCRAM_HOME}=~/(.*)\//) ;
42 +
43          return $self;
44   }
45  
# Line 143 | Line 149 | sub satellite {
149          return $area;
150   }
151  
152 + sub webget {
153 +        my $self=shift;
154 +        my $area=shift;
155 +        my $url=shift;
156 +
157 +        my $handler=URL::URLhandler->new($area->cache());
158 +        return ($handler->get($url));
159 + }
160 +
161   sub addareatoDB {
162          my $self=shift;
163          my $area=shift;
# Line 161 | Line 176 | sub addareatoDB {
176          $self->scramprojectdb()->addarea($tagname,$version,$area);
177   }
178  
179 + sub spawnversion {
180 +        my $self=shift;
181 +        my $version=shift;
182 +
183 +        my $rv=0;
184 +        my $thisversion=$self->getversion();
185 +        if ( defined $version ) {
186 +          if ( $version ne $thisversion ) {
187 +              # first try to use the correct version
188 +              if ( -d $self->{scram_top}."/".$version ) {
189 +                $ENV{SCRAM_HOME}=$self->{scram_top}."/".$version;
190 +                $ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src";
191 +                $self->verbose("Spawning SCRAM version $version");
192 +                my $rv=system("scram", @_)/256;
193 +                exit $rv;
194 +              }
195 +              else { # if not then simply warn
196 +               print "******* Warning : scram version inconsistent ********\n";
197 +               print "This version: $thisversion; Required version: $version\n";
198 +               print "*****************************************************\n";
199 +               print "\n";
200 +              }
201 +           }
202 +        }
203 +        else {
204 +           $self->error("Undefined value for version requested");
205 +           $rv=1;
206 +        }
207 +        return $rv;
208 + }
209 +
210   sub globalcache {
211          my $self=shift;
212          if ( @_ ) {
# Line 186 | Line 232 | sub scramprojectdb {
232          }
233          return $self->{scramprojectsdb};
234   }
235 +
236 + sub getversion {
237 +        my $self=shift;
238 +        
239 +        my $thisversion;
240 +        ($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///;
241 +        my $scram_top=$1;
242 +        my $scram_version=$thisversion;
243 +        # deal with links
244 +        my $version=readlink $ENV{SCRAM_HOME};
245 +        if ( defined $version)  {
246 +          $scram_version=$version;
247 +        }
248 +        return $scram_version;
249 + }
250  
251   sub areatoolbox {
252          my $self=shift;
# Line 195 | Line 256 | sub areatoolbox {
256          if ( ! defined $self->{toolboxes}{$name} ) {
257            # -- create a new toolbox object
258            require BuildSystem::ToolBox;
259 <          $self->{toolboxes}{$name}=BuildSystem::ToolBox->new($area);
259 >          $self->{toolboxes}{$name}=BuildSystem::ToolBox->new($area,
260 >                                                        $self->arch());
261            $self->{toolboxes}{$name}->verbosity($self->verbosity());
262          }
263          return $self->{toolboxes}{$name};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines