From d9839e8e7a078df40b33b76bf25c4a2f3199d3be Mon Sep 17 00:00:00 2001 From: "mmoss@chromium.org" Date: Tue, 11 Feb 2014 20:19:06 +0000 Subject: [PATCH] Better restriction to prevent Windows git install on XP or older. This is in preparation for once again making 1.8.5.2 the default Windows git. Also remove the CHROME_HEADLESS condition, which confuses bot setup because the same bot will sometimes run without that set (e.g. at slave startup) and with it set (e.g. during a build), leading to the wrong, or even no, git installed. R=maruel@chromium.org Review URL: https://codereview.chromium.org/160033002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@250486 0039d316-1c4b-4281-b951-d872f2087c98 --- bootstrap/win/win_tools.bat | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index ee19b5841..2e74896bf 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -35,12 +35,24 @@ goto :GIT_180_FORCE :GIT_1852_CHECK set GIT_VERSION=1.8.5.2.chromium.1 +:: This git uses APIs that target WINVER 0x0502, so refuse to install it on +:: anything older. +for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i +for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VERMINOR=%%j) +if %VERMAJOR% lss 5 goto :GIT_VER_UNSUPPORTED +if %VERMAJOR% equ 5 if %VERMINOR% lss 2 goto :GIT_VER_UNSUPPORTED set GIT_BIN_DIR=git-%GIT_VERSION%_bin set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_FILE% goto :GIT_COMMON +:GIT_VER_UNSUPPORTED +echo Git %GIT_VERSION% cannot be installed on: +ver +goto :GIT_180_CHECK + + :GIT_180_FORCE :: If the new git was installed, remove all installed git packages to trigger :: reinstallation of the old version. @@ -64,7 +76,6 @@ goto :GIT_COMMON :GIT_COMMON :: If the batch file exists, skip the git check. if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK -if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL call git --version 2>nul 1>nul if errorlevel 1 goto :GIT_INSTALL