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)
17 cache_src_dir="$CACHE_DIR/src"
19 if [ ! -d "$REPO_DIR" -o ! -d "$REPO_DIR/.git" ]; then
20 echo "Error: $REPO_DIR does not exist or is not a git repo"
24 if [ ! -d "$CACHE_DIR" ]; then
25 echo "Error: $CACHE_DIR does not exist or is not an absolute path"
32 # On the beta channel we'll be automatically calculating the prerelease version
33 # via the git history, so unshallow our shallow clone from CI.
34 if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then
35 git fetch origin --unshallow beta master
38 # Duplicated in docker/dist-various-2/shared.sh
39 function fetch_github_commit_archive {
41 local cached="download-${module//\//-}.tar.gz"
42 retry sh -c "rm -f $cached && \
43 curl -f -sSL -o $cached $2"
46 tar -C $module --strip-components=1 -xf $cached
50 included="src/llvm-project src/doc/book src/doc/rust-by-example"
51 modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
54 urls="$(git config --file .gitmodules --get-regexp '\.url$' | cut -d' ' -f2)"
56 # shellcheck disable=SC2068
57 for i in ${!modules[@]}; do
59 if [[ " $included " = *" $module "* ]]; then
60 commit="$(git ls-tree HEAD $module | awk '{print $3}')"
64 fetch_github_commit_archive $module "$url/archive/$commit.tar.gz" &
67 use_git="$use_git $module"
70 retry sh -c "git submodule deinit -f $use_git && \
71 git submodule sync && \
72 git submodule update -j 16 --init --recursive $use_git"