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 :: 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 WIN_TOOLS_ROOT_DIR=%~dp0..\.. | 13 set WIN_TOOLS_ROOT_DIR=%~dp0..\.. |
14 | 14 |
| 15 if "%1" == "force" ( |
| 16 set WIN_TOOLS_FORCE=1 |
| 17 shift /1 |
| 18 ) |
| 19 |
15 :SVN_CHECK | 20 :SVN_CHECK |
16 :: If the batch file exists, skip the svn check. | 21 :: If the batch file exists, skip the svn check. |
| 22 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
17 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 23 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK |
18 call svn --version 2>nul 1>nul | 24 call svn --version 2>nul 1>nul |
19 if errorlevel 1 goto :SVN_INSTALL | 25 if errorlevel 1 goto :SVN_INSTALL |
20 goto :PYTHON_CHECK | 26 goto :PYTHON_CHECK |
21 | 27 |
22 | 28 |
23 :SVN_INSTALL | 29 :SVN_INSTALL |
24 echo Installing subversion ... | 30 echo Installing subversion ... |
25 :: svn is not accessible; check it out and create 'proxy' files. | 31 :: svn is not accessible; check it out and create 'proxy' files. |
26 if exist "%~dp0svn.7z" del "%~dp0svn.7z" | 32 if exist "%~dp0svn.7z" del "%~dp0svn.7z" |
27 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/svn_win_client.zip "%~dp0svn.zip" | 33 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/svn_win_client.zip "%~dp0svn.zip" |
28 if errorlevel 1 goto :SVN_FAIL | 34 if errorlevel 1 goto :SVN_FAIL |
| 35 :: Cleanup svn directory if it was existing. |
| 36 if exist "%WIN_TOOLS_ROOT_DIR%\svn\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn" |
29 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0svn.zip" "%WIN_TOOLS_ROOT_DIR
%" | 37 cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0svn.zip" "%WIN_TOOLS_ROOT_DIR
%" |
30 if errorlevel 1 goto :SVN_FAIL | 38 if errorlevel 1 goto :SVN_FAIL |
31 if not exist "%WIN_TOOLS_ROOT_DIR%\svn\." goto :SVN_FAIL | 39 if not exist "%WIN_TOOLS_ROOT_DIR%\svn\." goto :SVN_FAIL |
32 del "%~dp0svn.zip" | 40 del "%~dp0svn.zip" |
33 :: Create the batch file. | 41 :: Create the batch file. |
34 call copy /y "%~dp0svn.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul | 42 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul |
35 goto :PYTHON_CHECK | 43 goto :PYTHON_CHECK |
36 | 44 |
37 | 45 |
38 :SVN_FAIL | 46 :SVN_FAIL |
39 echo ... Failed to checkout svn automatically. | 47 echo ... Failed to checkout svn automatically. |
40 echo Please visit http://subversion.tigris.org to download the latest subversion
client | 48 echo Please visit http://subversion.tigris.org to download the latest subversion
client |
41 echo before continuing. | 49 echo before continuing. |
42 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ | 50 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ |
43 set ERRORLEVEL=1 | 51 set ERRORLEVEL=1 |
44 goto :END | 52 goto :END |
45 | 53 |
46 | 54 |
47 :PYTHON_CHECK | 55 :PYTHON_CHECK |
48 :: If the batch file exists, skip the python check. | 56 :: If the batch file exists, skip the python check. |
| 57 if "%WIN_TOOLS_FORCE%" == "1" goto :PYTHON_INSTALL |
49 set ERRORLEVEL=0 | 58 set ERRORLEVEL=0 |
50 if exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :END | 59 if exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :END |
51 call python --version 2>nul 1>nul | 60 call python --version 2>nul 1>nul |
52 if errorlevel 1 goto :PYTHON_INSTALL | 61 if errorlevel 1 goto :PYTHON_INSTALL |
53 | 62 |
54 :: We are done. | 63 :: We are done. |
55 set ERRORLEVEL=0 | 64 set ERRORLEVEL=0 |
56 goto :END | 65 goto :END |
57 | 66 |
58 | 67 |
59 :PYTHON_INSTALL | 68 :PYTHON_INSTALL |
60 echo Installing python ... | 69 echo Installing python ... |
| 70 :: Cleanup python directory if it was existing. |
| 71 if exist "%WIN_TOOLS_ROOT_DIR%\python\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\python" |
61 call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python "%WIN_TOOLS_ROOT_DIR%\pyt
hon" | 72 call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python "%WIN_TOOLS_ROOT_DIR%\pyt
hon" |
62 if errorlevel 1 goto :PYTHON_FAIL | 73 if errorlevel 1 goto :PYTHON_FAIL |
63 :: Create the batch file. | 74 :: Create the batch file. |
64 call copy /y "%~dp0python.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul | 75 call copy /y "%~dp0python.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul |
65 set ERRORLEVEL=0 | 76 set ERRORLEVEL=0 |
66 goto :END | 77 goto :END |
67 | 78 |
68 | 79 |
69 :PYTHON_FAIL | 80 :PYTHON_FAIL |
70 echo ... Failed to checkout python automatically. | 81 echo ... Failed to checkout python automatically. |
71 echo Please visit http://python.org to download the latest python 2.x client bef
ore | 82 echo Please visit http://python.org to download the latest python 2.x client bef
ore |
72 echo continuing. | 83 echo continuing. |
73 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ | 84 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ |
74 set ERRORLEVEL=1 | 85 set ERRORLEVEL=1 |
75 goto :END | 86 goto :END |
76 | 87 |
77 | 88 |
78 :returncode | 89 :returncode |
79 set WIN_TOOLS_ROOT_URL= | 90 set WIN_TOOLS_ROOT_URL= |
80 set WIN_TOOLS_ROOT_DIR= | 91 set WIN_TOOLS_ROOT_DIR= |
81 exit /b %ERRORLEVEL% | 92 exit /b %ERRORLEVEL% |
82 | 93 |
83 :END | 94 :END |
84 call :returncode %ERRORLEVEL% | 95 call :returncode %ERRORLEVEL% |
OLD | NEW |