init-repository: fall back to origin when mirror is unavailable

This allows init-repository to be used with servers mirroring only a
portion of the qt5 submodules.  Any missing modules will be cloned from
the canonical upstream URLs.

Change-Id: I4b266edd2ec7d49126578b54eace6de6de629b56
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Rohan McGovern
2012-01-10 10:06:47 +10:00
committed by Qt by Nokia
parent 7e177c50ce
commit 6c50e8122b

View File

@@ -194,6 +194,8 @@ For example:
user@machine:/foo/bar/qtbase.git
The mirror is permitted to contain a subset of the submodules; any
missing modules will fall back to the canonical URLs.
=item --mirror-webkit <url>
@@ -581,6 +583,13 @@ sub git_clone_one_submodule
$mirror =~ s/qtsoftware/gitorious/ ;
}
# Only use the mirror if it can be reached.
eval { $self->exe('git', 'ls-remote', $mirror, 'test/if/mirror/exists') };
if ($@) {
warn "mirror [$mirror] is not accessible; $url will be used\n";
undef $mirror;
}
my $do_clone = (! -d "$submodule/.git");
if ($do_clone) {
$self->exe('git', 'clone', @reference_args, ($mirror ? $mirror : $url), $submodule);