ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Requirements.pm
Revision: 1.1.2.2
Committed: Wed Apr 19 14:14:32 2000 UTC (25 years ago) by williamc
Content type: text/plain
Branch: V0_9branch
CVS Tags: V0_12_0
Changes since 1.1.2.1: +37 -2 lines
Log Message:
New ToolBox Regime - no clientsettings anymore

File Contents

# User Rev Content
1 williamc 1.1.2.1 # Requirements Doc - just to get ordering info
2     #
3     # Interface
4     # ---------
5     # new(file) : new requirements doc
6 williamc 1.1.2.2 # setup(toolbox): set up the requirements into the specified toolbox object
7     # download(toolbox) : download description files (into toolbox cache)
8 williamc 1.1.2.1 # tools() : Return list of requirements (ordered)
9     # version(tool) : return the version of a given tool
10 williamc 1.1.2.2 # url(tool) : return the url of a given tool
11 williamc 1.1.2.1
12     package BuildSystem::Requirements;
13     use ActiveDoc::SimpleDoc;
14 williamc 1.1.2.2 use Utilities::Verbose;
15    
16 williamc 1.1.2.1 require 5.004;
17 williamc 1.1.2.2 @ISA=qw(Utilities::Verbose);
18 williamc 1.1.2.1
19     sub new {
20     my $class=shift;
21     my $self={};
22     bless $self, $class;
23     $self->{file}=shift;
24     $self->{Arch}=1;
25     push @{$self->{ARCHBLOCK}}, $Arch;
26     $self->init($self->{file});
27     return $self;
28     }
29    
30 williamc 1.1.2.2 sub setup {
31     my $self=shift;
32     my $toolbox=shift;
33    
34     my $tool;
35     foreach $tool ( $self->tools() ) {
36     $toolbox->toolsetup($tool, $self->version($tool), $self->url($tool));
37     }
38     }
39    
40 williamc 1.1.2.1 sub tools {
41     my $self=shift;
42     return @{$self->{tools}};
43     }
44    
45     sub version {
46     my $self=shift;
47     my $tool=shift;
48     return $self->{'version'}{$tool};
49     }
50    
51 williamc 1.1.2.2 sub url {
52     my $self=shift;
53     my $tool=shift;
54     return $self->{'url'}{$tool};
55     }
56    
57 williamc 1.1.2.1 sub init {
58     my $self=shift;
59     my $file=shift;
60    
61     my $switch=ActiveDoc::SimpleDoc->new();
62     $switch->filetoparse($file);
63     $switch->newparse("ordering");
64     $switch->addtag("ordering","require",
65     \&require_start,$self,
66     "", $self,
67     "", $self);
68     $self->{switch}=$switch;
69     @{$self->{tools}}=();
70 williamc 1.1.2.2 $self->{switch}->parse("ordering");
71     }
72    
73     sub download {
74     my $self=shift;
75     my $toolbox=shift;
76    
77     my $tool;
78     foreach $tool ( $self->tools() ) {
79     $self->verbose("Downloading ".$self->url($tool));
80     $toolbox->_download($self->url($tool));
81     }
82 williamc 1.1.2.1 }
83    
84     # ---- Tag routines
85     sub require_start {
86     my $self=shift;
87     my $name=shift;
88     my $hashref=shift;
89    
90     $self->{switch}->checktag( $name, $hashref, 'version');
91     $self->{switch}->checktag( $name, $hashref, 'name');
92 williamc 1.1.2.2 $self->{switch}->checktag( $name, $hashref, 'file');
93 williamc 1.1.2.1 if ( $self->{Arch} ) {
94     push @{$self->{tools}}, $$hashref{'name'};
95 williamc 1.1.2.2 $self->{version}{$$hashref{'name'}}=$$hashref{'version'};
96     $self->{url}{$$hashref{'name'}}=$$hashref{'file'};
97 williamc 1.1.2.1 }
98     }