]> xenbits.xensource.com Git - osstest.git/commitdiff
git caching: abolish cacheing-git, and replace with use of chiark-utils git-cache... flight-21860 flight-21870 flight-21871 flight-21872 flight-21873 flight-21874 flight-21875 flight-21876 flight-21877 flight-21878 flight-21879 flight-21880 flight-21881 flight-21882 flight-21883 flight-21884 flight-21885 flight-21886 flight-21887 flight-21888 flight-21889 flight-21890 flight-21891 flight-21892 flight-21893 flight-21894 flight-21895 flight-21896 flight-21897 flight-21898 flight-21900 flight-21904 flight-21905 flight-21906 flight-21907 flight-21908 flight-21909 flight-21910 flight-21911 flight-21912 flight-21913 flight-21914 flight-21915 flight-21916 flight-21917 flight-21918 flight-21919 flight-21920 flight-21921 flight-21922 flight-21923 flight-21924 flight-21925 flight-21926 flight-21927 flight-21928 flight-21929 flight-21930 flight-21931 flight-21932 flight-21933 flight-21934 flight-21935 flight-21936 flight-21937 flight-21938 flight-21939 flight-21940 flight-21941 flight-21942 flight-21943 flight-21944 flight-21945 flight-21946 flight-21947 flight-21948 flight-21949 flight-21950 flight-21951 flight-21952 flight-21953 flight-21956 flight-21957 flight-21959 flight-21960 flight-21961 flight-21962 flight-21963 flight-21964 flight-21965 flight-21966 flight-21967 flight-21969 flight-21970 flight-21971 flight-21972 flight-21973 flight-21974 flight-21975 flight-21976 flight-21977 flight-21978 flight-21979 flight-21980 flight-21981 flight-21982 flight-21983 flight-21984 flight-21985 flight-21986 flight-21987 flight-21988 flight-21989 flight-21990 flight-21991 flight-21992 flight-21993 flight-21994 flight-21995 flight-21996 flight-21997 flight-21998 flight-21999 flight-22000 flight-22001
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 11 Nov 2013 15:58:20 +0000 (15:58 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 11 Nov 2013 15:58:20 +0000 (15:58 +0000)
Osstest/TestSupport.pm
adhoc-revtuple-generator
cacheing-git [deleted file]
cri-common
mg-clear-git-caches [deleted file]
production-config
ts-xen-build-prep

index d2e29d01d3bbce992cbae91825cffb5369714b89..a9cdc9c340b63b7f6ab10e005ec39301a3058653 100644 (file)
@@ -71,6 +71,7 @@ BEGIN {
                       built_compress_stashed
                       hg_dir_revision git_dir_revision vcs_dir_revision
                       store_revision store_vcs_revision
+                      git_massage_url
 
                       sshopts authorized_keys
                       remote_perl_script_open remote_perl_script_done
@@ -499,12 +500,10 @@ sub target_editfile_root ($$$;$$) {
 
 sub target_cmd_build ($$$$) {
     my ($ho,$timeout,$builddir,$script) = @_;
-    my $cacheing_git = "";
-    $cacheing_git = ":\$HOME/bin" if $ho->{Flags}{'no-reinstall'};
     target_cmd($ho, <<END.$script, $timeout);
        set -xe
         LC_ALL=C; export LC_ALL
-        PATH=/usr/lib/ccache$cacheing_git:\$PATH:/usr/lib/git-core
+        PATH=/usr/lib/ccache:\$PATH:/usr/lib/git-core
         exec </dev/null
         cd $builddir
 END
@@ -965,6 +964,13 @@ sub file_simple_write_contents ($$) {
 
 #---------- building, vcs's, etc. ----------
 
+sub git_massage_url ($) {
+    my ($url) = @_;
+
+    if ($c{GitCacheProxy}) { $url = $c{GitCacheProxy}.$url; }
+    return $url;
+}
+
 sub build_clone ($$$$) {
     my ($ho, $which, $builddir, $subdir) = @_;
 
@@ -994,8 +1000,10 @@ END
 END
     } elsif ($vcs eq 'git') {
 
+       my $eff_tree = git_massage_url($tree);
+
         target_cmd_build($ho, $timeout, $builddir, <<END.
-            git clone '$tree' $subdir
+            git clone '$eff_tree' $subdir
             cd $subdir
 END
                          (length($r{"revision_$which"}) ? <<END : ''));
index bd9ccff6e27eac6d92a53c45a0c01c885246aeb4..b9f9eb984f7be3f3357edde0ea65e77c97fac3cd 100755 (executable)
@@ -24,6 +24,7 @@ no warnings qw(recursion);
 use Data::Dumper;
 use POSIX;
 use Osstest;
+use Osstest::TestSupport;
 use Osstest::Executive;
 
 our $num= 1000;
@@ -96,11 +97,11 @@ sub git_generator ($) {
     my ($tree) = @_;
     print DEBUG "GIT-GEN ".pmap($tree).".\n";
     my $treename= $tree->{Treename};
+    my $eff_url = git_massage_url($tree->{Url});
     my $upcmd= <<END;
         set -e; exec >&2
         rm -rf $c{Repos}/$treename
-        CACHEING_GIT_CACHE=$c{Repos}/git-cache ./cacheing-git \\
-            clone --bare $tree->{Url} $c{Repos}/$treename
+        git clone --bare $eff_url $c{Repos}/$treename
 END
     print DEBUG "GIT-GEN UPCMD\n$upcmd\n";
     shellcmd($upcmd) if $doupdate;
diff --git a/cacheing-git b/cacheing-git
deleted file mode 100755 (executable)
index 4cef849..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/bin/bash
-
-# This is part of "osstest", an automated testing framework for Xen.
-# Copyright (C) 2009-2013 Citrix Inc.
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-# 
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-set -e
-
-: ${CACHEING_GIT_CACHE:=/volatile/git-cache}
-
-if ! test -x "$0"; then
-        echo >&2 "myself is $0 but not executable ?"
-        exit 127
-fi
-
-for git in `type -pa git`; do
-        if [ -x "$git" ] && ! cmp $git "$0" >/dev/null; then
-                REAL_GIT=$git
-                break
-        fi
-done
-
-if [ "x$REAL_GIT" = x ]; then
-        echo >&2 "$0: did not find git that wasn't me"
-        exit 127
-fi
-
-case "$1" in
-clone)
-       ;;
-*)
-       echo >&2 "running $REAL_GIT $@..."
-       exec $REAL_GIT "$@" ;;
-esac
-
-echo >&2 "using cache $CACHEING_GIT_CACHE..."
-
-if ! test -d "${CACHEING_GIT_CACHE}"; then
-       mkdir "${CACHEING_GIT_CACHE}"
-       echo >&2 'cache directory ($CACHEING_GIT_CACHE) does not exist'
-       exit 127
-fi
-
-if [ "x$CACHEING_GIT_CACHE_LOCKED" != "x$CACHEING_GIT_CACHE" ]; then
-       export CACHEING_GIT_CACHE_LOCKED="$CACHEING_GIT_CACHE"
-       exec with-lock-ex -w "$CACHEING_GIT_CACHE/lock" "$0" "$@"
-fi
-
-echo >&2 "locked cache $CACHEING_GIT_CACHE..."
-
-if ! test -f "$CACHEING_GIT_CACHE"/ok; then
-       echo >&2 "initialising cache $CACHEING_GIT_CACHE..."
-       rm -rf "$CACHEING_GIT_CACHE"/.git
-       (cd "$CACHEING_GIT_CACHE"; git-init-db --shared)
-       test $? = 0
-       touch "$CACHEING_GIT_CACHE"/ok
-fi
-
-subcmd="$1"; shift
-
-case "$subcmd" in
-clone)
-       echo >&2 "processing $0 $subcmd $@..."
-        $REAL_GIT "$subcmd" --reference $CACHEING_GIT_CACHE "$@"
-
-       while [ $# -gt 1 ]; do shift; done
-       if ! test -d "$1"; then
-               echo >&2 \
- "not updating cache; last arg \`$1' seems not to be dest dir"
-               exit 0
-       fi
-       relevant="$1"
-        cacheid=`basename "$1"`
-       ;;
-*)
-       echo >&2 "$0: internal error $1"
-       exit 1
-       ;;
-esac
-
-echo >&2 "updating cache $CACHEING_GIT_CACHE $cacheid..."
-
-mkdir_p () {
-        if test -d "$1"; then return; fi
-        mkdir "$1"
-}
-
-cache="$CACHEING_GIT_CACHE"/.git
-
-mkdir_p "$cache"/refs
-mkdir_p "$cache"/refs/caches
-mkdir_p "$cache"/refs/caches/"$cacheid"
-
-if test -d "$relevant"/.git; then
-        gitdir="$relevant"/.git
-else
-        # copes with clone --bare
-        gitdir="$relevant"
-fi
-
-${RSYNC-rsync} -r "$gitdir"/objects/. "$cache"/objects/.
-${RSYNC-rsync} --exclude=HEAD \
-               -r "$gitdir"/refs/.    "$cache"/refs/caches/"$cacheid"/.
index c8ac311fb2a28cfc51d5d8f100be91c4736c4c77..043b9fe0bdfb513701e1fe32d148c335fcc3f370 100644 (file)
@@ -26,12 +26,12 @@ repo_tree_rev_fetch_git () {
        local remoteurl=$2
        local remotetag=$3
        local localtag=$4
+       local realurl="`getconfig GitCacheProxy`$remoteurl"
        if ! test -d $repos/$treename; then
-               CACHEING_GIT_CACHE=$repos/git-cache ./cacheing-git \
-                       clone --bare $remoteurl $repos/$treename
+               git clone --bare $realurl $repos/$treename
        fi
        cd $repos/$treename
-       git fetch -f $remoteurl $remotetag:$localtag
+       git fetch -f $realurl $remotetag:$localtag
        git-rev-parse $localtag^0
 }
 
diff --git a/mg-clear-git-caches b/mg-clear-git-caches
deleted file mode 100755 (executable)
index 874d354..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-
-# This is part of "osstest", an automated testing framework for Xen.
-# Copyright (C) 2009-2013 Citrix Inc.
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-# 
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-set -e
-
-. cri-common
-
-if [ $# != 0 ]; then echo >&2 'usage: mg-clear-git-caches'; exit 1; fi
-
-cache=`getconfig GitCacheLocal`
-
-for lockfile in $cache/*/lock; do
-       hostdir=${lockfile%/lock}
-       host=${hostdir##*/}
-       (
-               printf "===== %s =====\n" $host
-               aside=$cache/$host.$$.`date +%s`.to-delete
-               mkdir $aside
-               if ! ./mg-allocate -U 10 $host; then continue; fi
-               set +e
-               mv $hostdir $aside/.
-               r=$?
-               set -e
-               ./mg-allocate !$host
-               if [ $r != 0 ]; then echo >&2 ' failed'; exit $r; fi
-               printf ' deleting\n'
-               sudo rm -rf $aside
-       ) &
-       sleep 0.5
-done
-
-echo "===== (waiting) ====="
-
-wait
-
-echo "===== DONE ====="
index af0d299e8dc070c394de71091bb764648c84c6ec..a0e73cb131b9a76256999cbc5bf864f038ce54d1 100644 (file)
@@ -39,8 +39,7 @@ LogsMinExpireAge= 86400*4
 
 TestHostKeypairPath /export/home/osstest/.ssh/id_rsa_osstest
 
-GitCache teravault-1.cam.xci-test.com:/export/home/xc_osstest/git-cache/
-GitCacheLocal /home/xc_osstest/git-cache/
+GitCacheProxy git://drall.uk.xensource.com:9419/
 
 PubBaseUrl http://www.chiark.greenend.org.uk/~xensrcts
 ReportHtmlPubBaseUrl="$c{PubBaseUrl}/logs"
index b6126f17d1fe4124f60144b8b123563ad901369c..e9e23b10ae6de4813bfd8aef23809853e99f19a1 100755 (executable)
@@ -187,74 +187,6 @@ END
     }
 }
 
-sub cacheing_git_mount () {
-    my $cache= $c{GitCache};
-    return unless $cache;
-
-    if ($cache =~ m,/$,) {
-        my $cachelocal= $c{GitCacheLocal};
-        my $subdir= $ho->{Name};
-        if (defined $cachelocal) {
-            my $umask= umask 0; # yes really
-            mkdir "$cachelocal/$subdir", 02777
-                or $!==&EEXIST or die "$cachelocal/$subdir $!";
-            umask $umask;
-
-            my $cachelock_dir= "/var/run/git-cache";
-            my $cachelock_real= "$cachelock_dir/lock";
-            target_cmd_root($ho, <<END);
-                set -e
-                umask 0
-                mkdir -p $cachelock_dir
-                true >>$cachelock_real
-END
-            my $cachelock_link= "$cachelocal/$subdir/lock";
-            if (lstat $cachelock_link) {
-                die "$cachelock_link is not a symlink" unless -l _;
-            } else {
-                symlink $cachelock_real, $cachelock_link
-                    or die "$cachelock_link $!";
-            }
-        }
-        $cache.= $subdir;
-    }
-
-    my $mountpoint= '/volatile/git-cache';
-
-    my $mounts= target_cmd_output_root($ho, "mount");
-    return if $mounts =~ m/^\S+ on \Q$mountpoint\E /om;
-
-    target_cmd_root($ho, "mkdir -vp $mountpoint");
-    target_editfile_root($ho, '/etc/fstab', sub {
-        while (<EI>) {
-            next if m/^\S+\s+\Q$mountpoint\E\s/o;
-            print EO or die $!;
-        }
-        printf EO "%s %s nfs rw,fg,retry=1440\n", $cache, $mountpoint or die $!;
-    });
-
-    my $mount_retries=10;
-    # mount can randomly fail due to upstream kernel bug (Debian #636306)
-    # this is a shonky workaround
-    for (;;) {
-        last if eval {
-            target_cmd_root($ho, "mount $mountpoint");
-            1;
-        };
-        logm("warning: failed to mount $mountpoint, trying again: $@");
-        die unless --$mount_retries > 0;
-        target_cmd_root($ho, "sync");
-        sleep(2);
-    }
-}
-
-sub cacheing_git_install () {
-    my $cache = $c{GitCache};
-    return unless $cache;
-    target_install_packages($ho, qw(chiark-utils-bin));
-    target_putfile_root($ho,10, "cacheing-git","/usr/local/bin/git", "-p");
-}
-
 sub ccache_setup () {
     my $opts= get_host_property($ho, 'build ccache opts', '');
     if (length $opts) {
@@ -265,8 +197,6 @@ sub ccache_setup () {
 if (!$ho->{Flags}{'no-reinstall'}) {
     lvextend_stage1();
     prep();
-    cacheing_git_mount();
-    cacheing_git_install();
     ccache_setup();
     lvextend_stage2();
 }