OLD | NEW |
---|---|
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 You should get the "prebaked" version at %WIN_TOOLS_ROOT_URL%/third_party/ | 55 echo You should get the "prebaked" version at %WIN_TOOLS_ROOT_URL%/third_party/ |
56 set ERRORLEVEL=1 | 56 set ERRORLEVEL=1 |
57 goto :END | 57 goto :END |
58 | 58 |
59 :GIT_CHECK | 59 :GIT_CHECK |
60 | 60 |
61 :: See if we're on XP | |
62 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i | |
63 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j) | |
64 if %VERMAJOR% lss 5 set GIT_VERSION=%GIT_VERSION%-xp | |
65 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 set XP_SUFFIX=-xp | |
66 | |
67 :: must explicitly use FIND_EXE to prevent this from grabbing e.g. gnuwin32 or | 61 :: must explicitly use FIND_EXE to prevent this from grabbing e.g. gnuwin32 or |
68 :: msys versions. | 62 :: msys versions. |
69 set FIND_EXE=%SYSTEMROOT%\System32\find.exe | 63 set FIND_EXE=%SYSTEMROOT%\System32\find.exe |
70 | 64 |
71 :: Check to see if we're on a 32 or 64 bit system | 65 :: Check to see if we're on a 32 or 64 bit system |
72 :: (parens) are necessary, otherwise batch puts an extra space after 32. | 66 :: (parens) are necessary, otherwise batch puts an extra space after 32. |
73 reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | %FIND_EXE% /i "x86" > NUL && (set OS_BITS=32) || (set OS_BITS=64) | 67 reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | %FIND_EXE% /i "x86" > NUL && (set OS_BITS=32) || (set OS_BITS=64) |
74 | 68 |
75 if not exist "%WIN_TOOLS_ROOT_DIR%\.git_bleeding_edge" goto :GIT_OLD_FLOW | 69 if not exist "%WIN_TOOLS_ROOT_DIR%\.git_bleeding_edge" ( |
76 set GIT_PORTABLE_FLOW=1 | 70 set GIT_VERSION=2.7.4 |
77 set GIT_VERSION=2.7.4-%OS_BITS% | 71 ) else ( |
72 set GIT_VERSION=2.7.4 | |
iannucci
2016/03/31 01:26:18
FWIW, I just tried this with 2.8.0 and it totally
| |
73 ) | |
74 set GIT_VERSION=%GIT_VERSION%-%OS_BITS% | |
75 | |
78 set GIT_FETCH_URL=https://commondatastorage.googleapis.com/chrome-infra/Portable Git-%GIT_VERSION%-bit.7z.exe | 76 set GIT_FETCH_URL=https://commondatastorage.googleapis.com/chrome-infra/Portable Git-%GIT_VERSION%-bit.7z.exe |
79 set GIT_DOWNLOAD_PATH=%ZIP_DIR%\git.7z.exe | 77 set GIT_DOWNLOAD_PATH=%ZIP_DIR%\git.7z.exe |
80 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | 78 set GIT_BIN_DIR=git-%GIT_VERSION%_bin |
81 set GIT_INST_DIR=%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR% | 79 set GIT_INST_DIR=%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR% |
82 set GIT_EXE_PATH=%GIT_INST_DIR%\bin\git.exe | 80 set GIT_EXE_PATH=%GIT_INST_DIR%\bin\git.exe |
83 goto :GIT_CLEANUP | |
84 | 81 |
85 :GIT_OLD_FLOW | |
86 set GIT_VERSION=1.9.5.chromium.6%XP_SUFFIX% | |
87 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
88 set GIT_FETCH_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_BIN _DIR%.zip | |
89 set GIT_DOWNLOAD_PATH=%ZIP_DIR%\git.zip | |
90 set GIT_INST_DIR=%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR% | |
91 set GIT_EXE_PATH=%GIT_INST_DIR%\cmd\git.cmd | |
92 | |
93 :GIT_CLEANUP | |
94 :: Clean up any release which doesn't match the one we want. | 82 :: Clean up any release which doesn't match the one we want. |
95 for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( | 83 for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( |
96 if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( | 84 if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( |
97 echo Cleaning old git installation %%i | 85 echo Cleaning old git installation %%i |
98 rmdir /s /q "%%i" | 86 rmdir /s /q "%%i" |
99 ) | 87 ) |
100 ) | 88 ) |
101 | 89 |
102 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 90 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
103 | 91 |
104 if exist "%GIT_EXE_PATH%" ( | 92 if exist "%GIT_EXE_PATH%" ( |
105 call "%GIT_EXE_PATH%" --version 2>nul 1>nul | 93 call "%GIT_EXE_PATH%" --version 2>nul 1>nul |
106 if errorlevel 1 goto :GIT_INSTALL | 94 if errorlevel 1 goto :GIT_INSTALL |
107 rem Several git versions can live side-by-side; check the top-level | 95 rem Several git versions can live side-by-side; check the top-level |
108 rem batch script to make sure it points to the desired version. | 96 rem batch script to make sure it points to the desired version. |
109 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul | 97 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul |
110 if errorlevel 1 goto :GIT_MAKE_BATCH_FILES | 98 if errorlevel 1 goto :GIT_MAKE_BATCH_FILES |
111 goto :SYNC_GIT_HELP_FILES | 99 goto :SYNC_GIT_HELP_FILES |
112 ) | 100 ) |
113 goto :GIT_INSTALL | |
114 | 101 |
115 :GIT_INSTALL | 102 :GIT_INSTALL |
116 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... | 103 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... |
117 echo Detected: %OS_BITS% bits | |
118 if defined XP_SUFFIX echo ... Windows XP | |
119 if defined GIT_PORTABLE_FLOW echo ... Portable installation flow | |
120 | 104 |
121 :: git is not accessible; check it out and create 'proxy' files. | |
122 if exist "%GIT_DOWNLOAD_PATH%" del "%GIT_DOWNLOAD_PATH%" | 105 if exist "%GIT_DOWNLOAD_PATH%" del "%GIT_DOWNLOAD_PATH%" |
123 echo Fetching from %GIT_FETCH_URL% | 106 echo Fetching from %GIT_FETCH_URL% |
124 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_FETCH_URL% "%GIT_DOWNLOAD_P ATH%" | 107 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_FETCH_URL% "%GIT_DOWNLOAD_P ATH%" |
125 if errorlevel 1 goto :GIT_FAIL | 108 if errorlevel 1 goto :GIT_FAIL |
126 :: Cleanup git directory if it already exists. | 109 :: Cleanup git directory if it already exists. |
127 if exist "%GIT_INST_DIR%\." rd /q /s "%GIT_INST_DIR%" | 110 if exist "%GIT_INST_DIR%\." rd /q /s "%GIT_INST_DIR%" |
128 | 111 |
129 if defined GIT_PORTABLE_FLOW ( | 112 :: run PortableGit self-extractor |
130 rem run PortableGit self-extractor | 113 :: -y : Be Quiet ("yes") |
131 rem -y : Be Quiet ("yes") | 114 :: -sd1 : Self delete SFX archive |
132 rem -sd1 : Self delete SFX archive | 115 :: -InstallPath : Where to put the files |
133 rem -InstallPath : Where to put the files | 116 :: -Directory : Run the post-extract program with this current-working-directory |
134 rem -Directory : Run the post-extract program with this current-working-direct ory | 117 call "%GIT_DOWNLOAD_PATH%" -y -sd1 -InstallPath="%GIT_INST_DIR%" -Directory="%GI T_INST_DIR%" |
135 call "%GIT_DOWNLOAD_PATH%" -y -sd1 -InstallPath="%GIT_INST_DIR%" -Directory="% GIT_INST_DIR%" | 118 if errorlevel 1 goto :GIT_FAIL |
136 ) else ( | |
137 rem Will create %GIT_INST_DIR%\... | |
138 cscript //nologo //e:jscript "%~dp0unzip.js" "%GIT_DOWNLOAD_PATH%" "%WIN_TOOLS _ROOT_DIR%" | |
139 ) | |
140 | 119 |
141 if errorlevel 1 goto :GIT_FAIL | |
142 del "%GIT_DOWNLOAD_PATH%" | 120 del "%GIT_DOWNLOAD_PATH%" |
143 if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL | 121 if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL |
144 | 122 |
145 :GIT_MAKE_BATCH_FILES | 123 :GIT_MAKE_BATCH_FILES |
146 :: Create the batch files. | 124 :: Create the batch files. |
147 set GIT_TEMPL=%~dp0git.template.bat | 125 set GIT_TEMPL=%~dp0git.template.bat |
148 set SED=%GIT_INST_DIR%\usr\bin\sed.exe | 126 set SED=%GIT_INST_DIR%\usr\bin\sed.exe |
149 if defined GIT_PORTABLE_FLOW ( | 127 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\git.exe/ " < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\git.bat" |
150 rem turns out we just installed sed :) | 128 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\gitk.exe /" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\gitk.bat" |
151 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\git.ex e/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\git.bat" | 129 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\\s sh.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh.bat" |
152 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\gitk.e xe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\gitk.bat" | 130 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\\s sh-keygen.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" |
153 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\ \ssh.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh.bat" | |
154 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\ \ssh-keygen.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" | |
155 ) else ( | |
156 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR %\git.bat" 1>nul | |
157 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DI R%\gitk.bat" 1>nul | |
158 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR %\ssh.bat" 1>nul | |
159 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_R OOT_DIR%\ssh-keygen.bat" 1>nul | |
160 ) | |
161 | 131 |
162 :: Ensure autocrlf and filemode are set correctly. | 132 :: Ensure various git configurations are set correctly at they system level. |
163 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false | 133 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false |
164 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false | 134 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false |
165 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.preloadindex true | 135 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.preloadindex true |
166 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true | 136 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true |
167 | 137 |
168 :SYNC_GIT_HELP_FILES | 138 :SYNC_GIT_HELP_FILES |
169 :: Copy all the depot_tools docs into the mingw64 git docs root. | 139 :: Copy all the depot_tools docs into the mingw64 git docs root. |
170 :: /i : Make sure xcopy knows that the destination names a folder, not a file | 140 :: /i : Make sure xcopy knows that the destination names a folder, not a file |
171 :: /q : Make xcopy quiet (though it still prints a `X File(s) copied` message | 141 :: /q : Make xcopy quiet (though it still prints a `X File(s) copied` message |
172 :: which is why we have the > NUL) | 142 :: which is why we have the > NUL) |
173 :: /d : Copy source files that are newer than the corresponding destination | 143 :: /d : Copy source files that are newer than the corresponding destination |
174 :: files only. This prevents excessive copying when none of the docs | 144 :: files only. This prevents excessive copying when none of the docs |
175 :: actually changed. | 145 :: actually changed. |
176 :: /y : Don't prompt for overwrites (yes) | 146 :: /y : Don't prompt for overwrites (yes) |
177 if defined GIT_PORTABLE_FLOW ( | 147 xcopy /i /q /d /y "%WIN_TOOLS_ROOT_DIR%\man\html\*" "%GIT_INST_DIR%\mingw64\shar e\doc\git-doc" > NUL |
178 xcopy /i /q /d /y "%WIN_TOOLS_ROOT_DIR%\man\html\*" "%GIT_INST_DIR%\mingw64\sh are\doc\git-doc" > NUL | 148 |
179 ) | |
180 goto :SVN_CHECK | 149 goto :SVN_CHECK |
181 | 150 |
182 :GIT_FAIL | 151 :GIT_FAIL |
183 echo ... Failed to checkout git automatically. | 152 echo ... Failed to checkout git automatically. |
184 echo You should get the "prebaked" version used at %GIT_FETCH_URL% | 153 echo You should get the "prebaked" version used at %GIT_FETCH_URL% |
185 set ERRORLEVEL=1 | 154 set ERRORLEVEL=1 |
186 goto :END | 155 goto :END |
187 | 156 |
188 | 157 |
189 :SVN_CHECK | 158 :SVN_CHECK |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 goto :END | 192 goto :END |
224 | 193 |
225 | 194 |
226 :returncode | 195 :returncode |
227 set WIN_TOOLS_ROOT_URL= | 196 set WIN_TOOLS_ROOT_URL= |
228 set WIN_TOOLS_ROOT_DIR= | 197 set WIN_TOOLS_ROOT_DIR= |
229 exit /b %ERRORLEVEL% | 198 exit /b %ERRORLEVEL% |
230 | 199 |
231 :END | 200 :END |
232 call :returncode %ERRORLEVEL% | 201 call :returncode %ERRORLEVEL% |
OLD | NEW |