@@ -22,9 +22,6 @@ REPO_DIR="$1"
22
22
CACHE_DIR=" $2 "
23
23
24
24
cache_src_dir=" $CACHE_DIR /src"
25
- # If the layout of the cache directory changes, bump the number here
26
- # (and anywhere else this file is referenced) so the cache is wiped
27
- cache_valid_file=" $CACHE_DIR /cache_valid1"
28
25
29
26
if [ ! -d " $REPO_DIR " -o ! -d " $REPO_DIR /.git" ]; then
30
27
echo " Error: $REPO_DIR does not exist or is not a git repo"
@@ -36,47 +33,19 @@ if [ ! -d "$CACHE_DIR" ]; then
36
33
exit 1
37
34
fi
38
35
39
- # Wipe the cache if it's not valid, or mark it as invalid while we update it
40
- if [ ! -f " $cache_valid_file " ]; then
41
- echo " Invalid cache, wiping ($cache_valid_file missing)"
42
- rm -rf " $CACHE_DIR "
43
- mkdir " $CACHE_DIR "
44
- else
45
- # Ignore errors while gathering information about the possible brokenness
46
- # of the git repo since our gathered info will tell us something is wrong
47
- set +o errexit
48
- stat_lines=$( cd " $cache_src_dir " && git status --porcelain | wc -l)
49
- stat_ec=$( cd " $cache_src_dir " && git status > /dev/null 2>&1 ; echo $? )
50
- set -o errexit
51
- if [ ! -d " $cache_src_dir /.git" -o $stat_lines != 0 -o $stat_ec != 0 ]; then
52
- # Something is badly wrong - the cache valid file is here, but something
53
- # about the git repo is fishy. Nuke it all, just in case
54
- echo " WARNING: $cache_valid_file exists but bad repo: l:$stat_lines , ec:$stat_ec "
55
- rm -rf " $CACHE_DIR "
56
- mkdir " $CACHE_DIR "
57
- else
58
- echo " Valid cache ($cache_valid_file exists)"
59
- rm " $cache_valid_file "
60
- fi
61
- fi
36
+ rm -rf " $CACHE_DIR "
37
+ mkdir " $CACHE_DIR "
62
38
63
39
travis_fold start update_cache
64
40
travis_time_start
65
41
66
42
# Update the cache (a pristine copy of the rust source master)
67
- if [ ! -d " $cache_src_dir /.git" ]; then
68
- retry sh -c " rm -rf $cache_src_dir && mkdir -p $cache_src_dir && \
69
- git clone https://github.com/rust-lang/rust.git $cache_src_dir "
70
- fi
71
- retry sh -c " cd $cache_src_dir && git reset --hard && git pull"
43
+ retry sh -c " rm -rf $cache_src_dir && mkdir -p $cache_src_dir && \
44
+ git clone --depth 1 https://github.com/rust-lang/rust.git $cache_src_dir "
72
45
(cd $cache_src_dir && git rm src/llvm)
73
46
retry sh -c " cd $cache_src_dir && \
74
47
git submodule deinit -f . && git submodule sync && git submodule update --init"
75
48
76
- # Cache was updated without errors, mark it as valid
77
- echo " Refreshed cache (touch $cache_valid_file )"
78
- touch " $cache_valid_file "
79
-
80
49
travis_fold end update_cache
81
50
travis_time_finish
82
51
0 commit comments