From 6c50e8122b2fa520efe9ea3ca837aa97b21f4be4 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 10 Jan 2012 10:06:47 +1000 Subject: 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 Reviewed-by: Jason McDonald --- init-repository | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'init-repository') diff --git a/init-repository b/init-repository index c324eef6..b874af3a 100755 --- a/init-repository +++ b/init-repository @@ -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 @@ -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); -- cgit v1.2.3