ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Requirements.pm
Revision: 1.1.2.4
Committed: Thu May 4 15:45:07 2000 UTC (25 years ago) by williamc
Content type: text/plain
Branch: V0_9branch
CVS Tags: V0_12_12_4, V0_12_12_3, V0_13_3, V0_13_2, V0_12_12_2, V0_12_12_1, V0_12_12_0, PlayGround_0, V0_13_1, V0_13_0, V0_12_12, V0_12_11, V0_12_9b, V0_12_10, V0_12_9, V0_12_8, V0_12_7, V0_12_6, V0_12_5, V0_12_4, V0_12_3
Branch point for: HPWbranch
Changes since 1.1.2.3: +21 -1 lines
Log Message:
Add doc tag

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 williamc 1.1.2.3 push @{$self->{ARCHBLOCK}}, $self->{Arch};
26 williamc 1.1.2.1 $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 williamc 1.1.2.4 $switch->newparse("doc");
64     $switch->addtag("doc","Doc", \&Doc_start,$self,"",$self,"",$self);
65 williamc 1.1.2.1 $switch->newparse("ordering");
66 williamc 1.1.2.3 $switch->addtag("ordering","Architecture",
67     \&Arch_Start,$self,
68     "", $self,
69     \&Arch_End, $self);
70     $switch->grouptag("Architecture","ordering");
71 williamc 1.1.2.1 $switch->addtag("ordering","require",
72     \&require_start,$self,
73     "", $self,
74     "", $self);
75     $self->{switch}=$switch;
76     @{$self->{tools}}=();
77 williamc 1.1.2.4
78     $self->{switch}->parse("doc");
79     # -- for backwards compatability only parse if we have a docversion
80     # defined
81     if ( defined $self->{docversion} ) {
82     $self->{switch}->parse("ordering");
83     }
84 williamc 1.1.2.2 }
85    
86     sub download {
87     my $self=shift;
88     my $toolbox=shift;
89    
90     my $tool;
91     foreach $tool ( $self->tools() ) {
92     $self->verbose("Downloading ".$self->url($tool));
93     $toolbox->_download($self->url($tool));
94     }
95 williamc 1.1.2.1 }
96    
97     # ---- Tag routines
98 williamc 1.1.2.4
99     sub Doc_start {
100     my $self=shift;
101     my $name=shift;
102     my $hashref=shift;
103    
104     $self->{switch}->checktag( $name, $hashref, 'type');
105     $self->{switch}->checktag( $name, $hashref, 'version');
106    
107     $self->{docversion}=$$hashref{'version'};
108     }
109    
110 williamc 1.1.2.1 sub require_start {
111     my $self=shift;
112     my $name=shift;
113     my $hashref=shift;
114    
115     $self->{switch}->checktag( $name, $hashref, 'version');
116     $self->{switch}->checktag( $name, $hashref, 'name');
117 williamc 1.1.2.2 $self->{switch}->checktag( $name, $hashref, 'file');
118 williamc 1.1.2.1 if ( $self->{Arch} ) {
119     push @{$self->{tools}}, $$hashref{'name'};
120 williamc 1.1.2.2 $self->{version}{$$hashref{'name'}}=$$hashref{'version'};
121     $self->{url}{$$hashref{'name'}}=$$hashref{'file'};
122 williamc 1.1.2.1 }
123     }
124 williamc 1.1.2.3
125     sub Arch_Start {
126     my $self=shift;
127     my $name=shift;
128     my $hashref=shift;
129    
130     $self->{switch}->checktag($name, $hashref,'name');
131     ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
132     : ($self->{Arch}=0);
133     push @{$self->{ARCHBLOCK}}, $self->{Arch};
134     }
135    
136     sub Arch_End {
137     my $self=shift;
138     my $name=shift;
139    
140     pop @{$self->{ARCHBLOCK}};
141     $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
142     }
143