cipd: delay reading version files

This info is only used when bootstrapping for the first time,
so move these vars to that function to avoid wasted effort.

Bug: 1469696
Change-Id: I21b97b2429cf2dac6242e2e86aa7668b09ed47c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4752396
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
changes/96/4752396/2
Mike Frysinger 2 years ago committed by LUCI CQ
parent b9b690ec0e
commit b7c550a6bc

@ -94,7 +94,6 @@ CIPD_BACKEND="https://chrome-infra-packages.appspot.com"
VERSION_FILE="${MYPATH}/cipd_client_version"
CLIENT="${MYPATH}/.cipd_client"
VERSION=$(<"${VERSION_FILE}")
PLATFORM="${OS}-${ARCH}"
# A value in .cipd_client_platform overrides the "guessed" platform.
@ -103,7 +102,6 @@ if [ -f "${PLATFORM_OVERRIDE_FILE}" ]; then
PLATFORM=$(<"${PLATFORM_OVERRIDE_FILE}")
fi
URL="${CIPD_BACKEND}/client?platform=${PLATFORM}&version=${VERSION}"
USER_AGENT="depot_tools/$(git -C ${MYPATH} rev-parse HEAD 2>/dev/null || echo "???")"
@ -170,6 +168,9 @@ function clean_bootstrap() {
exit 1
fi
local VERSION=$(<"${VERSION_FILE}")
local URL="${CIPD_BACKEND}/client?platform=${PLATFORM}&version=${VERSION}"
# Download the client into a temporary file, check its hash, then move it into
# the final location.
#

Loading…
Cancel
Save