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

Comparing COMP/SCRAM/src/BootStrapProject.pm (file contents):
Revision 1.2 by williamc, Mon Mar 1 11:01:41 1999 UTC vs.
Revision 1.4 by williamc, Mon Mar 8 09:56:21 1999 UTC

# Line 5 | Line 5 | package BootStrapProject;
5   require Exporter;
6   @ISA=qw(Exporter);
7   @EXPORT=qw(BootStrapProject);
8 + use Utilities::cvsmodule;
9  
10   sub BootStrapProject($) {
11          my $url=shift;  
# Line 15 | Line 16 | sub BootStrapProject($) {
16  
17          my $filename;
18          $BootHash={
19 +                'cvsrep_StartTag' => \&cvsrep_start,
20 +                'cvsrep' => 'none',
21 +                'cvsrep_EndTag' => \&cvsrep_end,
22 +                'cvs_StartTag' => \&cvs_start,
23 +                'cvs' => 'none',
24 +                'cvs_EndTag' => 'none',
25                  'config_starttag' =>  \&config_starttag,
26 +                'config_endtag' =>  \&config_endtag,
27                  'config' => 'none',
28                  'base' => 'none',
29                  'base_starttag' => \&base_start,
# Line 31 | Line 39 | sub BootStrapProject($) {
39                  'file' => 'none',
40                  'file_starttag' => \&file_start
41          };
42 <         $filename=urlhandler($url);
42 >         $filename=urlhandler::urlhandler($url);
43          $switch=Switcher->new($BootHash, $filename);
44          $switch->parse();
45   }
# Line 41 | Line 49 | sub Bootlocaltop($hashref) {
49          use Cwd;
50          use Utilities::AddDir;
51  
52 <        checkparam($hashref, $name, "name");
53 <        checkparam($hashref, $name, "version");
52 >        $switch->checkparam($hashref, $name, "name");
53 >        $switch->checkparam($hashref, $name, "version");
54          $ENV{LOCALTOP}=&cwd."/".$$hashref{'name'}."_".$$hashref{'version'};
55          $scramdir=$ENV{LOCALTOP}."/.SCRAM";
56 <        &adddir($scramdir);
56 >        &AddDir::adddir($scramdir);
57 >        chdir $ENV{LOCALTOP};
58   }
59  
60   sub project_start {
# Line 65 | Line 74 | sub project_start {
74                  "version=$$hashref{version}>\n";
75          print INSTALLFILE "<base urltype=file value=$scramdir>\n";
76          print INSTALLFILE "<file name=Environment>\n";
77 +        push @{ $basehash{file}}, "$ENV{SCRAM_HOME}/toolbox";
78 +        $lastbasekey='file';
79 +        push @dirstack, $scramdir;
80 +        $currentdir=$scramdir;
81   }
82  
83   sub project_finish {
# Line 82 | Line 95 | sub config_starttag {
95          my $hashref;
96  
97          $hashref=$switch->SetupValueHash( \@vars );
98 <        checkparam($hashref, $name, "dir");
98 >        $switch->checkparam($hashref, $name, "dir");
99          print ENVIRONMENT 'projconfigdir='.$$hashref{'dir'}."\n";
100          $ENV{SCRAM_BootStrapFiles}=$ENV{SCRAM_BootStrapFiles}.":".
101                  $ENV{LOCALTOP}."/".$$hashref{'dir'};
102 +        push @dirstack, $ENV{LOCALTOP}."/".$$hashref{'dir'};
103 +        $currentdir=$ENV{LOCALTOP}."/".$$hashref{'dir'};
104 + }
105 + sub config_endtag {
106 +        pop @dirstack;
107 +        $currentdir=$dirstack[$#dirstack];
108   }
109  
110   sub file_start {
# Line 94 | Line 113 | sub file_start {
113          my $hashref;
114  
115          $hashref=$switch->SetupValueHash( \@vars );
116 <        checkparam($hashref, $name, "name");
116 >        $switch->checkparam($hashref, $name, "name");
117          # now download the file
118          print "Downloading File .... $$hashref{'name'}\n";
119 <        &urlhandler(&geturlbase."/".$$hashref{'name'},
119 >        &urlhandler::urlhandler(&geturlbase."/".$$hashref{'name'},
120                           $scramdir."/".$$hashref{'name'}) ;
121          if ( $switch->context('project') ) {
122           print INSTALLFILE "<$name name=$$hashref{name}>\n";
# Line 110 | Line 129 | sub reqs_start {
129          my $hashref;
130  
131          $hashref=$switch->SetupValueHash( \@vars );
132 <        checkparam($hashref, $name, "name");
132 >        $switch->checkparam($hashref, $name, "name");
133          use clientfile;
134          $ENV{SCRAM_ProjReqsDoc}=
135 <        &urlhandler(&geturlbase."/".$$hashref{'name'},
136 <                $scramdir."/".$$hashref{'name'}) ;
135 >          $currentdir."/".$$hashref{'name'};
136 > #       &urlhandler::urlhandler(&geturlbase."/".$$hashref{'name'},
137 > #               $scramdir."/".$$hashref{'name'}) ;
138          if ( $switch->context("project") ) {
139           print INSTALLFILE "<$name name=$$hashref{name}>\n";
140          }
# Line 126 | Line 146 | sub base_start {
146          my $hashref;
147  
148          $hashref=$switch->SetupValueHash( \@vars );
149 <        checkparam($hashref, $name, 'urltype');
150 <        checkparam($hashref, $name, 'value');
149 >        $switch->checkparam($hashref, $name, 'urltype');
150 >        $switch->checkparam($hashref, $name, 'value');
151          push @{ $basehash{ $$hashref{'urltype'} }}, $$hashref{'value'};
152          $lastbasekey=$$hashref{'urltype'};
153          #print $lastbasekey." lastbasekey \n";
# Line 137 | Line 157 | sub base_end {
157          pop @{ $basehash{$lastbasekey} };
158   }
159  
160 < sub checkparam($hash, $name, $key) {
161 <        my $hashref=shift;
162 <        my $name=shift;
163 <        my $key=shift;
164 <
165 <        if ( ! defined $$hashref{$key} ) {
166 <           print "BootParser: Badly formed $name tag -".
167 <                        " undefined $key parameter\n";
168 <           exit 1;
169 <        }
170 <        $$hashref{$key}=~s/["']//;
171 < }
160 > #sub checkparam($hash, $name, $key) {
161 > #       my $hashref=shift;
162 > #       my $name=shift;
163 > #       my $key=shift;
164 > #
165 > #       if ( ! defined $$hashref{$key} ) {
166 > #           print "BootParser: Badly formed $name tag -".
167 > #                        " undefined $key parameter\n";
168 > #           exit 1;
169 > #        }
170 > #       $$hashref{$key}=~s/["']//;
171 > #}
172  
173   #Just a file for now!
174   #Will eventually cross ref with access checker to get types available.
# Line 183 | Line 203 | sub install_finish {
203          my $name=shift;
204          my @vars=@_;
205          my $hashref;
206 +        use Utilities::AddDir;
207 +        use File::Copy;
208 +
209 +        # copy across the files in the config directory
210 +        AddDir::adddir($ENV{LOCALTOP}/$ENV{projconfigdir});
211 +        copy "$ENV{RELEASETOP}/$ENV{projconfigdir}",
212 +                        "$ENV{LOCALTOP}/$ENV{projconfigdir}";
213 + }
214 +
215 + sub cvsrep_start {
216 +        my $name=shift;
217 +        my @vars=@_;
218 +        my $hashref;
219 +
220 +          $hashref=$switch->SetupValueHash( \@vars );
221 +          $switch->checkparam($hashref, $name, 'auth' );
222 +          $switch->checkparam($hashref, $name, 'base' );
223 +          $cvsobject=cvsmodule->new();
224 +          $cvsobject->set_base($$hashref{base});
225 +          $cvsobject->set_auth($$hashref{auth});
226 +          if ( exists $$hashref{user} ) {
227 +             $cvsobject->set_user($$hashref{user});
228 +          }
229 +          if ( exists $$hashref{passkey} ) {
230 +             $cvsobject->set_passkey($$hashref{passkey});
231 +          }
232 + }
233 +
234 + sub cvsrep_end {
235 +        my $name=shift;
236 +        $cvsobject=undef; #Move out of scope to destroy cvsrep context
237 + }
238 +
239 + sub cvs_start {
240 +        my $name=shift;
241 +        my @vars=@_;
242 +        my $hashref;
243 +        
244 +        if ( ! defined $cvsobject )  {
245 +          print "BootStraper: Undefined cvs repository on line ".
246 +                $switch->{linenumber}."\n - set up repository".
247 +                "specifics with the <cvsrep> flag\n";
248 +          exit 1;
249 +        }
250 +        $hashref=$switch->SetupValueHash( \@vars );
251 +        $switch->checkparam( $hashref, $name, "fn" );
252 +        $cvsobject->invokecvs( (split / /, $$hashref{fn} ) );
253   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines