2 |
|
# |
3 |
|
# Interface |
4 |
|
# --------- |
5 |
< |
# new(file) : new requirements doc |
5 |
> |
# new(file,URLcache) : new requirements doc |
6 |
|
# setup(toolbox): set up the requirements into the specified toolbox object |
7 |
|
# download(toolbox) : download description files (into toolbox cache) |
8 |
|
# tools() : Return list of requirements (ordered) |
10 |
|
# url(tool) : return the url of a given tool |
11 |
|
|
12 |
|
package BuildSystem::Requirements; |
13 |
< |
use ActiveDoc::SimpleDoc; |
13 |
> |
use ActiveDoc::SimpleURLDoc; |
14 |
|
use Utilities::Verbose; |
15 |
|
|
16 |
|
require 5.004; |
21 |
|
my $self={}; |
22 |
|
bless $self, $class; |
23 |
|
$self->{file}=shift; |
24 |
+ |
$self->{cache}=shift; |
25 |
|
$self->{Arch}=1; |
26 |
|
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
27 |
|
$self->init($self->{file}); |
34 |
|
|
35 |
|
my $tool; |
36 |
|
foreach $tool ( $self->tools() ) { |
37 |
+ |
$self->verbose("Setting Up Tool $tool"); |
38 |
|
$toolbox->toolsetup($tool, $self->version($tool), $self->url($tool)); |
39 |
|
} |
40 |
|
} |
60 |
|
my $self=shift; |
61 |
|
my $file=shift; |
62 |
|
|
63 |
< |
my $switch=ActiveDoc::SimpleDoc->new(); |
63 |
> |
my $switch=ActiveDoc::SimpleURLDoc->new($self->{cache}); |
64 |
|
$switch->filetoparse($file); |
65 |
|
$switch->newparse("doc"); |
66 |
|
$switch->addtag("doc","Doc", \&Doc_start,$self,"",$self,"",$self); |
67 |
|
$switch->newparse("ordering"); |
68 |
+ |
$switch->addbasetags("ordering"); |
69 |
|
$switch->addtag("ordering","Architecture", |
70 |
|
\&Arch_Start,$self, |
71 |
|
"", $self, |
84 |
|
if ( defined $self->{docversion} ) { |
85 |
|
$self->{switch}->parse("ordering"); |
86 |
|
} |
87 |
+ |
else { |
88 |
+ |
#print "wrong doc version - not parsing\n"; |
89 |
+ |
} |
90 |
|
} |
91 |
|
|
92 |
|
sub download { |
93 |
|
my $self=shift; |
88 |
– |
my $toolbox=shift; |
94 |
|
|
95 |
|
my $tool; |
96 |
|
foreach $tool ( $self->tools() ) { |
97 |
|
$self->verbose("Downloading ".$self->url($tool)); |
98 |
< |
$toolbox->_download($self->url($tool)); |
98 |
> |
# get into the cache |
99 |
> |
$self->{switch}->urlget($self->url($tool)); |
100 |
|
} |
101 |
|
} |
102 |
|
|
120 |
|
|
121 |
|
$self->{switch}->checktag( $name, $hashref, 'version'); |
122 |
|
$self->{switch}->checktag( $name, $hashref, 'name'); |
123 |
< |
$self->{switch}->checktag( $name, $hashref, 'file'); |
123 |
> |
$self->{switch}->checktag( $name, $hashref, 'url'); |
124 |
|
if ( $self->{Arch} ) { |
125 |
|
push @{$self->{tools}}, $$hashref{'name'}; |
126 |
|
$self->{version}{$$hashref{'name'}}=$$hashref{'version'}; |
127 |
< |
$self->{url}{$$hashref{'name'}}=$$hashref{'file'}; |
127 |
> |
# -- make sure the full url is taken |
128 |
> |
my $urlobj=$self->{switch}->expandurl($$hashref{'url'}); |
129 |
> |
$self->{url}{$$hashref{'name'}}=$urlobj->url(); |
130 |
|
} |
131 |
|
} |
132 |
|
|