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 | |
| 14 :: It used to be %~dp0 but ADODB.Stream may fail to write to this directory if | 13 :: 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. | 14 :: the directory DACL is set to elevated integrity level. |
| 16 set ZIP_DIR=%TEMP% | 15 set ZIP_DIR=%TEMP% |
| 17 | 16 |
| 18 :: Get absolute root directory (.js scripts don't handle relative paths well). | 17 :: Get absolute root directory (.js scripts don't handle relative paths well). |
| 19 pushd %~dp0..\.. | 18 pushd %~dp0..\.. |
| 20 set WIN_TOOLS_ROOT_DIR=%CD% | 19 set WIN_TOOLS_ROOT_DIR=%CD% |
| 21 popd | 20 popd |
| 22 | 21 |
| 23 if "%1" == "force" ( | 22 if "%1" == "force" ( |
| 24 set WIN_TOOLS_FORCE=1 | 23 set WIN_TOOLS_FORCE=1 |
| 25 shift /1 | 24 shift /1 |
| 26 ) | 25 ) |
| 27 | 26 |
| 28 | 27 |
| 29 :GIT_CHECK | 28 :GIT_CHECK |
| 29 if "%DEPOT_TOOLS_GIT_1852%" == "1" goto :GIT_1852_CHECK | |
| 30 goto :GIT_180_CHECK | |
| 31 | |
| 32 | |
| 33 :GIT_1852_CHECK | |
| 34 set GIT_VERSION=1.8.5.2.chromium.1 | |
| 35 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
| 36 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | |
| 37 :: TODO(mmoss): submit the zip to the old location? | |
|
iannucci
2014/02/07 04:35:27
nope, GCS is the way of the future.
| |
| 38 :: set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE% | |
| 39 set GIT_ZIP_URL=http://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_FI LE% | |
| 40 goto :GIT_COMMON | |
| 41 | |
| 42 | |
| 43 :GIT_180_CHECK | |
| 44 set GIT_VERSION=1.8.0 | |
| 45 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
| 46 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | |
| 47 set GIT_ZIP_URL=%WIN_TOOLS_ROOT_URL%/third_party/%GIT_ZIP_FILE% | |
| 48 goto :GIT_COMMON | |
| 49 | |
| 50 | |
| 51 :GIT_COMMON | |
| 30 :: If the batch file exists, skip the git check. | 52 :: If the batch file exists, skip the git check. |
| 31 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK | 53 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" goto :MSYS_PATH_CHECK |
| 32 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK | 54 if "%CHROME_HEADLESS%" == "1" goto :SVN_CHECK |
| 33 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 55 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
| 34 call git --version 2>nul 1>nul | 56 call git --version 2>nul 1>nul |
| 35 if errorlevel 1 goto :GIT_INSTALL | 57 if errorlevel 1 goto :GIT_INSTALL |
| 36 goto :SVN_CHECK | 58 goto :SVN_CHECK |
| 37 | 59 |
| 38 | 60 |
| 39 :MSYS_PATH_CHECK | 61 :MSYS_PATH_CHECK |
| 40 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul | 62 call find "mingw" "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" 2>nul 1>nul |
| 41 if errorlevel 1 goto :SVN_CHECK | 63 if errorlevel 1 goto :SVN_CHECK |
| 42 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" | 64 rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" |
| 43 | 65 |
| 44 | 66 |
| 45 :GIT_INSTALL | 67 :GIT_INSTALL |
| 46 echo Installing git (avg 1-2 min download) ... | 68 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... |
| 47 :: git is not accessible; check it out and create 'proxy' files. | 69 :: git is not accessible; check it out and create 'proxy' files. |
| 48 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" | 70 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" |
| 49 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/git-1.8.0_bin.zip | 71 echo Fetching from %GIT_ZIP_URL% |
| 50 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party /git-1.8.0_bin.zip "%ZIP_DIR%\git.zip" | 72 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip " |
| 51 if errorlevel 1 goto :GIT_FAIL | 73 if errorlevel 1 goto :GIT_FAIL |
| 52 :: Cleanup svn directory if it was existing. | 74 :: Cleanup svn directory if it was existing. |
| 53 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" | 75 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" |
| 54 :: Will create %GIT_BIN_DIR%\... | 76 :: Will create %GIT_BIN_DIR%\... |
| 55 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" | 77 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" |
| 56 if errorlevel 1 goto :GIT_FAIL | 78 if errorlevel 1 goto :GIT_FAIL |
| 57 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 79 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL |
| 58 del "%ZIP_DIR%\git.zip" | 80 del "%ZIP_DIR%\git.zip" |
| 59 :: Create the batch files. | 81 :: Create the batch files. |
| 60 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul | 82 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul |
| 61 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul | 83 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul |
| 62 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul | 84 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.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 | 85 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul |
| 64 :: Ensure autocrlf and filemode are set correctly. | 86 :: Ensure autocrlf and filemode are set correctly. |
| 65 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false | 87 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.autocrlf false |
| 66 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false | 88 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --global core.filemode false |
| 67 goto :SVN_CHECK | 89 goto :SVN_CHECK |
| 68 | 90 |
| 69 | 91 |
| 70 :GIT_FAIL | 92 :GIT_FAIL |
| 71 echo ... Failed to checkout git automatically. | 93 echo ... Failed to checkout git automatically. |
| 72 echo Please visit http://code.google.com/p/msysgit to download the latest git | 94 echo Please visit http://code.google.com/p/msysgit to download the latest git |
| 73 echo client before continuing. | 95 echo client before continuing. |
| 74 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/ | 96 echo You can also get the "prebaked" version used at %GIT_ZIP_URL% |
|
iannucci
2014/02/07 04:35:27
lol, cool typo :D
| |
| 75 set ERRORLEVEL=1 | 97 set ERRORLEVEL=1 |
| 76 goto :END | 98 goto :END |
| 77 | 99 |
| 78 | 100 |
| 79 :SVN_CHECK | 101 :SVN_CHECK |
| 80 :: If the batch file exists, skip the svn check. | 102 :: If the batch file exists, skip the svn check. |
| 81 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 103 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
| 82 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 104 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
| 83 call svn --version 2>nul 1>nul | 105 call svn --version 2>nul 1>nul |
| 84 if errorlevel 1 goto :SVN_INSTALL | 106 if errorlevel 1 goto :SVN_INSTALL |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 goto :END | 199 goto :END |
| 178 | 200 |
| 179 | 201 |
| 180 :returncode | 202 :returncode |
| 181 set WIN_TOOLS_ROOT_URL= | 203 set WIN_TOOLS_ROOT_URL= |
| 182 set WIN_TOOLS_ROOT_DIR= | 204 set WIN_TOOLS_ROOT_DIR= |
| 183 exit /b %ERRORLEVEL% | 205 exit /b %ERRORLEVEL% |
| 184 | 206 |
| 185 :END | 207 :END |
| 186 call :returncode %ERRORLEVEL% | 208 call :returncode %ERRORLEVEL% |
| OLD | NEW |