3 # FIXME(61301): we need to debug spurious failures with this on Windows on
4 # Azure, so let's print more information in the logs.
11 ci_dir=$(cd $(dirname $0) && pwd)
14 travis_fold start init_repo
20 cache_src_dir="$CACHE_DIR/src"
22 if [ ! -d "$REPO_DIR" -o ! -d "$REPO_DIR/.git" ]; then
23 echo "Error: $REPO_DIR does not exist or is not a git repo"
27 if [ ! -d "$CACHE_DIR" ]; then
28 echo "Error: $CACHE_DIR does not exist or is not an absolute path"
35 # On the beta channel we'll be automatically calculating the prerelease version
36 # via the git history, so unshallow our shallow clone from CI.
37 if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then
38 git fetch origin --unshallow beta master
41 # Duplicated in docker/dist-various-2/shared.sh
42 function fetch_github_commit_archive {
44 local cached="download-${module//\//-}.tar.gz"
45 retry sh -c "rm -f $cached && \
46 curl -f -sSL -o $cached $2"
49 tar -C $module --strip-components=1 -xf $cached
53 included="src/llvm-project src/llvm-emscripten src/doc/book src/doc/rust-by-example"
54 modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
57 urls="$(git config --file .gitmodules --get-regexp '\.url$' | cut -d' ' -f2)"
59 for i in ${!modules[@]}; do
61 if [[ " $included " = *" $module "* ]]; then
62 commit="$(git ls-tree HEAD $module | awk '{print $3}')"
66 fetch_github_commit_archive $module "$url/archive/$commit.tar.gz" &
69 use_git="$use_git $module"
72 retry sh -c "git submodule deinit -f $use_git && \
73 git submodule sync && \
74 git submodule update -j 16 --init --recursive $use_git"
76 travis_fold end init_repo