15 # Perl script to clone or update all of the Foundation MCL repositories |
15 # Perl script to clone or update all of the Foundation MCL repositories |
16 |
16 |
17 use strict; |
17 use strict; |
18 |
18 |
19 my @clone_options = (); # use ("--noupdate") to clone without extracting the source |
19 my @clone_options = (); # use ("--noupdate") to clone without extracting the source |
|
20 my @pull_options = (); # use ("--rebase") to rebase your changes when pulling |
20 my $hostname = "developer.symbian.org"; |
21 my $hostname = "developer.symbian.org"; |
|
22 my $mirror = 0; # set to 1 if you want to mirror the repository structure |
|
23 my $retries = 1; # number of times to retry problem repos |
21 |
24 |
22 # Important: This script uses http access to the repositories, so |
25 # Important: This script uses http access to the repositories, so |
23 # the username and password will be stored as cleartext in the |
26 # the username and password will be stored as cleartext in the |
24 # .hg/hgrc file in each repository. |
27 # .hg/hgrc file in each repository. |
25 |
28 |
26 my $username = ""; |
29 my $username = ""; |
27 my $password = ""; |
30 my $password = ""; |
28 |
31 |
29 if ($username eq "" || $password eq "") |
32 if ($username eq "" || $password eq "") |
30 { |
33 { |
31 print "Must edit this script to supply your username and password\n"; |
34 print "Username: "; |
32 exit 1; |
35 $username = <STDIN>; |
|
36 print "Password: "; |
|
37 $password = <STDIN>; |
|
38 chomp $username; |
|
39 chomp $password; |
33 } |
40 } |
34 |
41 |
35 my @sf_packages = ( |
42 my @sf_packages = ( |
36 "sfl/MCL/sf/adaptation/stubs", |
43 "sfl/MCL/sf/adaptation/stubs", |
37 "sfl/MCL/sf/app/camera", |
44 "sfl/MCL/sf/app/camera", |
96 "sfl/MCL/sf/mw/messagingmw", |
103 "sfl/MCL/sf/mw/messagingmw", |
97 "sfl/MCL/sf/mw/metadatasrv", |
104 "sfl/MCL/sf/mw/metadatasrv", |
98 "sfl/MCL/sf/mw/mmappfw", |
105 "sfl/MCL/sf/mw/mmappfw", |
99 "sfl/MCL/sf/mw/mmmw", |
106 "sfl/MCL/sf/mw/mmmw", |
100 "sfl/MCL/sf/mw/mmuifw", |
107 "sfl/MCL/sf/mw/mmuifw", |
101 "sfl/MCL/sf/mw/mobiletv", |
108 # "sfl/MCL/sf/mw/mobiletv", - empty package abandoned |
102 "sfl/MCL/sf/mw/netprotocols", |
109 "sfl/MCL/sf/mw/netprotocols", |
103 "sfl/MCL/sf/mw/networkingdm", |
110 "sfl/MCL/sf/mw/networkingdm", |
104 "sfl/MCL/sf/mw/opensrv", |
111 "sfl/MCL/sf/mw/opensrv", |
105 "sfl/MCL/sf/mw/phonesrv", |
112 "sfl/MCL/sf/mw/phonesrv", |
106 "sfl/MCL/sf/mw/remoteconn", |
113 "sfl/MCL/sf/mw/remoteconn", |
130 "sfl/MCL/sf/os/kernelhwsrv", |
137 "sfl/MCL/sf/os/kernelhwsrv", |
131 "sfl/MCL/sf/os/lbs", |
138 "sfl/MCL/sf/os/lbs", |
132 # "sfl/MCL/sf/os/misc", - removed in 7 May 09 delivery |
139 # "sfl/MCL/sf/os/misc", - removed in 7 May 09 delivery |
133 "sfl/MCL/sf/os/mm", |
140 "sfl/MCL/sf/os/mm", |
134 "sfl/MCL/sf/os/networkingsrv", |
141 "sfl/MCL/sf/os/networkingsrv", |
135 "sfl/MCL/sf/os/osrndtools", # added 7 Mar 09 |
|
136 "sfl/MCL/sf/os/ossrv", |
142 "sfl/MCL/sf/os/ossrv", |
137 "sfl/MCL/sf/os/persistentdata", |
143 "sfl/MCL/sf/os/persistentdata", |
138 "sfl/MCL/sf/os/security", |
144 "sfl/MCL/sf/os/security", |
139 "sfl/MCL/sf/os/shortlinksrv", |
145 "sfl/MCL/sf/os/shortlinksrv", |
140 "sfl/MCL/sf/os/textandloc", |
146 "sfl/MCL/sf/os/textandloc", |
190 "sfl/MCL/sftools/dev/ide/carbidecppplugins", |
196 "sfl/MCL/sftools/dev/ide/carbidecppplugins", |
191 "sfl/MCL/sftools/dev/iss", |
197 "sfl/MCL/sftools/dev/iss", |
192 "sfl/MCL/sftools/dev/ui", |
198 "sfl/MCL/sftools/dev/ui", |
193 ); |
199 ); |
194 |
200 |
195 foreach my $package (@sf_packages, @sftools_packages) |
201 my @other_repos = ( |
196 { |
202 # Foundation build framework |
|
203 "oss/FCL/interim/fbf/bootstrap", |
|
204 "oss/FCL/interim/fbf/configs/default", |
|
205 "oss/FCL/interim/fbf/configs/pkgbuild", |
|
206 "oss/FCL/interim/fbf/projects/packages/serviceapi", |
|
207 "oss/FCL/interim/fbf/projects/packages/serviceapifw", |
|
208 "oss/FCL/interim/fbf/projects/packages/web", |
|
209 "oss/FCL/interim/fbf/projects/packages/webuis", |
|
210 "oss/FCL/interim/fbf/projects/platforms", |
|
211 # Utilities |
|
212 "oss/MCL/utilities", |
|
213 ); |
|
214 |
|
215 sub get_repo($) |
|
216 { |
|
217 my ($package) = @_; |
197 my @dirs = split /\//, $package; |
218 my @dirs = split /\//, $package; |
198 my $license = shift @dirs; |
219 my $license = shift @dirs; |
199 my $repotree = shift @dirs; # remove the MCL or FCL repo tree information |
220 my $repotree = shift @dirs; # remove the MCL or FCL repo tree information |
200 my $destdir = pop @dirs; # ignore the package name, because Mercurial will create that |
221 my $destdir = pop @dirs; # ignore the package name, because Mercurial will create that |
201 |
222 |
|
223 if ($mirror) |
|
224 { |
|
225 # Mirror the full directory structure, so put back the license & repotree dirs |
|
226 unshift @dirs, $repotree; |
|
227 unshift @dirs, $license; |
|
228 } |
|
229 |
202 # Ensure the directories already exist as far as the parent of the repository |
230 # Ensure the directories already exist as far as the parent of the repository |
203 my $path = ""; |
231 my $path = ""; |
204 foreach my $dir (@dirs) |
232 foreach my $dir (@dirs) |
205 { |
233 { |
206 $path = ($path eq "") ? $dir : "$path/$dir"; |
234 $path = ($path eq "") ? $dir : "$path/$dir"; |
222 if (-d "$path/.hg") |
250 if (-d "$path/.hg") |
223 { |
251 { |
224 # The repository already exists, so just do an update |
252 # The repository already exists, so just do an update |
225 |
253 |
226 print "Updating $destdir from $package...\n"; |
254 print "Updating $destdir from $package...\n"; |
227 system("hg", "pull", "-R", $path, $repo_url); |
255 return system("hg", "pull", @pull_options, "-R", $path, $repo_url); |
228 } |
256 } |
229 else |
257 else |
230 { |
258 { |
231 # Clone the repository |
259 # Clone the repository |
232 |
260 |
233 print "Cloning $destdir from $package...\n"; |
261 print "Cloning $destdir from $package...\n"; |
234 system("hg", "clone", @clone_options, $repo_url, $path); |
262 return system("hg", "clone", @clone_options, $repo_url, $path); |
235 } |
263 } |
236 |
264 |
237 } |
265 } |
|
266 |
|
267 my @all_packages; |
|
268 |
|
269 @all_packages = (@sf_packages, @sftools_packages, @other_repos); |
|
270 |
|
271 if ($mirror) |
|
272 { |
|
273 push @clone_options, "--noupdate"; |
|
274 } |
|
275 |
|
276 my @problem_packages = (); |
|
277 my $total_packages = 0; |
|
278 |
|
279 foreach my $package (@all_packages) |
|
280 { |
|
281 my $err = get_repo($package); |
|
282 $total_packages++; |
|
283 push @problem_packages, $package if ($err); |
|
284 |
|
285 if ($mirror && $package =~ /MCL/) |
|
286 { |
|
287 # If mirroring, get the matching FCLs as well as MCLs |
|
288 $package =~ s/MCL/FCL/; |
|
289 $err = get_repo($package); |
|
290 $total_packages++; |
|
291 push @problem_packages, $package if ($err); |
|
292 } |
|
293 } |
|
294 |
|
295 # retry problem packages |
|
296 |
|
297 while ($retries > 0 && scalar @problem_packages) |
|
298 { |
|
299 $retries --; |
|
300 my @list = @problem_packages; |
|
301 @problem_packages = (); |
|
302 foreach my $package (@list) |
|
303 { |
|
304 my $err = get_repo($package); |
|
305 push @problem_packages, $package if ($err); |
|
306 } |
|
307 } |
|
308 |
|
309 printf "\n------------\nProcessed %d packages, of which %d reported errors\n", |
|
310 $total_packages, scalar @problem_packages; |
|
311 if (scalar @problem_packages) |
|
312 { |
|
313 print join("\n", @problem_packages, ""); |
|
314 } |