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.3 by williamc, Thu Sep 21 13:36:52 2000 UTC vs.
Revision 1.6 by williamc, Wed Nov 15 10:50:56 2000 UTC

# Line 23 | Line 23
23   # interactive(0|1)      : set the setup mode
24   # searcher(SearchObject) : Set the search object for matching tools during setup
25   # copytools(ToolBox)            : copy tools from this to the supplied toolbox
26 + # toolmakefile(name,version)    : Return the location of the tool makefile
27  
28   package BuildSystem::ToolBox;
29   use FileHandle;
# Line 40 | Line 41 | sub new {
41          my $self={};
42          bless $self, $class;
43          $self->{arch}=shift;
43        $self->init($area);
44          #$self->verbosity(1);
45 +        $self->init($area);
46          return $self;
47   }
48  
# Line 50 | Line 51 | sub init {
51          my $area=shift;
52          my $top=$area->location();
53          my $config=$top."/".$area->configurationdir();
54 <        $self->{urlhandler}=URL::URLhandler->new($area->cache());
54 >
55 >        my $cache=$area->cache();
56 >        if ( defined $cache ) {
57 >          $self->{urlhandler}=URL::URLhandler->new($cache);
58 >        }
59          $self->{toolfiledir}="$top/.SCRAM/ToolFiles";
60          $self->{datastore}=$top."/.SCRAM/".$self->{arch};
61          #$self->{datastore}=$area->archdir();
# Line 63 | Line 68 | sub init {
68           # do we have toolfile dir and no admin? if so maybe its an old
69           # area and we can attempt to get something from the filenames
70           if ( -d $self->{datastore} ) {
71 <          my $dh=FileHandle->new();
71 >          my $dh=DirHandle->new();
72            opendir $dh, $self->{datastore};
73            my @files=grep /.*_.*/, readdir $dh;
74            undef $dh;
# Line 141 | Line 146 | sub toolsetup {
146          }
147          $doc->interactive($self->interactive());
148          $tool->reset();
149 <        if ( ! $doc->setup($filename,$name,$version) ) {
149 >        if ( ! $doc->setup($filename,$name,$version,$self) ) {
150            $tool->store($self->_toolfile($name,$version));
151            # -- keep an internal record of the tool
152            $name=~tr[A-Z][a-z];
# Line 227 | Line 232 | sub gettool {
232            return undef, if ( ! defined $version );
233          }
234          my ($tool,$rv)=$self->_toolobject($product,$version);
235 +        if ( $rv != 0 ) {
236 +          delete $self->{tools}{$product}{$version};
237 +        }
238          return ( $rv==0?$tool:undef ); # only return if already set up
239   }
240  
# Line 237 | Line 245 | sub defaultversion {
245          return $self->{defaults}{$product};
246   }
247  
248 + sub toolmakefile {
249 +        my $self=shift;
250 +        my $name=shift;
251 +        my $version=shift;
252 +
253 +        $name=~tr[A-Z][a-z];
254 +        return $self->{datastore}."/".$name."_$version.mk";
255 + }
256 +
257   sub _toolfile {
258          my $self=shift;
259          my $name=shift;
# Line 341 | Line 358 | sub _toolobject {
358          my $rv=0;
359  
360          if ( ! exists $self->{tools}{$product}{$version} ) {
361 <           $self->verbose("$product $version being Intitialised");
361 >           $self->verbose("$product $version being Initialised");
362             $self->{tools}{$product}{$version}=BuildSystem::Tool->new();
363             my $file=$self->_toolfile($product,$version);
364             if ( -f $file ) { # restore it from disk

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines