OLD | NEW |
1 @echo off | 1 @echo off |
2 :: Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2009 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 SETLOCAL | 9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly |
| 10 :: returned. |
10 | 11 |
11 set ROOT_URL=http://src.chromium.org/svn/trunk/tools | 12 set WIN_TOOLS_ROOT_URL=http://src.chromium.org/svn/trunk/tools |
12 set ROOT_DIR=%~dp0..\.. | 13 set WIN_TOOLS_ROOT_DIR=%~dp0..\.. |
13 | 14 |
| 15 :SVN_CHECK |
14 :: If the batch file exists, skip the svn check. | 16 :: If the batch file exists, skip the svn check. |
15 if exist "%ROOT_DIR%\svn.bat" goto :PYTHON | 17 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
16 call svn --version 2>nul 1>nul | 18 call svn --version 2>nul 1>nul |
17 if errorlevel 1 call :C_SVN | 19 if errorlevel 1 goto :SVN_INSTALL |
18 | 20 goto :PYTHON_CHECK |
19 :PYTHON | |
20 :: If the batch file exists, skip the python check. | |
21 if exist "%ROOT_DIR%\python.bat" goto :EOF | |
22 call python --version 2>nul 1>nul | |
23 if errorlevel 1 call :C_PYTHON | |
24 | |
25 :: We are done. | |
26 goto :EOF | |
27 | 21 |
28 | 22 |
29 :C_SVN | 23 :SVN_INSTALL |
30 echo Installing subversion ... | 24 echo Installing subversion ... |
31 :: svn is not accessible; check it out and create 'proxy' files. | 25 :: svn is not accessible; check it out and create 'proxy' files. |
32 call "%~dp0wget" -q %ROOT_URL%/third_party/svn.7z -O "%~dp0svn.7z" | 26 if exist "%~dp0svn.7z" del "%~dp0svn.7z" |
| 27 call "%~dp0wget" -q %WIN_TOOLS_ROOT_URL%/third_party/svn_win_client.7z -O "%~dp0
svn.7z" |
33 if errorlevel 1 goto :SVN_FAIL | 28 if errorlevel 1 goto :SVN_FAIL |
34 call "%~dp07za" x "%~dp0svn.7z" %ROOT_DIR% | 29 echo call "%~dp07za" x -y "%~dp0svn.7z" -o"%WIN_TOOLS_ROOT_DIR%" 1>nul |
| 30 call "%~dp07za" x -y "%~dp0svn.7z" -o"%WIN_TOOLS_ROOT_DIR%" 1>nul |
35 if errorlevel 1 goto :SVN_FAIL | 31 if errorlevel 1 goto :SVN_FAIL |
| 32 if not exist "%WIN_TOOLS_ROOT_DIR%\svn\." goto :SVN_FAIL |
36 del "%~dp0svn.7z" | 33 del "%~dp0svn.7z" |
37 :: Create the batch file. | 34 :: Create the batch file. |
38 copy "%~dp0svn.bat" "%ROOT_DIR%" | 35 call copy /y "%~dp0svn.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul |
39 goto :EOF | 36 goto :PYTHON_CHECK |
40 | 37 |
41 | 38 |
42 :SVN_FAIL | 39 :SVN_FAIL |
43 echo Failed to checkout svn automatically. | 40 echo ... Failed to checkout svn automatically. |
44 echo Please visit http://subversion.tigris.org to download the latest subversion
client | 41 echo Please visit http://subversion.tigris.org to download the latest subversion
client |
45 echo before continuing. | 42 echo before continuing. |
46 echo You can also get the "prebacked" version used at %ROOT_URL%/third_party/ | 43 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ |
47 :: Still try python. | 44 set ERRORLEVEL=1 |
48 goto :C_PYTHON | 45 goto :END |
49 | 46 |
50 | 47 |
51 :C_PYTHON | 48 :PYTHON_CHECK |
| 49 :: If the batch file exists, skip the python check. |
| 50 set ERRORLEVEL=0 |
| 51 if exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :END |
| 52 call python --version 2>nul 1>nul |
| 53 if errorlevel 1 goto :PYTHON_INSTALL |
| 54 |
| 55 :: We are done. |
| 56 set ERRORLEVEL=0 |
| 57 goto :END |
| 58 |
| 59 |
| 60 :PYTHON_INSTALL |
52 echo Installing python ... | 61 echo Installing python ... |
53 call svn co %ROOT_URL%/third_party/python "%ROOT_DIR%\python" | 62 call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python "%WIN_TOOLS_ROOT_DIR%\pyt
hon" |
54 if errorlevel 1 goto :PYTHON_FAIL | 63 if errorlevel 1 goto :PYTHON_FAIL |
55 :: Create the batch file. | 64 :: Create the batch file. |
56 copy "%~dp0python.bat" "%ROOT_DIR%" | 65 call copy /y "%~dp0python.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul |
57 goto :EOF | 66 set ERRORLEVEL=0 |
| 67 goto :END |
58 | 68 |
59 | 69 |
60 :PYTHON_FAIL | 70 :PYTHON_FAIL |
61 echo Failed to checkout python automatically. | 71 echo ... Failed to checkout python automatically. |
62 echo Please visit http://python.org to download the latest python 2.x client bef
ore | 72 echo Please visit http://python.org to download the latest python 2.x client bef
ore |
63 echo continuing. | 73 echo continuing. |
64 echo You can also get the "prebacked" version used at %ROOT_URL%/third_party/ | 74 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ |
65 goto :EOF | 75 set ERRORLEVEL=1 |
| 76 goto :END |
| 77 |
| 78 |
| 79 :returncode |
| 80 set WIN_TOOLS_ROOT_URL= |
| 81 set WIN_TOOLS_ROOT_DIR= |
| 82 exit /b %ERRORLEVEL% |
| 83 |
| 84 :END |
| 85 call :returncode %ERRORLEVEL% |
OLD | NEW |