Chromium Code Reviews| 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=https://src.chromium.org/svn/trunk/tools | 12 set WIN_TOOLS_ROOT_URL=https://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 :: It used to be %~dp0 but ADODB.Stream may fail to write to this directory if | |
| 15 :: the directory DACL is set to elevated integrity level. | |
| 16 set ZIP_DIR=%TEMP% | |
|
M-A Ruel
2013/11/14 16:06:03
It's generally better to put temporary stuff in TE
| |
| 14 | 17 |
| 15 :: Get absolute root directory (.js scripts don't handle relative paths well). | 18 :: Get absolute root directory (.js scripts don't handle relative paths well). |
| 16 pushd %~dp0..\.. | 19 pushd %~dp0..\.. |
| 17 set WIN_TOOLS_ROOT_DIR=%CD% | 20 set WIN_TOOLS_ROOT_DIR=%CD% |
| 18 popd | 21 popd |
| 19 | 22 |
| 20 if "%1" == "force" ( | 23 if "%1" == "force" ( |
| 21 set WIN_TOOLS_FORCE=1 | 24 set WIN_TOOLS_FORCE=1 |
| 22 shift /1 | 25 shift /1 |
| 23 ) | 26 ) |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 35 | 38 |
| 36 :MSYS_PATH_CHECK | 39 :MSYS_PATH_CHECK |
| 37 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul | 40 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul |
| 38 if errorlevel 1 goto :SVN_CHECK | 41 if errorlevel 1 goto :SVN_CHECK |
| 39 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" | 42 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" |
| 40 | 43 |
| 41 | 44 |
| 42 :GIT_INSTALL | 45 :GIT_INSTALL |
| 43 echo Installing git (avg 1-2 min download) ... | 46 echo Installing git (avg 1-2 min download) ... |
| 44 :: git is not accessible; check it out and create 'proxy' files. | 47 :: git is not accessible; check it out and create 'proxy' files. |
| 45 if exist "%~dp0git.zip" del "%~dp0git.zip" | 48 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" |
| 46 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/git-1.8.0_bin.zip | 49 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/git-1.8.0_bin.zip |
| 47 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /git-1.8.0_bin.zip "%~dp0git.zip" | 50 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /git-1.8.0_bin.zip "%ZIP_DIR%\git.zip" |
| 48 if errorlevel 1 goto :GIT_FAIL | 51 if errorlevel 1 goto :GIT_FAIL |
| 49 :: Cleanup svn directory if it was existing. | 52 :: Cleanup svn directory if it was existing. |
| 50 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" | 53 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" |
| 51 :: Will create %GIT_BIN_DIR%\... | 54 :: Will create %GIT_BIN_DIR%\... |
| 52 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0git.zip" "%WIN_TOOLS_ROOT_DIR %" | 55 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" |
| 53 if errorlevel 1 goto :GIT_FAIL | 56 if errorlevel 1 goto :GIT_FAIL |
| 54 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 57 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
| 55 del "%~dp0git.zip" | 58 del "%ZIP_DIR%\git.zip" |
| 56 :: Create the batch files. | 59 :: Create the batch files. |
| 57 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul | 60 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul |
| 58 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul | 61 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul |
| 59 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul | 62 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul |
| 60 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul | 63 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul |
| 61 :: Ensure autocrlf and filemode are set correctly. | 64 :: Ensure autocrlf and filemode are set correctly. |
| 62 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | 65 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false |
| 63 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | 66 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false |
| 64 goto :SVN_CHECK | 67 goto :SVN_CHECK |
| 65 | 68 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 78 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 81 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
| 79 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 82 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
| 80 call svn --version 2>nul 1>nul | 83 call svn --version 2>nul 1>nul |
| 81 if errorlevel 1 goto :SVN_INSTALL | 84 if errorlevel 1 goto :SVN_INSTALL |
| 82 goto :PYTHON_CHECK | 85 goto :PYTHON_CHECK |
| 83 | 86 |
| 84 | 87 |
| 85 :SVN_INSTALL | 88 :SVN_INSTALL |
| 86 echo Installing subversion ... | 89 echo Installing subversion ... |
| 87 :: svn is not accessible; check it out and create 'proxy' files. | 90 :: svn is not accessible; check it out and create 'proxy' files. |
| 88 if exist "%~dp0svn.zip" del "%~dp0svn.zip" | 91 if exist "%ZIP_DIR%\svn.zip" del "%ZIP_DIR%\svn.zip" |
| 89 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/svn_bin.zip | 92 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/svn_bin.zip |
| 90 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /svn_bin.zip "%~dp0svn.zip" | 93 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /svn_bin.zip "%ZIP_DIR%\svn.zip" |
| 91 if errorlevel 1 goto :SVN_FAIL | 94 if errorlevel 1 goto :SVN_FAIL |
| 92 :: Cleanup svn directory if it was existing. | 95 :: Cleanup svn directory if it was existing. |
| 93 if exist "%WIN_TOOLS_ROOT_DIR%\svn\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn" | 96 if exist "%WIN_TOOLS_ROOT_DIR%\svn\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn" |
| 94 if exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn_bin " | 97 if exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn_bin " |
| 95 :: Will create svn_bin\... | 98 :: Will create svn_bin\... |
| 96 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0svn.zip" "%WIN_TOOLS_ROOT_DIR %" | 99 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\svn.zip" "%WIN_TOOLS_ROO T_DIR%" |
| 97 if errorlevel 1 goto :SVN_FAIL | 100 if errorlevel 1 goto :SVN_FAIL |
| 98 if not exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." goto :SVN_FAIL | 101 if not exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." goto :SVN_FAIL |
| 99 del "%~dp0svn.zip" | 102 del "%ZIP_DIR%\svn.zip" |
| 100 :: Create the batch file. | 103 :: Create the batch file. |
| 101 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul | 104 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul |
| 102 call copy /y "%~dp0svnversion.new.bat" "%WIN_TOOLS_ROOT_DIR%\svnversion.bat" 1>n ul | 105 call copy /y "%~dp0svnversion.new.bat" "%WIN_TOOLS_ROOT_DIR%\svnversion.bat" 1>n ul |
| 103 goto :PYTHON_CHECK | 106 goto :PYTHON_CHECK |
| 104 | 107 |
| 105 | 108 |
| 106 :SVN_FAIL | 109 :SVN_FAIL |
| 107 echo ... Failed to checkout svn automatically. | 110 echo ... Failed to checkout svn automatically. |
| 108 echo Please visit http://subversion.tigris.org to download the latest subversion client | 111 echo Please visit http://subversion.tigris.org to download the latest subversion client |
| 109 echo before continuing. | 112 echo before continuing. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 128 if not exist "%WIN_TOOLS_ROOT_DIR%\python275_bin" goto :PY275_INSTALL | 131 if not exist "%WIN_TOOLS_ROOT_DIR%\python275_bin" goto :PY275_INSTALL |
| 129 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY275_INSTALL | 132 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY275_INSTALL |
| 130 set ERRORLEVEL=0 | 133 set ERRORLEVEL=0 |
| 131 goto :END | 134 goto :END |
| 132 | 135 |
| 133 | 136 |
| 134 :PY275_INSTALL | 137 :PY275_INSTALL |
| 135 echo Installing python 2.7.5... | 138 echo Installing python 2.7.5... |
| 136 :: Cleanup python directory if it was existing. | 139 :: Cleanup python directory if it was existing. |
| 137 if exist "%WIN_TOOLS_ROOT_DIR%\python275_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\p ython275_bin" | 140 if exist "%WIN_TOOLS_ROOT_DIR%\python275_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\p ython275_bin" |
| 138 if exist "%~dp0python275.zip" del "%~dp0python275.zip" | 141 if exist "%ZIP_DIR%\python275.zip" del "%ZIP_DIR%\python275.zip" |
| 139 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python275_bin.zip | 142 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python275_bin.zip |
| 140 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /python275_bin.zip "%~dp0python275_bin.zip" | 143 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /python275_bin.zip "%ZIP_DIR%\python275_bin.zip" |
| 141 if errorlevel 1 goto :PYTHON_FAIL | 144 if errorlevel 1 goto :PYTHON_FAIL |
| 142 :: Will create python275_bin\... | 145 :: Will create python275_bin\... |
| 143 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0python275_bin.zip" "%WIN_TOOL S_ROOT_DIR%" | 146 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\python275_bin.zip" "%WIN _TOOLS_ROOT_DIR%" |
| 144 :: Create the batch files. | 147 :: Create the batch files. |
| 145 call copy /y "%~dp0python275.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul | 148 call copy /y "%~dp0python275.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul |
| 146 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul | 149 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul |
| 150 del "%ZIP_DIR%\python275_bin.zip" | |
|
M-A Ruel
2013/11/14 16:06:03
This file was being leaked, fixing this issue whil
| |
| 147 set ERRORLEVEL=0 | 151 set ERRORLEVEL=0 |
| 148 goto :END | 152 goto :END |
| 149 | 153 |
| 150 | 154 |
| 151 :PY26_INSTALL | 155 :PY26_INSTALL |
| 152 echo Installing python 2.6... | 156 echo Installing python 2.6... |
| 153 :: Cleanup python directory if it was existing. | 157 :: Cleanup python directory if it was existing. |
| 154 if exist "%WIN_TOOLS_ROOT_DIR%\python_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\pyth on_bin" | 158 if exist "%WIN_TOOLS_ROOT_DIR%\python_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\pyth on_bin" |
| 155 call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python_26 "%WIN_TOOLS_ROOT_DIR%\ python_bin" | 159 call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python_26 "%WIN_TOOLS_ROOT_DIR%\ python_bin" |
| 156 if errorlevel 1 goto :PYTHON_FAIL | 160 if errorlevel 1 goto :PYTHON_FAIL |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 170 goto :END | 174 goto :END |
| 171 | 175 |
| 172 | 176 |
| 173 :returncode | 177 :returncode |
| 174 set WIN_TOOLS_ROOT_URL= | 178 set WIN_TOOLS_ROOT_URL= |
| 175 set WIN_TOOLS_ROOT_DIR= | 179 set WIN_TOOLS_ROOT_DIR= |
| 176 exit /b %ERRORLEVEL% | 180 exit /b %ERRORLEVEL% |
| 177 | 181 |
| 178 :END | 182 :END |
| 179 call :returncode %ERRORLEVEL% | 183 call :returncode %ERRORLEVEL% |
| OLD | NEW |