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
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
#---------- 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) = @_;
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 : ''));
use Data::Dumper;
use POSIX;
use Osstest;
+use Osstest::TestSupport;
use Osstest::Executive;
our $num= 1000;
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;
+++ /dev/null
-#!/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"/.
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
}
+++ /dev/null
-#!/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 ====="
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"
}
}
-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) {
if (!$ho->{Flags}{'no-reinstall'}) {
lvextend_stage1();
prep();
- cacheing_git_mount();
- cacheing_git_install();
ccache_setup();
lvextend_stage2();
}