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

Comparing COMP/SCRAM/src/BuildSystem/ToolBox.pm (file contents):
Revision 1.2 by williamc, Mon Aug 28 08:23:10 2000 UTC vs.
Revision 1.5 by williamc, Tue Nov 14 15:18:41 2000 UTC

# Line 9 | Line 9
9   #
10   # Interface
11   # ---------
12 < # new()         : A new toolbox object
12 > # new(ConfigArea,archstring)    : A new toolbox object
13   # tools()       : return a list of tools (name,version) pairs
14   # defaultversion(tool) : return the default version of the specified tool
15   # setdefault(tool,version) : set the default version of a given tool (permanant)
# Line 39 | Line 39 | sub new {
39          my $area=shift;
40          my $self={};
41          bless $self, $class;
42 <        $self->init($area);
42 >        $self->{arch}=shift;
43          #$self->verbosity(1);
44 +        $self->init($area);
45          return $self;
46   }
47  
# Line 49 | Line 50 | sub init {
50          my $area=shift;
51          my $top=$area->location();
52          my $config=$top."/".$area->configurationdir();
53 <        $self->{urlhandler}=URL::URLhandler->new($area->cache());
53 >
54 >        my $cache=$area->cache();
55 >        if ( defined $cache ) {
56 >          $self->{urlhandler}=URL::URLhandler->new($cache);
57 >        }
58          $self->{toolfiledir}="$top/.SCRAM/ToolFiles";
59 <        $self->{datastore}=$top."/.SCRAM/".$ENV{SCRAM_ARCH};
59 >        $self->{datastore}=$top."/.SCRAM/".$self->{arch};
60          #$self->{datastore}=$area->archdir();
61          $self->{tooladmin}=$self->{datastore}."/admin";
62          AddDir::adddir($self->{toolfiledir});
# Line 62 | Line 67 | sub init {
67           # do we have toolfile dir and no admin? if so maybe its an old
68           # area and we can attempt to get something from the filenames
69           if ( -d $self->{datastore} ) {
70 <          my $dh=FileHandle->new();
70 >          my $dh=DirHandle->new();
71            opendir $dh, $self->{datastore};
72            my @files=grep /.*_.*/, readdir $dh;
73            undef $dh;
# Line 226 | Line 231 | sub gettool {
231            return undef, if ( ! defined $version );
232          }
233          my ($tool,$rv)=$self->_toolobject($product,$version);
234 +        if ( $rv != 0 ) {
235 +          delete $self->{tools}{$product}{$version};
236 +        }
237          return ( $rv==0?$tool:undef ); # only return if already set up
238   }
239  
# Line 340 | Line 348 | sub _toolobject {
348          my $rv=0;
349  
350          if ( ! exists $self->{tools}{$product}{$version} ) {
351 <           $self->verbose("$product $version being Intitialised");
351 >           $self->verbose("$product $version being Initialised");
352             $self->{tools}{$product}{$version}=BuildSystem::Tool->new();
353             my $file=$self->_toolfile($product,$version);
354             if ( -f $file ) { # restore it from disk

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines