1 |
williamc |
1.1.2.1 |
# Requirements Doc - just to get ordering info
|
2 |
|
|
#
|
3 |
|
|
# Interface
|
4 |
|
|
# ---------
|
5 |
|
|
# new(file) : new requirements doc
|
6 |
|
|
# tools() : Return list of requirements (ordered)
|
7 |
|
|
# version(tool) : return the version of a given tool
|
8 |
|
|
|
9 |
|
|
package BuildSystem::Requirements;
|
10 |
|
|
use ActiveDoc::SimpleDoc;
|
11 |
|
|
require 5.004;
|
12 |
|
|
|
13 |
|
|
sub new {
|
14 |
|
|
my $class=shift;
|
15 |
|
|
my $self={};
|
16 |
|
|
bless $self, $class;
|
17 |
|
|
$self->{file}=shift;
|
18 |
|
|
$self->{Arch}=1;
|
19 |
|
|
push @{$self->{ARCHBLOCK}}, $Arch;
|
20 |
|
|
$self->init($self->{file});
|
21 |
|
|
return $self;
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
sub tools {
|
25 |
|
|
my $self=shift;
|
26 |
|
|
return @{$self->{tools}};
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
sub version {
|
30 |
|
|
my $self=shift;
|
31 |
|
|
my $tool=shift;
|
32 |
|
|
return $self->{'version'}{$tool};
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
sub init {
|
36 |
|
|
my $self=shift;
|
37 |
|
|
my $file=shift;
|
38 |
|
|
|
39 |
|
|
my $switch=ActiveDoc::SimpleDoc->new();
|
40 |
|
|
$switch->filetoparse($file);
|
41 |
|
|
$switch->newparse("ordering");
|
42 |
|
|
$switch->addtag("ordering","require",
|
43 |
|
|
\&require_start,$self,
|
44 |
|
|
"", $self,
|
45 |
|
|
"", $self);
|
46 |
|
|
$self->{switch}=$switch;
|
47 |
|
|
@{$self->{tools}}=();
|
48 |
|
|
$switch->parse("ordering");
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
# ---- Tag routines
|
52 |
|
|
sub require_start {
|
53 |
|
|
my $self=shift;
|
54 |
|
|
my $name=shift;
|
55 |
|
|
my $hashref=shift;
|
56 |
|
|
|
57 |
|
|
$self->{switch}->checktag( $name, $hashref, 'version');
|
58 |
|
|
$self->{switch}->checktag( $name, $hashref, 'name');
|
59 |
|
|
if ( $self->{Arch} ) {
|
60 |
|
|
push @{$self->{tools}}, $$hashref{'name'};
|
61 |
|
|
$self->{version}{$$hashref{'name'}}=$$hashref{'version'}
|
62 |
|
|
}
|
63 |
|
|
}
|