diff --git a/bootstrap/gclient.bat b/bootstrap/gclient.bat index 66fa05b8e..905192815 100644 --- a/bootstrap/gclient.bat +++ b/bootstrap/gclient.bat @@ -8,10 +8,10 @@ setlocal :: Shall skip automatic update? -IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO gclient +IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :gclient :: We can't sync if ..\.svn\. doesn't exist. -IF NOT EXIST "%~dp0..\.svn" GOTO gclient +IF NOT EXIST "%~dp0..\.svn\." GOTO :gclient :: Sync the .. directory to update the bootstrap at the same time. call svn -q up "%~dp0.." diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index 9e309bf3d..4603d5bc4 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -6,60 +6,80 @@ :: This script will try to find if svn and python are accessible and it not, :: it will try to download it and 'install' it in depot_tools. -SETLOCAL +:: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly +:: returned. -set ROOT_URL=http://src.chromium.org/svn/trunk/tools -set ROOT_DIR=%~dp0..\.. +set WIN_TOOLS_ROOT_URL=http://src.chromium.org/svn/trunk/tools +set WIN_TOOLS_ROOT_DIR=%~dp0..\.. +:SVN_CHECK :: If the batch file exists, skip the svn check. -if exist "%ROOT_DIR%\svn.bat" goto :PYTHON +if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK call svn --version 2>nul 1>nul -if errorlevel 1 call :C_SVN +if errorlevel 1 goto :SVN_INSTALL +goto :PYTHON_CHECK -:PYTHON -:: If the batch file exists, skip the python check. -if exist "%ROOT_DIR%\python.bat" goto :EOF -call python --version 2>nul 1>nul -if errorlevel 1 call :C_PYTHON - -:: We are done. -goto :EOF - -:C_SVN +:SVN_INSTALL echo Installing subversion ... :: svn is not accessible; check it out and create 'proxy' files. -call "%~dp0wget" -q %ROOT_URL%/third_party/svn.7z -O "%~dp0svn.7z" +if exist "%~dp0svn.7z" del "%~dp0svn.7z" +call "%~dp0wget" -q %WIN_TOOLS_ROOT_URL%/third_party/svn_win_client.7z -O "%~dp0svn.7z" if errorlevel 1 goto :SVN_FAIL -call "%~dp07za" x "%~dp0svn.7z" %ROOT_DIR% +echo call "%~dp07za" x -y "%~dp0svn.7z" -o"%WIN_TOOLS_ROOT_DIR%" 1>nul +call "%~dp07za" x -y "%~dp0svn.7z" -o"%WIN_TOOLS_ROOT_DIR%" 1>nul if errorlevel 1 goto :SVN_FAIL +if not exist "%WIN_TOOLS_ROOT_DIR%\svn\." goto :SVN_FAIL del "%~dp0svn.7z" :: Create the batch file. -copy "%~dp0svn.bat" "%ROOT_DIR%" -goto :EOF +call copy /y "%~dp0svn.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul +goto :PYTHON_CHECK :SVN_FAIL -echo Failed to checkout svn automatically. +echo ... Failed to checkout svn automatically. echo Please visit http://subversion.tigris.org to download the latest subversion client echo before continuing. -echo You can also get the "prebacked" version used at %ROOT_URL%/third_party/ -:: Still try python. -goto :C_PYTHON +echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third_party/ +set ERRORLEVEL=1 +goto :END + + +:PYTHON_CHECK +:: If the batch file exists, skip the python check. +set ERRORLEVEL=0 +if exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :END +call python --version 2>nul 1>nul +if errorlevel 1 goto :PYTHON_INSTALL + +:: We are done. +set ERRORLEVEL=0 +goto :END -:C_PYTHON +:PYTHON_INSTALL echo Installing python ... -call svn co %ROOT_URL%/third_party/python "%ROOT_DIR%\python" +call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python "%WIN_TOOLS_ROOT_DIR%\python" if errorlevel 1 goto :PYTHON_FAIL :: Create the batch file. -copy "%~dp0python.bat" "%ROOT_DIR%" -goto :EOF +call copy /y "%~dp0python.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul +set ERRORLEVEL=0 +goto :END :PYTHON_FAIL -echo Failed to checkout python automatically. +echo ... Failed to checkout python automatically. echo Please visit http://python.org to download the latest python 2.x client before echo continuing. -echo You can also get the "prebacked" version used at %ROOT_URL%/third_party/ -goto :EOF +echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third_party/ +set ERRORLEVEL=1 +goto :END + + +:returncode +set WIN_TOOLS_ROOT_URL= +set WIN_TOOLS_ROOT_DIR= +exit /b %ERRORLEVEL% + +:END +call :returncode %ERRORLEVEL% diff --git a/gclient.bat b/gclient.bat index 3a19bc056..32b4f66e5 100644 --- a/gclient.bat +++ b/gclient.bat @@ -10,7 +10,7 @@ :: Shall skip automatic update? IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :SKIP_UPDATE :: We can't sync if .\.svn\. doesn't exist. -IF NOT EXIST "%~dp0.svn" GOTO :SKIP_UPDATE +IF NOT EXIST "%~dp0.svn\." GOTO :SKIP_UPDATE :: Will download svn and python if not already installed on the system. call "%~dp0bootstrap\win\win_tools.bat"