25 |
|
# dependencies() : return a list of dependency objects |
26 |
|
# store(location) : Save object to given file |
27 |
|
# restore(location) : Restore object from specified file |
28 |
+ |
# reset() : Clean out all the features |
29 |
+ |
# equals(toolobj) : return 1 if the tools correspond in url version etc. |
30 |
|
|
31 |
|
package BuildSystem::Tool; |
32 |
+ |
use Utilities::Verbose; |
33 |
|
require 5.004; |
34 |
+ |
@ISA=qw(Utilities::Verbose); |
35 |
|
|
36 |
|
sub new { |
37 |
|
my $class=shift; |
61 |
|
:$self->{url}; |
62 |
|
} |
63 |
|
|
64 |
+ |
sub equals { |
65 |
+ |
my $self=shift; |
66 |
+ |
my $tool=shift; |
67 |
+ |
|
68 |
+ |
my $rv=0; |
69 |
+ |
if ( |
70 |
+ |
# TODO - temp for backwards comp mode($tool->url() eq $self->url() ) && |
71 |
+ |
($tool->name() eq $self->name() ) && |
72 |
+ |
($tool->version() eq $self->version()) ) { |
73 |
+ |
$rv=1; |
74 |
+ |
} |
75 |
+ |
return $rv; |
76 |
+ |
} |
77 |
+ |
|
78 |
|
sub listtype { |
79 |
|
my $self=shift; |
80 |
|
my $type=shift; |
117 |
|
@{$self->{features}{$name}}=@value; |
118 |
|
} |
119 |
|
|
120 |
+ |
sub reset { |
121 |
+ |
my $self=shift; |
122 |
+ |
undef $self->{features}; |
123 |
+ |
undef $self->{'features_ordered'}; |
124 |
+ |
undef $self->{reqobjs}; |
125 |
+ |
undef $self->{requireposition}; |
126 |
+ |
} |
127 |
|
|
128 |
|
sub _newfeature { |
129 |
|
my $self=shift; |
195 |
|
my $location=shift; |
196 |
|
|
197 |
|
my $fh=FileHandle->new(); |
198 |
+ |
$self->verbose("opening $location for output"); |
199 |
|
$fh->open(">".$location) or die "Unable to open $location for output". |
200 |
|
$!."\n"; |
201 |
|
print $fh "name:".$self->name().":_sys\n"; |
217 |
|
$fh->open("<".$location) or die "Unable to open $location for output". |
218 |
|
$!."\n"; |
219 |
|
my ($tool,$type,$variable,$value); |
220 |
+ |
my @fields; |
221 |
|
while ( <$fh> ) { |
222 |
|
chomp; |
223 |
|
next if /^#/; |
224 |
|
next if /^\s*$/; |
225 |
< |
($variable, $value, $type)=split /:/; |
225 |
> |
@fields=split /:/; |
226 |
> |
if ( $_!~/:$/ ) { |
227 |
> |
$type=pop @fields; |
228 |
> |
} |
229 |
> |
else { $type="" }; |
230 |
> |
$variable=shift @fields; |
231 |
> |
$value=join ":",@fields; |
232 |
> |
#($variable, $value, $type)=split /:/; |
233 |
|
next if ( $variable=~/\&/ ); |
234 |
|
$product=~tr[A-Z][a-z]; |
235 |
|
if ( $type eq "_sys" ) { |
239 |
|
} |
240 |
|
else { |
241 |
|
$self->addfeature($variable,$value); |
242 |
+ |
if ( $type ne "" ) { |
243 |
+ |
$self->type($variable,$type); |
244 |
+ |
} |
245 |
|
} |
246 |
|
} |
247 |
|
undef $fh; |