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 42 matching lines...) Loading... | |
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 Please visit http://python.org to download the latest python 2.7.x client b efore |
56 echo continuing. | 56 echo continuing. |
57 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third _party/ | 57 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third _party/ |
58 set ERRORLEVEL=1 | 58 set ERRORLEVEL=1 |
59 goto :END | 59 goto :END |
60 | 60 |
61 | 61 |
62 :GIT_CHECK | 62 :GIT_CHECK |
63 if "%DEPOT_TOOLS_GIT_1852%" == "0" goto :GIT_1852_UNINSTALL | 63 goto :GIT_190_CHECK |
64 goto :GIT_1852_CHECK | 64 |
65 | |
66 :GIT_190_CHECK | |
67 if "%DEPOT_TOOLS_GIT_190%" == "0" goto :GIT_1852_CHECK | |
mmoss
2014/03/19 05:11:15
I don't remember, do win vars == "0" if they are u
szager1
2014/03/19 05:41:57
I tested this; it only evaluates true if the var i
mmoss
2014/03/19 14:17:11
OK, I guess I just misunderstood the intent. I tho
| |
68 set GIT_VERSION=1.9.0.chromium.1 | |
69 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
70 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | |
71 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE% | |
72 goto :GIT_COMMON | |
65 | 73 |
66 | 74 |
67 :GIT_1852_CHECK | 75 :GIT_1852_CHECK |
76 if "%DEPOT_TOOLS_GIT_1852%" == "0" goto :GIT_180_CHECK | |
68 set GIT_VERSION=1.8.5.2.chromium.1 | 77 set GIT_VERSION=1.8.5.2.chromium.1 |
78 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
79 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | |
80 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE% | |
69 :: This git uses APIs that target WINVER 0x0502, so refuse to install it on | 81 :: This git uses APIs that target WINVER 0x0502, so refuse to install it on |
70 :: anything older. | 82 :: anything older. |
71 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i | 83 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i |
72 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j) | 84 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j) |
73 if %VERMAJOR% lss 5 goto :GIT_VER_UNSUPPORTED | 85 if %VERMAJOR% lss 5 goto :GIT_VER_UNSUPPORTED |
74 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 goto :GIT_VER_UNSUPPORTED | 86 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 goto :GIT_VER_UNSUPPORTED |
75 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
76 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | |
77 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE% | |
78 goto :GIT_COMMON | 87 goto :GIT_COMMON |
79 | 88 |
80 | 89 |
81 :GIT_VER_UNSUPPORTED | 90 :GIT_VER_UNSUPPORTED |
82 echo Git %GIT_VERSION% cannot be installed on: | 91 echo Git %GIT_VERSION% cannot be installed on: |
83 ver | 92 ver |
84 goto :GIT_180_CHECK | 93 goto :GIT_180_CHECK |
85 | 94 |
86 | 95 |
87 :GIT_1852_UNINSTALL | |
88 :: If the new git was installed, remove all installed git packages to trigger | |
89 :: reinstallation of the old version. | |
90 if exist "%WIN_TOOLS_ROOT_DIR%\git-1.8.5.2.chromium.1_bin" ( | |
91 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\git-1.8.5.2.chromium.1_bin" | |
92 if exist "%WIN_TOOLS_ROOT_DIR%\git-1.8.0_bin" ( | |
93 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\git-1.8.0_bin" | |
94 ) | |
95 ) | |
96 goto :GIT_180_CHECK | |
97 | |
98 | |
99 :GIT_180_CHECK | 96 :GIT_180_CHECK |
100 set GIT_VERSION=1.8.0 | 97 set GIT_VERSION=1.8.0 |
101 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | 98 set GIT_BIN_DIR=git-%GIT_VERSION%_bin |
102 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | 99 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip |
103 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE% | 100 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE% |
104 goto :GIT_COMMON | 101 goto :GIT_COMMON |
105 | 102 |
106 | 103 |
107 :GIT_COMMON | 104 :GIT_COMMON |
108 :: If the batch file exists, skip the git check. | |
109 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK | |
110 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 105 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
111 call git --version 2>nul 1>nul | 106 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" ( |
112 if errorlevel 1 goto :GIT_INSTALL | 107 call "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" --version 2>nul 1>nul |
113 goto :SVN_CHECK | 108 if errorlevel 1 goto :GIT_INSTALL |
114 | 109 rem Several git versions can live side-by-side; check the top-level |
115 | 110 rem batch script to make sure it points to the desired version. |
116 :MSYS_PATH_CHECK | 111 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul |
117 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul | 112 if errorlevel 1 goto :GIT_COPY_BATCH_FILES |
118 if errorlevel 1 goto :SVN_CHECK | 113 goto :SVN_CHECK |
119 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" | 114 ) |
115 goto :GIT_INSTALL | |
120 | 116 |
121 | 117 |
122 :GIT_INSTALL | 118 :GIT_INSTALL |
123 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... | 119 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... |
124 :: git is not accessible; check it out and create 'proxy' files. | 120 :: git is not accessible; check it out and create 'proxy' files. |
125 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" | 121 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" |
126 echo Fetching from %GIT_ZIP_URL% | 122 echo Fetching from %GIT_ZIP_URL% |
127 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip " | 123 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip " |
128 if errorlevel 1 goto :GIT_FAIL | 124 if errorlevel 1 goto :GIT_FAIL |
129 :: Cleanup svn directory if it was existing. | 125 :: Cleanup svn directory if it was existing. |
130 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" | 126 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" |
131 :: Will create %GIT_BIN_DIR%\... | 127 :: Will create %GIT_BIN_DIR%\... |
132 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" | 128 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" |
133 if errorlevel 1 goto :GIT_FAIL | 129 if errorlevel 1 goto :GIT_FAIL |
134 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 130 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
135 del "%ZIP_DIR%\git.zip" | 131 del "%ZIP_DIR%\git.zip" |
132 :: Ensure autocrlf and filemode are set correctly. | |
133 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | |
mmoss
2014/03/19 05:11:15
Make these --system, to it modifies the config we
szager1
2014/03/19 05:41:57
Done.
| |
134 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | |
135 goto :GIT_COPY_BATCH_FILES | |
136 | |
137 | |
138 :GIT_COPY_BATCH_FILES | |
136 :: Create the batch files. | 139 :: Create the batch files. |
137 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul | 140 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul |
138 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul | 141 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul |
139 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul | 142 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul |
140 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul | 143 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul |
141 :: Ensure autocrlf and filemode are set correctly. | |
142 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | |
143 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | |
144 goto :SVN_CHECK | 144 goto :SVN_CHECK |
145 | 145 |
146 | 146 |
147 :GIT_FAIL | 147 :GIT_FAIL |
148 echo ... Failed to checkout git automatically. | 148 echo ... Failed to checkout git automatically. |
149 echo Please visit http://code.google.com/p/msysgit to download the latest git | 149 echo Please visit http://code.google.com/p/msysgit to download the latest git |
150 echo client before continuing. | 150 echo client before continuing. |
151 echo You can also get the "prebaked" version used at %GIT_ZIP_URL% | 151 echo You can also get the "prebaked" version used at %GIT_ZIP_URL% |
152 set ERRORLEVEL=1 | 152 set ERRORLEVEL=1 |
153 goto :END | 153 goto :END |
(...skipping 38 matching lines...) Loading... | |
192 goto :END | 192 goto :END |
193 | 193 |
194 | 194 |
195 :returncode | 195 :returncode |
196 set WIN_TOOLS_ROOT_URL= | 196 set WIN_TOOLS_ROOT_URL= |
197 set WIN_TOOLS_ROOT_DIR= | 197 set WIN_TOOLS_ROOT_DIR= |
198 exit /b %ERRORLEVEL% | 198 exit /b %ERRORLEVEL% |
199 | 199 |
200 :END | 200 :END |
201 call :returncode %ERRORLEVEL% | 201 call :returncode %ERRORLEVEL% |
OLD | NEW |