From: Ian Jackson Subject: [OSSTEST PATCH 3/9] submodulefixup: Tell git cache [fetch=try] Date: Fri, 27 Jun 2014 17:58:16 +0100 Message-ID: <1403888302-30822-4-git-send-email-ian.jackson@eu.citrix.com> References: <1403888302-30822-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X0ZTu-00008l-9M for xen-devel@lists.xenproject.org; Fri, 27 Jun 2014 16:58:34 +0000 In-Reply-To: <1403888302-30822-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Make git_massage_url take an optional %xopts list, currently with only GitFetchBestEffort as a possible key. Use that in submodulefixup, unconditionally. Often the submodule update will work fine with an older version of the submodule, and if the submodule we get is out of date then the submodule update will fail anyway. Signed-off-by: Ian Jackson --- Osstest/BuildSupport.pm | 5 ++++- Osstest/TestSupport.pm | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Osstest/BuildSupport.pm b/Osstest/BuildSupport.pm index bd79b4b..f3b8c63 100644 --- a/Osstest/BuildSupport.pm +++ b/Osstest/BuildSupport.pm @@ -117,7 +117,10 @@ sub submodulefixup ($$$$) { $log1->(" recording url=$u"); store_runvar($urv, $u); } - my $nu = $submod->{Url} = git_massage_url($u); + my $nu = $submod->{Url} = + git_massage_url($u, GitFetchBestEffort => 1); + # If we don't manage to fetch a version which contains the + # necessary commit(s), we will fail later. $_ = "${l}${nu}\n"; } print ::EO or die $!; diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 93c8fcf..23ad106 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -1026,12 +1026,16 @@ sub file_simple_write_contents ($$) { #---------- building, vcs's, etc. ---------- -sub git_massage_url ($) { - my ($url) = @_; +sub git_massage_url ($;@) { + my ($url, %xopts) = @_; + # Supports $xopts{GitFetchBestEffort} if ($url =~ m,^(git|https?)://, && $c{GitCacheProxy} && substr($url,0,length($c{GitCacheProxy})) ne $c{GitCacheProxy}) { $url = $c{GitCacheProxy}.$url; + if ($xopts{GitFetchBestEffort}) { + $url .= '%20[fetch=try]'; + } } return $url; } -- 1.7.10.4