]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
ts-xen-build-prep: Use .gitconfig so _everything_ uses git cache
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 3 Aug 2016 14:49:34 +0000 (15:49 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 3 Aug 2016 15:46:14 +0000 (15:46 +0000)
In particular, when xen.git clones a subtrees, whose url we didn't
specify in the runvars, we end up using the url from xen.git's
Config.mk.

Arrange to use the git cache for all git urls, via the insteadOf
feature.

Note that the git config url insteadOf feature is backwards: one
configures the config variable "url.NEW-URL.insteadOf.OLD-URL".  So
the key is the value, and the value is the key.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
ts-xen-build-prep

index 0450811b523c22fd350fb63b277702919917bf25..4dd10c47c889745b9deddcaa515ec81f02c32883 100755 (executable)
@@ -243,6 +243,25 @@ sub ccache_setup () {
     }
 }
 
+sub gitcache_setup () {
+    my $proxy = $c{GitCacheProxy};
+    return unless $proxy;
+
+    logm("setting up git cacheing proxy $proxy");
+
+    my $gitcfg = '';
+    foreach my $urlprefix (qw(git:// http:// https://)) {
+       $gitcfg .= <<END
+[url "${proxy}$urlprefix"]
+        insteadOf = $urlprefix
+[url "${proxy}$urlprefix"]
+        insteadOf = ${proxy}$urlprefix
+END
+    }
+    target_putfilecontents_stash($ho,30,$gitcfg,"/home/osstest/.gitconfig",
+                                'home-osstest-gitconfig');
+}
+
 if (!$ho->{Flags}{'no-reinstall'}) {
     determine_vg_lv();
     lvcreate();
@@ -251,6 +270,7 @@ if (!$ho->{Flags}{'no-reinstall'}) {
     lvextend_stage2();
     replace_home();
     ccache_setup();
+    gitcache_setup();
 }
 $mjobdb->jobdb_resource_shared_mark_ready
    ($ho->{Ident}, $ho->{Name}, "build-".$ho->{Suite}."-".$r{arch});