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. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 goto :GIT_CHECK | 50 goto :GIT_CHECK |
| 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 if "%DEPOT_TOOLS_GIT_BLEEDING%" == "1" ( | 60 |
| 61 set GIT_VERSION=1.9.5.chromium.6 | 61 :: See if we're on XP |
| 62 ) else ( | |
| 63 set GIT_VERSION=1.9.5.chromium.6 | |
| 64 ) | |
| 65 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i | 62 for /f "tokens=2 delims=[]" %%i in ('ver') do set VERSTR=%%i |
| 66 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j) | 63 for /f "tokens=2,3 delims=. " %%i in ("%VERSTR%") do (set VERMAJOR=%%i & set VER MINOR=%%j) |
| 67 if %VERMAJOR% lss 5 set GIT_VERSION=%GIT_VERSION%-xp | 64 if %VERMAJOR% lss 5 set GIT_VERSION=%GIT_VERSION%-xp |
| 68 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 set GIT_VERSION=%GIT_VERSION%-xp | 65 if %VERMAJOR% equ 5 if %VERMINOR% lss 2 set XP_SUFFIX=-xp |
| 69 | 66 |
| 67 :: Check to see if we're on a 32 or 64 bit system | |
| 68 reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS_BITS=32 || set OS_BITS=64 | |
| 69 | |
| 70 if not exist "%WIN_TOOLS_ROOT_DIR%\.git_bleeding_edge" goto :GIT_OLD_FLOW | |
|
iannucci
2016/03/29 00:11:12
can't use code blocks here, because we can't rely
| |
| 71 set GIT_PORTABLE_FLOW=1 | |
| 72 set GIT_VERSION=2.7.4-%OS_BITS% | |
| 73 set GIT_FETCH_URL=https://commondatastorage.googleapis.com/chrome-infra/Portable Git-%GIT_VERSION%-bit.7z.exe | |
| 74 set GIT_DOWNLOAD_PATH=%ZIP_DIR%\git.7z.exe | |
| 75 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
| 76 set GIT_INST_DIR=%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR% | |
| 77 set GIT_EXE_PATH=%GIT_INST_DIR%\bin\git.exe | |
| 78 goto :GIT_CLEANUP | |
| 79 | |
| 80 :GIT_OLD_FLOW | |
| 81 set GIT_VERSION=1.9.5.chromium.6%XP_SUFFIX% | |
| 82 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
| 83 set GIT_FETCH_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_BIN _DIR%.zip | |
| 84 set GIT_DOWNLOAD_PATH=%ZIP_DIR%\git.zip | |
| 85 set GIT_INST_DIR=%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR% | |
| 86 set GIT_EXE_PATH=%GIT_INST_DIR%\cmd\git.cmd | |
| 87 | |
| 88 :GIT_CLEANUP | |
| 70 :: Clean up any release which doesn't match the one we want. | 89 :: Clean up any release which doesn't match the one we want. |
| 71 for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( | 90 for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( |
| 72 if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( | 91 if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( |
| 92 echo Cleaning old git installation %%i | |
| 73 rmdir /s /q "%%i" | 93 rmdir /s /q "%%i" |
| 74 ) | 94 ) |
| 75 ) | 95 ) |
| 76 set GIT_BIN_DIR=git-%GIT_VERSION%_bin | |
| 77 set GIT_ZIP_FILE=%GIT_BIN_DIR%.zip | |
| 78 set GIT_ZIP_URL=https://commondatastorage.googleapis.com/chrome-infra/%GIT_ZIP_F ILE% | |
| 79 | 96 |
| 80 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 97 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
| 81 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" ( | 98 |
| 82 call "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" --version 2>nul 1>nul | 99 if exist "%GIT_EXE_PATH%" ( |
| 100 call "%GIT_EXE_PATH%" --version 2>nul 1>nul | |
| 83 if errorlevel 1 goto :GIT_INSTALL | 101 if errorlevel 1 goto :GIT_INSTALL |
| 84 rem Several git versions can live side-by-side; check the top-level | 102 rem Several git versions can live side-by-side; check the top-level |
| 85 rem batch script to make sure it points to the desired version. | 103 rem batch script to make sure it points to the desired version. |
| 86 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul | 104 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul |
| 87 if errorlevel 1 goto :GIT_COPY_BATCH_FILES | 105 if errorlevel 1 goto :GIT_MAKE_BATCH_FILES |
| 88 goto :SVN_CHECK | 106 goto :SVN_CHECK |
| 89 ) | 107 ) |
| 90 goto :GIT_INSTALL | 108 goto :GIT_INSTALL |
| 91 | 109 |
| 92 | |
| 93 :GIT_INSTALL | 110 :GIT_INSTALL |
| 94 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... | 111 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... |
| 112 echo Detected: %OS_BITS% bits | |
| 113 if defined XP_SUFFIX echo ... Windows XP | |
| 114 if defined GIT_PORTABLE_FLOW echo ... Portable installation flow | |
| 115 | |
| 95 :: git is not accessible; check it out and create 'proxy' files. | 116 :: git is not accessible; check it out and create 'proxy' files. |
| 96 if exist "%ZIP_DIR%\git.zip" del "%ZIP_DIR%\git.zip" | 117 if exist "%GIT_DOWNLOAD_PATH%" del "%GIT_DOWNLOAD_PATH%" |
| 97 echo Fetching from %GIT_ZIP_URL% | 118 echo Fetching from %GIT_FETCH_URL% |
| 98 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_ZIP_URL% "%ZIP_DIR%\git.zip " | 119 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_FETCH_URL% "%GIT_DOWNLOAD_P ATH%" |
| 99 if errorlevel 1 goto :GIT_FAIL | 120 if errorlevel 1 goto :GIT_FAIL |
| 100 :: Cleanup svn directory if it was existing. | 121 :: Cleanup git directory if it already exists. |
| 101 if exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\% GIT_BIN_DIR%" | 122 if exist "%GIT_INST_DIR%\." rd /q /s "%GIT_INST_DIR%" |
| 102 :: Will create %GIT_BIN_DIR%\... | 123 |
| 103 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\git.zip" "%WIN_TOOLS_ROO T_DIR%" | 124 if defined GIT_PORTABLE_FLOW ( |
| 125 rem run PortableGit self-extractor | |
| 126 rem -y : Be Quiet ("yes") | |
| 127 rem -sd1 : Self delete SFX archive | |
| 128 rem -InstallPath : Where to put the files | |
| 129 rem -Directory : Run the post-extract program with this current-working-direct ory | |
| 130 call "%GIT_DOWNLOAD_PATH%" -y -sd1 -InstallPath="%GIT_INST_DIR%" -Directory="% GIT_INST_DIR%" | |
| 131 ) else ( | |
| 132 rem Will create %GIT_INST_DIR%\... | |
| 133 cscript //nologo //e:jscript "%~dp0unzip.js" "%GIT_DOWNLOAD_PATH%" "%WIN_TOOLS _ROOT_DIR%" | |
| 134 ) | |
| 135 | |
| 104 if errorlevel 1 goto :GIT_FAIL | 136 if errorlevel 1 goto :GIT_FAIL |
| 105 if not exist "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\." goto :GIT_FAIL | 137 del "%GIT_DOWNLOAD_PATH%" |
| 106 del "%ZIP_DIR%\git.zip" | 138 if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL |
| 107 goto :GIT_COPY_BATCH_FILES | |
| 108 | 139 |
| 109 | 140 :GIT_MAKE_BATCH_FILES |
| 110 :GIT_COPY_BATCH_FILES | |
| 111 :: Create the batch files. | 141 :: Create the batch files. |
| 112 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR%\ git.bat" 1>nul | 142 set GIT_TEMPL=%~dp0git.template.bat |
| 113 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DIR% \gitk.bat" 1>nul | 143 set SED=%GIT_INST_DIR%\usr\bin\sed.exe |
| 114 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR%\ ssh.bat" 1>nul | 144 if defined GIT_PORTABLE_FLOW ( |
| 115 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROO T_DIR%\ssh-keygen.bat" 1>nul | 145 rem turns out we just installed sed :) |
| 146 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" | |
| 147 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" | |
| 148 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" | |
| 149 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" | |
| 150 ) else ( | |
| 151 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\git.bat" "%WIN_TOOLS_ROOT_DIR %\git.bat" 1>nul | |
| 152 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\gitk.bat" "%WIN_TOOLS_ROOT_DI R%\gitk.bat" 1>nul | |
| 153 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh.bat" "%WIN_TOOLS_ROOT_DIR %\ssh.bat" 1>nul | |
| 154 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_R OOT_DIR%\ssh-keygen.bat" 1>nul | |
| 155 ) | |
| 116 | 156 |
| 117 :: Ensure autocrlf and filemode are set correctly. | 157 :: Ensure autocrlf and filemode are set correctly. |
| 118 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false | 158 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false |
| 119 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false | 159 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false |
| 160 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.preloadindex true | |
| 161 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true | |
| 120 goto :SVN_CHECK | 162 goto :SVN_CHECK |
| 121 | 163 |
| 122 | 164 |
| 123 :GIT_FAIL | 165 :GIT_FAIL |
| 124 echo ... Failed to checkout git automatically. | 166 echo ... Failed to checkout git automatically. |
| 125 echo You should get the "prebaked" version used at %GIT_ZIP_URL% | 167 echo You should get the "prebaked" version used at %GIT_FETCH_URL% |
| 126 set ERRORLEVEL=1 | 168 set ERRORLEVEL=1 |
| 127 goto :END | 169 goto :END |
| 128 | 170 |
| 129 | 171 |
| 130 :SVN_CHECK | 172 :SVN_CHECK |
| 131 :: If the batch file exists, skip the svn check. | 173 :: If the batch file exists, skip the svn check. |
| 132 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :END | 174 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :END |
| 133 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 175 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
| 134 call svn --version 2>nul 1>nul | 176 call svn --version 2>nul 1>nul |
| 135 if errorlevel 1 goto :SVN_INSTALL | 177 if errorlevel 1 goto :SVN_INSTALL |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 164 goto :END | 206 goto :END |
| 165 | 207 |
| 166 | 208 |
| 167 :returncode | 209 :returncode |
| 168 set WIN_TOOLS_ROOT_URL= | 210 set WIN_TOOLS_ROOT_URL= |
| 169 set WIN_TOOLS_ROOT_DIR= | 211 set WIN_TOOLS_ROOT_DIR= |
| 170 exit /b %ERRORLEVEL% | 212 exit /b %ERRORLEVEL% |
| 171 | 213 |
| 172 :END | 214 :END |
| 173 call :returncode %ERRORLEVEL% | 215 call :returncode %ERRORLEVEL% |
| OLD | NEW |