]> xenbits.xensource.com Git - osstest.git/commitdiff
Tolerate outages of git://git.sv.gnu.org/gnulib.git
authorIan Campbell <ian.campbell@citrix.com>
Tue, 20 May 2014 10:54:36 +0000 (11:54 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 3 Jun 2014 15:07:50 +0000 (16:07 +0100)
gnulib is a bit special in that it isn't part of a push gate and
therefore doesn't have an output repo on xenbits. This means that if
git.sv.gnu.org is down for some reason then any flight which uses it
will potentially fail, even ones which are not specifically trying to
test gnulib.git. Normally unrelated flights are isolated from 3rd
party failures because they use the relevant push gates' outputs.

The git-proxy which we use supports passing [fetch=try] as an option
which will cause it to try and fetch from upstream and fall back to
the cached version if upstream does not respond. This is exactly what
we want for gnulib.git. Proxy options in the URL are separate with a
space which we encode here as %20 to avoid having to go around adding
quotes to all the uses of shell variables which contain a URL.

Provide a helper shell function cached_repo which conditionally
arranges for the given repo to be cached with the given options only
if the osstest config sets GitCacheProxy, so as not to break uses of
osstest outside of the production environment where a cache may not be
available (of course such uses will then be subject to outages of 3rd
party repos)

It was also necessary to make repo_tree_rev_fetch_git idempotent WRT
the proxy prefix to avoid trying to clone
git://proxy/git://proxy/git://some.real.domain/foo.git.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
ap-common
cri-common

index ea4b04c3f3ab63303c0ca152940eb3ac4bdd2eea..bca0feacbc7f4b8e34e338c13b9a3d620b48a68d 100644 (file)
--- a/ap-common
+++ b/ap-common
@@ -37,7 +37,7 @@
 : ${PUSH_TREE_LIBVIRT:=$XENBITS:/home/xen/git/libvirt.git}
 : ${BASE_TREE_LIBVIRT:=git://xenbits.xen.org/libvirt.git}
 
-: ${TREE_GNULIB_LIBVIRT:=git://git.sv.gnu.org/gnulib.git}
+: ${TREE_GNULIB_LIBVIRT:=$(cached_repo git://git.sv.gnu.org/gnulib.git \[fetch=try\])}
 
 : ${TREE_RUMPUSERXEN:=https://github.com/rumpkernel/rumpuser-xen}
 : ${TREEVCS_RUMPUSERXEN:=git}
index ea312f245ba1beb8b07c6e25789c9b8ca7ec7bb5..9cbf0d84335f6ae8d9e281e149dc5af0db5b15d4 100644 (file)
 
 umask 002
 
+cached_repo () {
+       local repo=$1
+       local options=$2
+       local cache=`getconfig GitCacheProxy`
+
+       if [ x$cache != x ] ; then
+               echo "$cache$repo%20$options"
+       else
+               echo "$repo"
+       fi
+}
+
 repo_tree_rev_fetch_git () {
        local treename=$1
        local remoteurl=$2
        local remotetag=$3
        local localtag=$4
+       local proxy=`getconfig GitCacheProxy`
        case $remoteurl in
+       $proxy*)
+               local realurl="$remoteurl" ;;
        git://*|http://*|https://*)
-               local realurl="`getconfig GitCacheProxy`$remoteurl" ;;
+               local realurl="$proxy$remoteurl" ;;
        *)
                local realurl="$remoteurl" ;;
        esac