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

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

Issue 816173002: Greatly clean up depot_tools handling of git binaries, add bleeding edge support for 1.9.5 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years 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
« 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 15 matching lines...) Expand all
26 26
27 27
28 :PYTHON_CHECK 28 :PYTHON_CHECK
29 if not exist "%WIN_TOOLS_ROOT_DIR%\python276_bin" goto :PY27_INSTALL 29 if not exist "%WIN_TOOLS_ROOT_DIR%\python276_bin" goto :PY27_INSTALL
30 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY27_INSTALL 30 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY27_INSTALL
31 set ERRORLEVEL=0 31 set ERRORLEVEL=0
32 goto :GIT_CHECK 32 goto :GIT_CHECK
33 33
34 34
35 :PY27_INSTALL 35 :PY27_INSTALL
36 echo Installing python 2.7.6... 36 echo Installing python 2.7.6...
M-A Ruel 2014/12/20 01:35:22 It'd be good to rip old installs, users are confus
37 :: Cleanup python directory if it was existing. 37 :: Cleanup python directory if it was existing.
38 if exist "%WIN_TOOLS_ROOT_DIR%\python276_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\p ython276_bin" 38 if exist "%WIN_TOOLS_ROOT_DIR%\python276_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\p ython276_bin"
39 if exist "%ZIP_DIR%\python276.zip" del "%ZIP_DIR%\python276.zip" 39 if exist "%ZIP_DIR%\python276.zip" del "%ZIP_DIR%\python276.zip"
40 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python276_bin.zip 40 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python276_bin.zip
41 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /python276_bin.zip "%ZIP_DIR%\python276_bin.zip" 41 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /python276_bin.zip "%ZIP_DIR%\python276_bin.zip"
42 if errorlevel 1 goto :PYTHON_FAIL 42 if errorlevel 1 goto :PYTHON_FAIL
43 :: Will create python276_bin\... 43 :: Will create python276_bin\...
44 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\python276_bin.zip" "%WIN _TOOLS_ROOT_DIR%" 44 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\python276_bin.zip" "%WIN _TOOLS_ROOT_DIR%"
45 :: Create the batch files. 45 :: Create the batch files.
46 call copy /y "%~dp0python276.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul 46 call copy /y "%~dp0python276.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul
47 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul 47 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul
48 del "%ZIP_DIR%\python276_bin.zip" 48 del "%ZIP_DIR%\python276_bin.zip"
49 set ERRORLEVEL=0 49 set ERRORLEVEL=0
50 goto :GIT_CHECK 50 goto :GIT_CHECK
51 51
52 52
53 :PYTHON_FAIL 53 :PYTHON_FAIL
54 echo ... Failed to checkout python automatically. 54 echo ... Failed to checkout python automatically.
55 echo Please visit http://python.org to download the latest python 2.7.x client b efore 55 echo You should get the "prebaked" version at %WIN_TOOLS_ROOT_URL%/third_party/
56 echo continuing.
57 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third _party/
58 set ERRORLEVEL=1 56 set ERRORLEVEL=1
59 goto :END 57 goto :END
60 58
61
62 :GIT_CHECK 59 :GIT_CHECK
63 goto :GIT_190_CHECK 60 if "%DEPOT_TOOLS_GIT_BLEEDING%" == "1" (
64 61 set GIT_VERSION=1.9.5.chromium.5
friedman1 2014/12/20 01:14:45 Don't we want to use >=1.9.5 for everything?
65 62 ) else (
66 :GIT_190_CHECK 63 set GIT_VERSION=1.9.0.chromium.6
67 set GIT_ERASE_TOP=5
68 set GIT_VERSION=1.9.0.chromium.6
69
70 if not "%DEPOT_TOOLS_GIT_BLEEDING%" == "1" goto :GIT_190_CHECK_REST
71 set GIT_ERASE_TOP=5
72 set GIT_VERSION=1.9.0.chromium.6
73
74 :GIT_190_CHECK_REST
75 if "%DEPOT_TOOLS_GIT_190%" == "0" goto :GIT_1852_CHECK
76 :: Clean up a couple of known broken releases
77 for /l %%i in (1,1,%GIT_ERASE_TOP%) do if exist "%WIN_TOOLS_ROOT_DIR%\git-1.9.0. chromium.%%i_bin" (
78 rmdir /s /q "%WIN_TOOLS_ROOT_DIR%\git-1.9.0.chromium.%%i_bin"
79 ) 64 )
80 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i 65 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i
81 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j) 66 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j)
82 if %VERMAJOR% lss 5 set GIT_VERSION=%GIT_VERSION%-xp 67 if %VERMAJOR% lss 5 set GIT_VERSION=%GIT_VERSION%-xp
83 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 set GIT_VERSION=%GIT_VERSION%-xp 68 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 set GIT_VERSION=%GIT_VERSION%-xp
69
70 :: Clean up any release which doesn't match the one we want.
71 for /d %%i in (%WIN_TOOLS_ROOT_DIR%\git-*_bin) do (
72 if not %%i==%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin (
73 rmdir /s /q "%%i"
M-A Ruel 2014/12/20 01:35:22 Nobody uses rmdir, rd is the cool alias. :)
74 )
75 )
84 set GIT_BIN_DIR=git-%GIT_VERSION%_bin 76 set GIT_BIN_DIR=git-%GIT_VERSION%_bin
85 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip 77 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip
86 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE% 78 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE%
87 goto :GIT_COMMON
88 79
89
90 :GIT_1852_CHECK
iannucci 2014/12/20 01:14:13 I removed HEAD support for ancient versions. They'
91 if "%DEPOT_TOOLS_GIT_1852%" == "0" goto :GIT_180_CHECK
92 set GIT_VERSION=1.8.5.2.chromium.1
93 set GIT_BIN_DIR=git-%GIT_VERSION%_bin
94 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip
95 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE%
96 :: This git uses APIs that target WINVER 0x0502, so refuse to install it on
97 :: anything older.
98 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i
99 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j)
100 if %VERMAJOR% lss 5 goto :GIT_VER_UNSUPPORTED
101 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 goto :GIT_VER_UNSUPPORTED
102 goto :GIT_COMMON
103
104
105 :GIT_VER_UNSUPPORTED
106 echo Git %GIT_VERSION% cannot be installed on:
107 ver
108 goto :GIT_180_CHECK
109
110
111 :GIT_180_CHECK
112 set GIT_VERSION=1.8.0
113 set GIT_BIN_DIR=git-%GIT_VERSION%_bin
114 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip
115 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE%
116 goto :GIT_COMMON
117
118
119 :GIT_COMMON
120 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL 80 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL
121 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" ( 81 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" (
122 call "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" --version 2>nul 1>nul 82 call "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" --version 2>nul 1>nul
123 if errorlevel 1 goto :GIT_INSTALL 83 if errorlevel 1 goto :GIT_INSTALL
124 rem Several git versions can live side-by-side; check the top-level 84 :: Several git versions can live side-by-side; check the top-level
125 rem batch script to make sure it points to the desired version. 85 :: batch script to make sure it points to the desired version.
126 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul 86 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul
127 if errorlevel 1 goto :GIT_COPY_BATCH_FILES 87 if errorlevel 1 goto :GIT_COPY_BATCH_FILES
128 goto :SVN_CHECK 88 goto :SVN_CHECK
129 ) 89 )
130 goto :GIT_INSTALL 90 goto :GIT_INSTALL
131 91
132 92
133 :GIT_INSTALL 93 :GIT_INSTALL
134 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... 94 echo Installing git %GIT_VERSION% (avg 1-2 min download) ...
135 :: git is not accessible; check it out and create 'proxy' files. 95 :: git is not accessible; check it out and create 'proxy' files.
136 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" 96 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip"
137 echo Fetching from %GIT_ZIP_URL% 97 echo Fetching from %GIT_ZIP_URL%
138 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip " 98 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip "
139 if errorlevel 1 goto :GIT_FAIL 99 if errorlevel 1 goto :GIT_FAIL
140 :: Cleanup svn directory if it was existing. 100 :: Cleanup svn directory if it was existing.
141 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" 101 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%"
142 :: Will create %GIT_BIN_DIR%\... 102 :: Will create %GIT_BIN_DIR%\...
143 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" 103 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%"
144 if errorlevel 1 goto :GIT_FAIL 104 if errorlevel 1 goto :GIT_FAIL
145 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL 105 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL
146 del "%ZIP_DIR%\git.zip" 106 del "%ZIP_DIR%\git.zip"
147 :: Ensure autocrlf and filemode are set correctly.
148 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false
149 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false
iannucci 2014/12/20 01:14:13 moved this down a block. These were causing the "s
150 goto :GIT_COPY_BATCH_FILES 107 goto :GIT_COPY_BATCH_FILES
151 108
152 109
153 :GIT_COPY_BATCH_FILES 110 :GIT_COPY_BATCH_FILES
154 :: Create the batch files. 111 :: Create the batch files.
155 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul 112 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul
156 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul 113 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul
157 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul 114 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul
158 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul 115 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul
116
117 :: Ensure autocrlf and filemode are set correctly.
118 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false
119 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false
159 goto :SVN_CHECK 120 goto :SVN_CHECK
160 121
161 122
162 :GIT_FAIL 123 :GIT_FAIL
163 echo ... Failed to checkout git automatically. 124 echo ... Failed to checkout git automatically.
164 echo Please visit http://code.google.com/p/msysgit to download the latest git 125 echo You should get the "prebaked" version used at %GIT_ZIP_URL%
165 echo client before continuing.
166 echo You can also get the "prebaked" version used at %GIT_ZIP_URL%
167 set ERRORLEVEL=1 126 set ERRORLEVEL=1
168 goto :END 127 goto :END
169 128
170 129
171 :SVN_CHECK 130 :SVN_CHECK
172 :: If the batch file exists, skip the svn check. 131 :: If the batch file exists, skip the svn check.
173 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :END 132 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :END
174 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL 133 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL
175 call svn --version 2>nul 1>nul 134 call svn --version 2>nul 1>nul
176 if errorlevel 1 goto :SVN_INSTALL 135 if errorlevel 1 goto :SVN_INSTALL
(...skipping 16 matching lines...) Expand all
193 if not exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." goto :SVN_FAIL 152 if not exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." goto :SVN_FAIL
194 del "%ZIP_DIR%\svn.zip" 153 del "%ZIP_DIR%\svn.zip"
195 :: Create the batch file. 154 :: Create the batch file.
196 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul 155 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul
197 call copy /y "%~dp0svnversion.new.bat" "%WIN_TOOLS_ROOT_DIR%\svnversion.bat" 1>n ul 156 call copy /y "%~dp0svnversion.new.bat" "%WIN_TOOLS_ROOT_DIR%\svnversion.bat" 1>n ul
198 goto :END 157 goto :END
199 158
200 159
201 :SVN_FAIL 160 :SVN_FAIL
202 echo ... Failed to checkout svn automatically. 161 echo ... Failed to checkout svn automatically.
203 echo Please visit http://subversion.tigris.org to download the latest subversion client 162 echo You should get the "prebaked" version at %WIN_TOOLS_ROOT_URL%/third_party/
204 echo before continuing.
205 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third _party/
206 set ERRORLEVEL=1 163 set ERRORLEVEL=1
207 goto :END 164 goto :END
208 165
209 166
210 :returncode 167 :returncode
211 set WIN_TOOLS_ROOT_URL= 168 set WIN_TOOLS_ROOT_URL=
212 set WIN_TOOLS_ROOT_DIR= 169 set WIN_TOOLS_ROOT_DIR=
213 exit /b %ERRORLEVEL% 170 exit /b %ERRORLEVEL%
214 171
215 :END 172 :END
216 call :returncode %ERRORLEVEL% 173 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