From 4d92fe4300adcc4b71db2438174a0d1398434f76 Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Mon, 24 Jul 2017 18:29:02 +0200 Subject: [PATCH] [bootstraps] Sync at gclient, suppress output. Have the "update_depot_tools" script also do a CIPD tool sync. This will ensure that users and systems have access to tooling at sync-time rather than just-in-time loading them at execution time. Update the tool boostraps to suppress any sort of syncing logic, if it does happen. This will ensure that users who execute the tools don't se unexpected output. BUG=None TEST=local - Tested on Mac and Windows. R=dpranke@chromium.org, iannucci@chromium.org Change-Id: I8efce8c73cc4e82ffdf5067ba9b917119a81e843 Reviewed-on: https://chromium-review.googlesource.com/581494 Commit-Queue: Daniel Jacques Reviewed-by: Robbie Iannucci --- .gitattributes | 2 +- led | 2 +- led.bat | 2 +- tests/gclient_smoketest.py | 4 ++++ update_depot_tools | 18 ++++++++++++------ update_depot_tools.bat | 9 +++++++-- vpython | 2 +- vpython.bat | 2 +- 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.gitattributes b/.gitattributes index bc99b4c6cd..104b92a37c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,7 @@ /*.py recipes /*.sh recipes -# Extensionless tools we want +# Extensionless tools we want and support scripts. /apply_issue recipes /clang* recipes /depot-tools-auth recipes diff --git a/led b/led index 7f7eeac1f0..c273aa0888 100755 --- a/led +++ b/led @@ -7,6 +7,6 @@ MYPATH=$(dirname "${BASH_SOURCE[0]}") source "$MYPATH/cipd_bin_setup.sh" -cipd_bin_setup +cipd_bin_setup &> /dev/null exec "$MYPATH/.cipd_bin/led" "$@" diff --git a/led.bat b/led.bat index 857ad12d29..1cbff244d8 100644 --- a/led.bat +++ b/led.bat @@ -3,5 +3,5 @@ :: Use of this source code is governed by a BSD-style license that can be :: found in the LICENSE file. -call "%~dp0\cipd_bin_setup.bat" +call "%~dp0\cipd_bin_setup.bat" > nul 2>&1 "%~dp0\.cipd_bin\led.exe" %* diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py index aa7e959cac..683d2b97f8 100755 --- a/tests/gclient_smoketest.py +++ b/tests/gclient_smoketest.py @@ -179,6 +179,10 @@ class GClientSmoke(GClientSmokeBase): self.check(res, self.gclient(['update'])) def testConfig(self): + # Get anhy bootstrapping out of the way. + results = self.gclient(['version']) + self.assertEquals(results[2], 0) + p = join(self.root_dir, '.gclient') def test(cmd, expected): if os.path.exists(p): diff --git a/update_depot_tools b/update_depot_tools index bc5ca48689..81e917eb5a 100755 --- a/update_depot_tools +++ b/update_depot_tools @@ -112,11 +112,17 @@ function update_git_repo { } # Update git checkouts. -if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] -then - cd $base_dir - update_git_repo - cd - > /dev/null +if [ "X$DEPOT_TOOLS_UPDATE" != "X0" ]; then + if [ -e "$base_dir/.git" ]; then + cd $base_dir + update_git_repo + cd - > /dev/null + fi + + # Sync CIPD and CIPD client tools. + source "$base_dir/cipd_bin_setup.sh" + cipd_bin_setup + + find "$base_dir" -iname "*.pyc" -exec rm -f {} \; fi -find "$base_dir" -iname "*.pyc" -exec rm -f {} \; diff --git a/update_depot_tools.bat b/update_depot_tools.bat index cfb44f0474..ec1108c520 100644 --- a/update_depot_tools.bat +++ b/update_depot_tools.bat @@ -52,5 +52,10 @@ for /F %%x in ('git config --get remote.origin.url') DO ( ) call git fetch -q origin > NUL call git rebase -q origin/master > NUL -if errorlevel 1 echo Failed to update depot_tools. -goto :EOF +if errorlevel 1 ( + echo Failed to update depot_tools. + goto :EOF +) + +:: Sync CIPD and CIPD client tools. +call "%~dp0\cipd_bin_setup.bat" diff --git a/vpython b/vpython index d836ae7bbc..3fd62f2d76 100755 --- a/vpython +++ b/vpython @@ -7,6 +7,6 @@ MYPATH=$(dirname "${BASH_SOURCE[0]}") source "$MYPATH/cipd_bin_setup.sh" -cipd_bin_setup +cipd_bin_setup &> /dev/null exec "$MYPATH/.cipd_bin/vpython" "$@" diff --git a/vpython.bat b/vpython.bat index a0de9c57ad..8aaf929751 100644 --- a/vpython.bat +++ b/vpython.bat @@ -3,5 +3,5 @@ :: Use of this source code is governed by a BSD-style license that can be :: found in the LICENSE file. -call "%~dp0\cipd_bin_setup.bat" +call "%~dp0\cipd_bin_setup.bat" > nul 2>&1 "%~dp0\.cipd_bin\vpython.exe" %*