Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: bootstrap/win/win_tools.bat

Issue 160033002: Better restriction to prevent Windows git install on XP or older. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 @echo off 1 @echo off
2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 :: Use of this source code is governed by a BSD-style license that can be 3 :: Use of this source code is governed by a BSD-style license that can be
4 :: found in the LICENSE file. 4 :: found in the LICENSE file.
5 5
6 :: This script will try to find if svn and python are accessible and it not, 6 :: This script will try to find if svn and python are accessible and it not,
7 :: it will try to download it and 'install' it in depot_tools. 7 :: it will try to download it and 'install' it in depot_tools.
8 8
9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly 9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly
10 :: returned. 10 :: returned.
(...skipping 17 matching lines...) Expand all
28 :GIT_CHECK 28 :GIT_CHECK
29 if "%DEPOT_TOOLS_GIT_1852%" == "1" goto :GIT_1852_CHECK 29 if "%DEPOT_TOOLS_GIT_1852%" == "1" goto :GIT_1852_CHECK
30 :: Our new build of git doesn't work on some systems (e.g. uses newer APIs than 30 :: Our new build of git doesn't work on some systems (e.g. uses newer APIs than
31 :: available in XP), so force systems back to the old git while the failures 31 :: available in XP), so force systems back to the old git while the failures
32 :: are investigated, unless the new git was explicitly requested above. 32 :: are investigated, unless the new git was explicitly requested above.
33 goto :GIT_180_FORCE 33 goto :GIT_180_FORCE
34 34
35 35
36 :GIT_1852_CHECK 36 :GIT_1852_CHECK
37 set GIT_VERSION=1.8.5.2.chromium.1 37 set GIT_VERSION=1.8.5.2.chromium.1
38 :: This git uses APIs that target WINVER 0x0502, so refuse to install it on
39 :: anything older.
40 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i
M-A Ruel 2014/02/11 20:11:13 Somewhat rubberstamp, it's been a long time since
Michael Moss 2014/02/11 20:14:22 Yeah, me too, and I have no idea if this is the be
41 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j)
42 if %VERMAJOR% lss 5 goto :GIT_VER_UNSUPPORTED
43 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 goto :GIT_VER_UNSUPPORTED
38 set GIT_BIN_DIR=git-%GIT_VERSION%_bin 44 set GIT_BIN_DIR=git-%GIT_VERSION%_bin
39 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip 45 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip
40 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE% 46 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE%
41 goto :GIT_COMMON 47 goto :GIT_COMMON
42 48
43 49
50 :GIT_VER_UNSUPPORTED
51 echo Git %GIT_VERSION% cannot be installed on:
52 ver
53 goto :GIT_180_CHECK
54
55
44 :GIT_180_FORCE 56 :GIT_180_FORCE
45 :: If the new git was installed, remove all installed git packages to trigger 57 :: If the new git was installed, remove all installed git packages to trigger
46 :: reinstallation of the old version. 58 :: reinstallation of the old version.
47 if exist "%WIN_TOOLS_ROOT_DIR%\git-1.8.5.2.chromium.1_bin" ( 59 if exist "%WIN_TOOLS_ROOT_DIR%\git-1.8.5.2.chromium.1_bin" (
48 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\git-1.8.5.2.chromium.1_bin" 60 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\git-1.8.5.2.chromium.1_bin"
49 if exist "%WIN_TOOLS_ROOT_DIR%\git-1.8.0_bin" ( 61 if exist "%WIN_TOOLS_ROOT_DIR%\git-1.8.0_bin" (
50 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\git-1.8.0_bin" 62 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\git-1.8.0_bin"
51 ) 63 )
52 ) 64 )
53 goto :GIT_180_CHECK 65 goto :GIT_180_CHECK
54 66
55 67
56 :GIT_180_CHECK 68 :GIT_180_CHECK
57 set GIT_VERSION=1.8.0 69 set GIT_VERSION=1.8.0
58 set GIT_BIN_DIR=git-%GIT_VERSION%_bin 70 set GIT_BIN_DIR=git-%GIT_VERSION%_bin
59 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip 71 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip
60 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE% 72 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE%
61 goto :GIT_COMMON 73 goto :GIT_COMMON
62 74
63 75
64 :GIT_COMMON 76 :GIT_COMMON
65 :: If the batch file exists, skip the git check. 77 :: If the batch file exists, skip the git check.
66 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK 78 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK
67 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK
68 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL 79 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL
69 call git --version 2>nul 1>nul 80 call git --version 2>nul 1>nul
70 if errorlevel 1 goto :GIT_INSTALL 81 if errorlevel 1 goto :GIT_INSTALL
71 goto :SVN_CHECK 82 goto :SVN_CHECK
72 83
73 84
74 :MSYS_PATH_CHECK 85 :MSYS_PATH_CHECK
75 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul 86 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul
76 if errorlevel 1 goto :SVN_CHECK 87 if errorlevel 1 goto :SVN_CHECK
77 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" 88 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 goto :END 223 goto :END
213 224
214 225
215 :returncode 226 :returncode
216 set WIN_TOOLS_ROOT_URL= 227 set WIN_TOOLS_ROOT_URL=
217 set WIN_TOOLS_ROOT_DIR= 228 set WIN_TOOLS_ROOT_DIR=
218 exit /b %ERRORLEVEL% 229 exit /b %ERRORLEVEL%
219 230
220 :END 231 :END
221 call :returncode %ERRORLEVEL% 232 call :returncode %ERRORLEVEL%
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698