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. |
11 | 11 |
12 set WIN_TOOLS_ROOT_URL=http://src.chromium.org/svn/trunk/tools | 12 set WIN_TOOLS_ROOT_URL=http://src.chromium.org/svn/trunk/tools |
13 set GIT_BIN_DIR=git-1.8.0_bin | 13 set GIT_BIN_DIR=git-1.8.0_bin |
14 | 14 |
15 :: Get absolute root directory (.js scripts don't handle relative paths well). | 15 :: Get absolute root directory (.js scripts don't handle relative paths well). |
16 pushd %~dp0..\.. | 16 pushd %~dp0..\.. |
17 set WIN_TOOLS_ROOT_DIR=%CD% | 17 set WIN_TOOLS_ROOT_DIR=%CD% |
18 popd | 18 popd |
19 | 19 |
20 if "%1" == "force" ( | 20 if "%1" == "force" ( |
21 set WIN_TOOLS_FORCE=1 | 21 set WIN_TOOLS_FORCE=1 |
22 shift /1 | 22 shift /1 |
23 ) | 23 ) |
24 | 24 |
25 | 25 |
26 :GIT_CHECK | 26 :GIT_CHECK |
27 :: If the batch file exists, skip the git check. | 27 :: If the batch file exists, skip the git check. |
28 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_TERM_CHECK | 28 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK |
29 if "%CHROME_HEADLESS%" == "1" goto :MSYS_TERM_CHECK | 29 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK |
30 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 30 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
31 call git --version 2>nul 1>nul | 31 call git --version 2>nul 1>nul |
32 if errorlevel 1 goto :GIT_INSTALL | 32 if errorlevel 1 goto :GIT_INSTALL |
33 goto :MSYS_TERM_CHECK | 33 goto :SVN_CHECK |
34 | |
35 | |
36 :MSYS_PATH_CHECK | |
37 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul | |
38 if errorlevel 1 ( | |
39 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" | |
40 goto :GIT_INSTALL | |
cmp
2012/11/08 23:04:49
I think now (or RSN) would be a good time to stand
| |
41 ) | |
42 goto :SVN_CHECK | |
34 | 43 |
35 | 44 |
36 :GIT_INSTALL | 45 :GIT_INSTALL |
37 echo Installing git (avg 1-2 min download) ... | 46 echo Installing git (avg 1-2 min download) ... |
38 :: git is not accessible; check it out and create 'proxy' files. | 47 :: git is not accessible; check it out and create 'proxy' files. |
39 if exist "%~dp0git.zip" del "%~dp0git.zip" | 48 if exist "%~dp0git.zip" del "%~dp0git.zip" |
40 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /git-1.8.0_bin.zip "%~dp0git.zip" | 49 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /git-1.8.0_bin.zip "%~dp0git.zip" |
41 if errorlevel 1 goto :GIT_FAIL | 50 if errorlevel 1 goto :GIT_FAIL |
42 :: Cleanup svn directory if it was existing. | 51 :: Cleanup svn directory if it was existing. |
43 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" | 52 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" |
44 :: Will create %GIT_BIN_DIR%\... | 53 :: Will create %GIT_BIN_DIR%\... |
45 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR %" | 54 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR %" |
46 if errorlevel 1 goto :GIT_FAIL | 55 if errorlevel 1 goto :GIT_FAIL |
47 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 56 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
48 del "%~dp0git.zip" | 57 del "%~dp0git.zip" |
49 :: Create the batch files. | 58 :: Create the batch files. |
50 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul | 59 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul |
51 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul | 60 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul |
52 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul | 61 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul |
53 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul | 62 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul |
54 :: Ensure autocrlf and filemode are set correctly. | 63 :: Ensure autocrlf and filemode are set correctly. |
55 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | 64 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false |
56 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | 65 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false |
57 goto :MSYS_TERM_CHECK | 66 goto :SVN_CHECK |
58 | 67 |
59 | 68 |
60 :GIT_FAIL | 69 :GIT_FAIL |
61 echo ... Failed to checkout git automatically. | 70 echo ... Failed to checkout git automatically. |
62 echo Please visit http://code.google.com/p/msysgit to download the latest git | 71 echo Please visit http://code.google.com/p/msysgit to download the latest git |
63 echo client before continuing. | 72 echo client before continuing. |
64 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ | 73 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ |
65 set ERRORLEVEL=1 | 74 set ERRORLEVEL=1 |
66 goto :END | 75 goto :END |
67 | 76 |
68 | 77 |
69 :MSYS_TERM_CHECK | |
70 :: Tweak git.bat to set TERM appropriately | |
71 call FIND "TERM" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul | |
72 IF errorlevel 1 ( | |
73 FINDSTR /V "git\.cmd" "%WIN_TOOLS_ROOT_DIR%\git.bat" > git.bat.new | |
74 echo set TERM=msys >> git.bat.new | |
75 FINDSTR "git\.cmd" "%WIN_TOOLS_ROOT_DIR%\git.bat" >> git.bat.new | |
76 MOVE /Y git.bat.new "%WIN_TOOLS_ROOT_DIR%\git.bat" >nul | |
77 ) | |
78 | |
79 | |
80 :SVN_CHECK | 78 :SVN_CHECK |
81 :: If the batch file exists, skip the svn check. | 79 :: If the batch file exists, skip the svn check. |
82 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 80 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
83 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 81 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
84 call svn --version 2>nul 1>nul | 82 call svn --version 2>nul 1>nul |
85 if errorlevel 1 goto :SVN_INSTALL | 83 if errorlevel 1 goto :SVN_INSTALL |
86 goto :PYTHON_CHECK | 84 goto :PYTHON_CHECK |
87 | 85 |
88 | 86 |
89 :SVN_INSTALL | 87 :SVN_INSTALL |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 goto :END | 148 goto :END |
151 | 149 |
152 | 150 |
153 :returncode | 151 :returncode |
154 set WIN_TOOLS_ROOT_URL= | 152 set WIN_TOOLS_ROOT_URL= |
155 set WIN_TOOLS_ROOT_DIR= | 153 set WIN_TOOLS_ROOT_DIR= |
156 exit /b %ERRORLEVEL% | 154 exit /b %ERRORLEVEL% |
157 | 155 |
158 :END | 156 :END |
159 call :returncode %ERRORLEVEL% | 157 call :returncode %ERRORLEVEL% |
OLD | NEW |