7 ci_dir=$(cd $(dirname $0) && pwd)
10 travis_fold start init_repo
16 cache_src_dir="$CACHE_DIR/src"
18 if [ ! -d "$REPO_DIR" -o ! -d "$REPO_DIR/.git" ]; then
19 echo "Error: $REPO_DIR does not exist or is not a git repo"
23 if [ ! -d "$CACHE_DIR" ]; then
24 echo "Error: $CACHE_DIR does not exist or is not an absolute path"
31 # On the beta channel we'll be automatically calculating the prerelease version
32 # via the git history, so unshallow our shallow clone from CI.
33 if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then
34 git fetch origin --unshallow beta master
37 # Duplicated in docker/dist-various-2/shared.sh
38 function fetch_github_commit_archive {
40 local cached="download-${module//\//-}.tar.gz"
41 retry sh -c "rm -f $cached && \
42 curl -f -sSL -o $cached $2"
45 tar -C $module --strip-components=1 -xf $cached
49 included="src/llvm-project src/llvm-emscripten src/doc/book src/doc/rust-by-example"
50 modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
53 urls="$(git config --file .gitmodules --get-regexp '\.url$' | cut -d' ' -f2)"
55 for i in ${!modules[@]}; do
57 if [[ " $included " = *" $module "* ]]; then
58 commit="$(git ls-tree HEAD $module | awk '{print $3}')"
62 fetch_github_commit_archive $module "$url/archive/$commit.tar.gz" &
65 use_git="$use_git $module"
68 retry sh -c "git submodule deinit -f $use_git && \
69 git submodule sync && \
70 git submodule update -j 16 --init --recursive $use_git"
72 travis_fold end init_repo