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.4 by williamc, Fri Sep 22 08:42:49 2000 UTC vs.
Revision 1.8 by sashby, Fri Oct 19 18:14:23 2001 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->verbosity(1);
44          $self->init($area);
45          return $self;
46   }
# Line 52 | Line 52 | sub init {
52          my $config=$top."/".$area->configurationdir();
53  
54          my $cache=$area->cache();
55 <        if ( defined $cache ) {
56 <          $self->{urlhandler}=URL::URLhandler->new($cache);
57 <        }
55 >        if ( defined $cache ) {
56 >          $self->{urlhandler}=URL::URLhandler->new($cache);
57 >        }
58          $self->{toolfiledir}="$top/.SCRAM/ToolFiles";
59          $self->{datastore}=$top."/.SCRAM/".$self->{arch};
60        #$self->{datastore}=$area->archdir();
60          $self->{tooladmin}=$self->{datastore}."/admin";
61          AddDir::adddir($self->{toolfiledir});
62          if ( -f $self->{tooladmin} ) {
# Line 67 | Line 66 | sub init {
66           # do we have toolfile dir and no admin? if so maybe its an old
67           # area and we can attempt to get something from the filenames
68           if ( -d $self->{datastore} ) {
69 <          my $dh=FileHandle->new();
69 >          my $dh=DirHandle->new();
70            opendir $dh, $self->{datastore};
71            my @files=grep /.*_.*/, readdir $dh;
72            undef $dh;
# Line 135 | Line 134 | sub toolsetup {
134          $filename=$self->_download($url, $name, $version);
135  
136          # -- the tool setup
137 <        print "\n ----------- Setting Up $name $version ---------------\n";
137 >        print "\n----------- Setting Up $name $version ----------------------------------\n";
138          require BuildSystem::ToolDoc;
139          my $doc=BuildSystem::ToolDoc->new();
140          $doc->tool($tool);
# Line 145 | Line 144 | sub toolsetup {
144          }
145          $doc->interactive($self->interactive());
146          $tool->reset();
147 <        if ( ! $doc->setup($filename,$name,$version) ) {
147 >        if ( ! $doc->setup($filename,$name,$version,$self) ) {
148            $tool->store($self->_toolfile($name,$version));
149            # -- keep an internal record of the tool
150            $name=~tr[A-Z][a-z];
# Line 231 | Line 230 | sub gettool {
230            return undef, if ( ! defined $version );
231          }
232          my ($tool,$rv)=$self->_toolobject($product,$version);
233 +        if ( $rv != 0 ) {
234 +          delete $self->{tools}{$product}{$version};
235 +        }
236          return ( $rv==0?$tool:undef ); # only return if already set up
237   }
238  
# Line 241 | Line 243 | sub defaultversion {
243          return $self->{defaults}{$product};
244   }
245  
246 + sub toolmakefile {
247 +        my $self=shift;
248 +        my $name=shift;
249 +        my $version=shift;
250 +
251 +        $name=~tr[A-Z][a-z];
252 +        return $self->{datastore}."/".$name."_$version.mk";
253 + }
254 +
255   sub _toolfile {
256          my $self=shift;
257          my $name=shift;
# Line 345 | Line 356 | sub _toolobject {
356          my $rv=0;
357  
358          if ( ! exists $self->{tools}{$product}{$version} ) {
359 <           $self->verbose("$product $version being Intitialised");
359 >           $self->verbose("$product $version being Initialised");
360             $self->{tools}{$product}{$version}=BuildSystem::Tool->new();
361             my $file=$self->_toolfile($product,$version);
362             if ( -f $file ) { # restore it from disk

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines