ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Requirements.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/Requirements.pm (file contents):
Revision 1.1.2.1 by williamc, Fri Apr 7 08:12:47 2000 UTC vs.
Revision 1.1.2.3 by williamc, Tue Apr 25 14:07:39 2000 UTC

# Line 3 | Line 3
3   # Interface
4   # ---------
5   # new(file)     : 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)
9   # version(tool) : return the version of a given tool
10 + # url(tool)     : return the url of a given tool
11  
12   package BuildSystem::Requirements;
13   use ActiveDoc::SimpleDoc;
14 + use Utilities::Verbose;
15 +
16   require 5.004;
17 + @ISA=qw(Utilities::Verbose);
18  
19   sub new {
20          my $class=shift;
# Line 16 | Line 22 | sub new {
22          bless $self, $class;
23          $self->{file}=shift;
24          $self->{Arch}=1;
25 <        push @{$self->{ARCHBLOCK}}, $Arch;
25 >        push @{$self->{ARCHBLOCK}}, $self->{Arch};
26          $self->init($self->{file});
27          return $self;
28   }
29  
30 + 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   sub tools {
41          my $self=shift;
42          return @{$self->{tools}};
# Line 32 | Line 48 | sub version {
48          return $self->{'version'}{$tool};
49   }
50  
51 + sub url {
52 +        my $self=shift;
53 +        my $tool=shift;
54 +        return $self->{'url'}{$tool};
55 + }
56 +
57   sub init {
58          my $self=shift;
59          my $file=shift;
# Line 39 | Line 61 | sub init {
61          my $switch=ActiveDoc::SimpleDoc->new();
62          $switch->filetoparse($file);
63          $switch->newparse("ordering");
64 +        $switch->addtag("ordering","Architecture",
65 +                                        \&Arch_Start,$self,
66 +                                        "", $self,
67 +                                        \&Arch_End, $self);
68 +        $switch->grouptag("Architecture","ordering");
69          $switch->addtag("ordering","require",
70                                          \&require_start,$self,
71                                          "", $self,
72                                          "", $self);
73          $self->{switch}=$switch;
74          @{$self->{tools}}=();
75 <        $switch->parse("ordering");
75 >        $self->{switch}->parse("ordering");
76 > }
77 >
78 > sub download {
79 >        my $self=shift;
80 >        my $toolbox=shift;
81 >
82 >        my $tool;
83 >        foreach $tool ( $self->tools() ) {
84 >          $self->verbose("Downloading ".$self->url($tool));
85 >          $toolbox->_download($self->url($tool));
86 >        }
87   }
88  
89   # ---- Tag routines
# Line 56 | Line 94 | sub require_start {
94          
95          $self->{switch}->checktag( $name, $hashref, 'version');
96          $self->{switch}->checktag( $name, $hashref, 'name');
97 +        $self->{switch}->checktag( $name, $hashref, 'file');
98          if ( $self->{Arch} ) {
99            push @{$self->{tools}}, $$hashref{'name'};
100 <          $self->{version}{$$hashref{'name'}}=$$hashref{'version'}
100 >          $self->{version}{$$hashref{'name'}}=$$hashref{'version'};
101 >          $self->{url}{$$hashref{'name'}}=$$hashref{'file'};
102          }
103   }
104 +
105 + sub Arch_Start {
106 +        my $self=shift;
107 +        my $name=shift;
108 +        my $hashref=shift;
109 +
110 +        $self->{switch}->checktag($name, $hashref,'name');
111 +        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
112 +                                                : ($self->{Arch}=0);
113 +        push @{$self->{ARCHBLOCK}}, $self->{Arch};
114 + }
115 +
116 + sub Arch_End {
117 +        my $self=shift;
118 +        my $name=shift;
119 +
120 +        pop @{$self->{ARCHBLOCK}};
121 +        $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
122 + }
123 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines