From b7c550a6bc8be23add49a01abf64feb099c2a232 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 4 Aug 2023 18:36:56 +0000 Subject: [PATCH] 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 Commit-Queue: Mike Frysinger --- cipd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cipd b/cipd index b20afe5b8a..965289f665 100755 --- a/cipd +++ b/cipd @@ -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. #