about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-06-15 02:17:07 +0000
committerbors <bors@rust-lang.org>2017-06-15 02:17:07 +0000
commit0189cec5d4e782ca17dd510934e93a7bd327ba86 (patch)
treeacf944949d30a9de7b69c45a2a5d3c75427b291f
parent554c685b0b3b25b7aa752717edf50b8d6bcab7a0 (diff)
parentd0c1e6480c7d6e99118adf9f6aa2d25ac9625647 (diff)
downloadrust-0189cec5d4e782ca17dd510934e93a7bd327ba86.tar.gz
rust-0189cec5d4e782ca17dd510934e93a7bd327ba86.zip
Auto merge of #42665 - aidanhs:aphs-simplify-init-repos, r=Mark-Simulacrum
Use --depth to speed up pristine submodule cloning

In addition, remove all the unused cache stuff

r? @Mark-Simulacrum
-rwxr-xr-xsrc/ci/init_repo.sh39
1 files changed, 4 insertions, 35 deletions
diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh
index 282da009eac..817ed8dd554 100755
--- a/src/ci/init_repo.sh
+++ b/src/ci/init_repo.sh
@@ -22,9 +22,6 @@ REPO_DIR="$1"
 CACHE_DIR="$2"
 
 cache_src_dir="$CACHE_DIR/src"
-# If the layout of the cache directory changes, bump the number here
-# (and anywhere else this file is referenced) so the cache is wiped
-cache_valid_file="$CACHE_DIR/cache_valid1"
 
 if [ ! -d "$REPO_DIR" -o ! -d "$REPO_DIR/.git" ]; then
     echo "Error: $REPO_DIR does not exist or is not a git repo"
@@ -36,47 +33,19 @@ if [ ! -d "$CACHE_DIR" ]; then
     exit 1
 fi
 
-# Wipe the cache if it's not valid, or mark it as invalid while we update it
-if [ ! -f "$cache_valid_file" ]; then
-    echo "Invalid cache, wiping ($cache_valid_file missing)"
-    rm -rf "$CACHE_DIR"
-    mkdir "$CACHE_DIR"
-else
-    # Ignore errors while gathering information about the possible brokenness
-    # of the git repo since our gathered info will tell us something is wrong
-    set +o errexit
-    stat_lines=$(cd "$cache_src_dir" && git status --porcelain | wc -l)
-    stat_ec=$(cd "$cache_src_dir" && git status >/dev/null 2>&1; echo $?)
-    set -o errexit
-    if [ ! -d "$cache_src_dir/.git" -o $stat_lines != 0 -o $stat_ec != 0 ]; then
-        # Something is badly wrong - the cache valid file is here, but something
-        # about the git repo is fishy. Nuke it all, just in case
-        echo "WARNING: $cache_valid_file exists but bad repo: l:$stat_lines, ec:$stat_ec"
-        rm -rf "$CACHE_DIR"
-        mkdir "$CACHE_DIR"
-    else
-        echo "Valid cache ($cache_valid_file exists)"
-        rm "$cache_valid_file"
-    fi
-fi
+rm -rf "$CACHE_DIR"
+mkdir "$CACHE_DIR"
 
 travis_fold start update_cache
 travis_time_start
 
 # Update the cache (a pristine copy of the rust source master)
-if [ ! -d "$cache_src_dir/.git" ]; then
-    retry sh -c "rm -rf $cache_src_dir && mkdir -p $cache_src_dir && \
-        git clone https://github.com/rust-lang/rust.git $cache_src_dir"
-fi
-retry sh -c "cd $cache_src_dir && git reset --hard && git pull"
+retry sh -c "rm -rf $cache_src_dir && mkdir -p $cache_src_dir && \
+    git clone --depth 1 https://github.com/rust-lang/rust.git $cache_src_dir"
 (cd $cache_src_dir && git rm src/llvm)
 retry sh -c "cd $cache_src_dir && \
     git submodule deinit -f . && git submodule sync && git submodule update --init"
 
-# Cache was updated without errors, mark it as valid
-echo "Refreshed cache (touch $cache_valid_file)"
-touch "$cache_valid_file"
-
 travis_fold end update_cache
 travis_time_finish