From 38e02c6434ef7bc29c38a2139db2595031414440 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 11 Aug 2011 10:30:41 +1000 Subject: init-repository: let `--http' option also work for v8 Useful for people behind restrictive firewalls. Task-number: QTBUG-20837 Change-Id: I1c6845ceb3b9ba17a0e36c97838a73ed94aa11f2 Reviewed-on: http://codereview.qt.nokia.com/2831 Reviewed-by: Qt Sanity Bot Reviewed-by: Alan Alpert --- init-repository | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'init-repository') diff --git a/init-repository b/init-repository index d01e314c..1a3e332e 100755 --- a/init-repository +++ b/init-repository @@ -566,6 +566,7 @@ sub git_clone_one_submodule my $mirror_url = $self->{ 'mirror-url' }; my $mirror_webkit_url = $self->{ 'mirror-webkit-url' }; my $mirror_v8_url = $self->{ 'mirror-v8-url' }; + my $protocol = $self->{ 'protocol' }; # `--reference FOO' args for the clone, if any. my @reference_args; @@ -628,7 +629,7 @@ sub git_clone_one_submodule if ($submodule eq "qtdeclarative") { #Extra step needed to setup declarative $self->exe('git', 'submodule', 'init'); - if ($do_clone and $mirror_v8_url) { + if ($mirror_v8_url || $protocol eq 'http') { my @configresult = qx(git config -l); my $v8url; foreach my $line (@configresult) { @@ -636,11 +637,25 @@ sub git_clone_one_submodule next if ($line !~ /submodule.src\/3rdparty\/v8.url=(.*)/); $v8url = $1; } - chdir('src/3rdparty/') or confess "chdir $submodule/src/3rdparty: $OS_ERROR"; - $self->exe('git', 'clone', $mirror_v8_url, 'v8'); - chdir('v8') or confess "chdir $submodule/src/3rdparty/v8: $OS_ERROR"; - $self->exe('git', 'config', 'remote.origin.url', $v8url); - chdir('../../..') or confess "cd ../../..: $OS_ERROR"; + + if ($protocol eq 'http') { + # rewrite the git:// url to https:// + if ($v8url =~ s{^git://github}{https://github}) { + $self->exe('git', 'config', 'submodule.src/3rdparty/v8.url', $v8url); + } + else { + warn 'You requested git over http, but I could not figure out how to ' + ."rewrite v8's giturl of $v8url"; + } + } + + if ($mirror_v8_url && $do_clone) { + chdir('src/3rdparty/') or confess "chdir $submodule/src/3rdparty: $OS_ERROR"; + $self->exe('git', 'clone', $mirror_v8_url, 'v8'); + chdir('v8') or confess "chdir $submodule/src/3rdparty/v8: $OS_ERROR"; + $self->exe('git', 'config', 'remote.origin.url', $v8url); + chdir('../../..') or confess "cd ../../..: $OS_ERROR"; + } } $self->exe('git', 'submodule', 'update'); } -- cgit v1.2.3