diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-01-10 10:06:47 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-10 06:34:18 +0100 |
commit | 6c50e8122b2fa520efe9ea3ca837aa97b21f4be4 (patch) | |
tree | 8e31f3c7d4169054f278211dcf60105484d845bb /init-repository | |
parent | 7e177c50ce41188533fbaa4c718f2a44db785738 (diff) |
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>
Diffstat (limited to 'init-repository')
-rwxr-xr-x | init-repository | 9 |
1 files changed, 9 insertions, 0 deletions
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 <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); |