5 |
|
require Exporter; |
6 |
|
@ISA=qw(Exporter); |
7 |
|
@EXPORT=qw(BootStrapProject); |
8 |
+ |
use Utilities::cvsmodule; |
9 |
|
|
10 |
|
sub BootStrapProject($) { |
11 |
|
my $url=shift; |
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' => 'none', |
27 |
|
'base' => 'none', |
38 |
|
'file' => 'none', |
39 |
|
'file_starttag' => \&file_start |
40 |
|
}; |
41 |
< |
$filename=urlhandler($url); |
41 |
> |
$filename=urlhandler::urlhandler($url); |
42 |
|
$switch=Switcher->new($BootHash, $filename); |
43 |
|
$switch->parse(); |
44 |
|
} |
48 |
|
use Cwd; |
49 |
|
use Utilities::AddDir; |
50 |
|
|
51 |
< |
checkparam($hashref, $name, "name"); |
52 |
< |
checkparam($hashref, $name, "version"); |
51 |
> |
$switch->checkparam($hashref, $name, "name"); |
52 |
> |
$switch->checkparam($hashref, $name, "version"); |
53 |
|
$ENV{LOCALTOP}=&cwd."/".$$hashref{'name'}."_".$$hashref{'version'}; |
54 |
|
$scramdir=$ENV{LOCALTOP}."/.SCRAM"; |
55 |
< |
&adddir($scramdir); |
55 |
> |
&AddDir::adddir($scramdir); |
56 |
|
} |
57 |
|
|
58 |
|
sub project_start { |
89 |
|
my $hashref; |
90 |
|
|
91 |
|
$hashref=$switch->SetupValueHash( \@vars ); |
92 |
< |
checkparam($hashref, $name, "dir"); |
92 |
> |
$switch->checkparam($hashref, $name, "dir"); |
93 |
|
print ENVIRONMENT 'projconfigdir='.$$hashref{'dir'}."\n"; |
94 |
|
$ENV{SCRAM_BootStrapFiles}=$ENV{SCRAM_BootStrapFiles}.":". |
95 |
|
$ENV{LOCALTOP}."/".$$hashref{'dir'}; |
101 |
|
my $hashref; |
102 |
|
|
103 |
|
$hashref=$switch->SetupValueHash( \@vars ); |
104 |
< |
checkparam($hashref, $name, "name"); |
104 |
> |
$switch->checkparam($hashref, $name, "name"); |
105 |
|
# now download the file |
106 |
|
print "Downloading File .... $$hashref{'name'}\n"; |
107 |
< |
&urlhandler(&geturlbase."/".$$hashref{'name'}, |
107 |
> |
&urlhandler::urlhandler(&geturlbase."/".$$hashref{'name'}, |
108 |
|
$scramdir."/".$$hashref{'name'}) ; |
109 |
|
if ( $switch->context('project') ) { |
110 |
|
print INSTALLFILE "<$name name=$$hashref{name}>\n"; |
117 |
|
my $hashref; |
118 |
|
|
119 |
|
$hashref=$switch->SetupValueHash( \@vars ); |
120 |
< |
checkparam($hashref, $name, "name"); |
120 |
> |
$switch->checkparam($hashref, $name, "name"); |
121 |
|
use clientfile; |
122 |
|
$ENV{SCRAM_ProjReqsDoc}= |
123 |
< |
&urlhandler(&geturlbase."/".$$hashref{'name'}, |
123 |
> |
&urlhandler::urlhandler(&geturlbase."/".$$hashref{'name'}, |
124 |
|
$scramdir."/".$$hashref{'name'}) ; |
125 |
|
if ( $switch->context("project") ) { |
126 |
|
print INSTALLFILE "<$name name=$$hashref{name}>\n"; |
133 |
|
my $hashref; |
134 |
|
|
135 |
|
$hashref=$switch->SetupValueHash( \@vars ); |
136 |
< |
checkparam($hashref, $name, 'urltype'); |
137 |
< |
checkparam($hashref, $name, 'value'); |
136 |
> |
$switch->checkparam($hashref, $name, 'urltype'); |
137 |
> |
$switch->checkparam($hashref, $name, 'value'); |
138 |
|
push @{ $basehash{ $$hashref{'urltype'} }}, $$hashref{'value'}; |
139 |
|
$lastbasekey=$$hashref{'urltype'}; |
140 |
|
#print $lastbasekey." lastbasekey \n"; |
144 |
|
pop @{ $basehash{$lastbasekey} }; |
145 |
|
} |
146 |
|
|
147 |
< |
sub checkparam($hash, $name, $key) { |
148 |
< |
my $hashref=shift; |
149 |
< |
my $name=shift; |
150 |
< |
my $key=shift; |
151 |
< |
|
152 |
< |
if ( ! defined $$hashref{$key} ) { |
153 |
< |
print "BootParser: Badly formed $name tag -". |
154 |
< |
" undefined $key parameter\n"; |
155 |
< |
exit 1; |
156 |
< |
} |
157 |
< |
$$hashref{$key}=~s/["']//; |
158 |
< |
} |
147 |
> |
#sub checkparam($hash, $name, $key) { |
148 |
> |
# my $hashref=shift; |
149 |
> |
# my $name=shift; |
150 |
> |
# my $key=shift; |
151 |
> |
# |
152 |
> |
# if ( ! defined $$hashref{$key} ) { |
153 |
> |
# print "BootParser: Badly formed $name tag -". |
154 |
> |
# " undefined $key parameter\n"; |
155 |
> |
# exit 1; |
156 |
> |
# } |
157 |
> |
# $$hashref{$key}=~s/["']//; |
158 |
> |
#} |
159 |
|
|
160 |
|
#Just a file for now! |
161 |
|
#Will eventually cross ref with access checker to get types available. |
190 |
|
my $name=shift; |
191 |
|
my @vars=@_; |
192 |
|
my $hashref; |
193 |
+ |
use Utilities::AddDir; |
194 |
+ |
use File::Copy; |
195 |
+ |
|
196 |
+ |
# copy across the files in the config directory |
197 |
+ |
AddDir::adddir($ENV{LOCALTOP}/$ENV{projconfigdir}); |
198 |
+ |
copy "$ENV{RELEASETOP}/$ENV{projconfigdir}", |
199 |
+ |
"$ENV{LOCALTOP}/$ENV{projconfigdir}"; |
200 |
+ |
} |
201 |
+ |
|
202 |
+ |
sub cvsrep_start { |
203 |
+ |
my $name=shift; |
204 |
+ |
my @vars=@_; |
205 |
+ |
my $hashref; |
206 |
+ |
|
207 |
+ |
$hashref=$switch->SetupValueHash( \@vars ); |
208 |
+ |
$switch->checkparam($hashref, $name, 'auth' ); |
209 |
+ |
$switch->checkparam($hashref, $name, 'base' ); |
210 |
+ |
$cvsobject=cvsmodule->new(); |
211 |
+ |
$cvsobject->set_base($$hashref{base}); |
212 |
+ |
$cvsobject->set_auth($$hashref{auth}); |
213 |
+ |
if ( exists $$hashref{user} ) { |
214 |
+ |
$cvsobject->set_user($$hashref{user}); |
215 |
+ |
} |
216 |
+ |
if ( exists $$hashref{passkey} ) { |
217 |
+ |
$cvsobject->set_passkey($$hashref{passkey}); |
218 |
+ |
} |
219 |
+ |
} |
220 |
+ |
|
221 |
+ |
sub cvsrep_end { |
222 |
+ |
my $name=shift; |
223 |
+ |
$cvsobject=undef; #Move out of scope to destroy cvsrep context |
224 |
+ |
} |
225 |
+ |
|
226 |
+ |
sub cvs_start { |
227 |
+ |
my $name=shift; |
228 |
+ |
my @vars=@_; |
229 |
+ |
my $hashref; |
230 |
+ |
|
231 |
+ |
if ( ! defined $cvsobject ) { |
232 |
+ |
print "BootStraper: Undefined cvs repository on line ". |
233 |
+ |
$switch->{linenumber}."\n - set up repository". |
234 |
+ |
"specifics with the <cvsrep> flag\n"; |
235 |
+ |
exit 1; |
236 |
+ |
} |
237 |
+ |
$hashref=$switch->SetupValueHash( \@vars ); |
238 |
+ |
$switch->checkparam( $hashref, $name, "fn" ); |
239 |
+ |
$cvsobject->invokecvs( (split / /, $$hashref{fn} ) ); |
240 |
|
} |