Commit 3466b0d6 authored by iannucci@chromium.org's avatar iannucci@chromium.org

Make msys depot_tools upgrade process smoother.

R=agable@chromium.org, dnj@chromium.org, mmoss@chromium.org
BUG=600028

Review URL: https://codereview.chromium.org/1848353003 .

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299677 0039d316-1c4b-4281-b951-d872f2087c98
parent ce0cec6f
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
:: Use of this source code is governed by a BSD-style license that can be :: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file. :: found in the LICENSE file.
:: This script will try to find if svn and python are accessible and it not, :: This script will determine if python, git, or svn binaries need updates. It
:: it will try to download it and 'install' it in depot_tools. :: returns 123 if the user's shell must restart, otherwise !0 is failure
:: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly
:: returned. :: returned.
...@@ -83,7 +83,7 @@ set GIT_EXE_PATH=%GIT_INST_DIR%\bin\git.exe ...@@ -83,7 +83,7 @@ set GIT_EXE_PATH=%GIT_INST_DIR%\bin\git.exe
for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do (
if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" (
echo Cleaning old git installation %%i echo Cleaning old git installation %%i
rmdir /s /q "%%i" rmdir /s /q "%%i" > NUL
) )
) )
...@@ -97,7 +97,7 @@ if errorlevel 1 goto :GIT_INSTALL ...@@ -97,7 +97,7 @@ if errorlevel 1 goto :GIT_INSTALL
:: Several git versions can live side-by-side; check the top-level :: Several git versions can live side-by-side; check the top-level
:: batch script to make sure it points to the desired version. :: batch script to make sure it points to the desired version.
for %%f in (git.bat gitk.bat ssh.bat ssh-keygen.bat git-bash) do ( for %%f in (git.bat gitk.bat ssh.bat ssh-keygen.bat git-bash) do (
find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\%%f" 2>nul 1>nul %FIND_EXE% "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\%%f" 2>nul 1>nul
if errorlevel 1 goto :GIT_MAKE_BATCH_FILES if errorlevel 1 goto :GIT_MAKE_BATCH_FILES
) )
goto :SYNC_GIT_HELP_FILES goto :SYNC_GIT_HELP_FILES
...@@ -127,6 +127,8 @@ if errorlevel 1 goto :GIT_FAIL ...@@ -127,6 +127,8 @@ if errorlevel 1 goto :GIT_FAIL
del "%GIT_DOWNLOAD_PATH%" del "%GIT_DOWNLOAD_PATH%"
if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL
set DID_UPGRADE=1
:GIT_MAKE_BATCH_FILES :GIT_MAKE_BATCH_FILES
:: Create the batch files. :: Create the batch files.
set GIT_TEMPL=%~dp0git.template.bat set GIT_TEMPL=%~dp0git.template.bat
...@@ -154,6 +156,17 @@ call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true ...@@ -154,6 +156,17 @@ call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true
:: /y : Don't prompt for overwrites (yes) :: /y : Don't prompt for overwrites (yes)
xcopy /i /q /d /y "%WIN_TOOLS_ROOT_DIR%\man\html\*" "%GIT_INST_DIR%\mingw64\share\doc\git-doc" > NUL xcopy /i /q /d /y "%WIN_TOOLS_ROOT_DIR%\man\html\*" "%GIT_INST_DIR%\mingw64\share\doc\git-doc" > NUL
:: MSYS users need to restart their shell.
if defined MSYSTEM if defined DID_UPGRADE (
echo.
echo.
echo IMPORTANT:
echo depot_tools' git distribution has been updated while inside of a MinGW
echo shell. In order to complete the upgrade, please exit the shell and re-run
echo `git bash` from cmd.
exit 123
)
goto :SVN_CHECK goto :SVN_CHECK
:GIT_FAIL :GIT_FAIL
......
...@@ -7,6 +7,16 @@ base_dir=$(dirname "$0") ...@@ -7,6 +7,16 @@ base_dir=$(dirname "$0")
if [[ "#grep#fetch#cleanup#diff#" != *"#$1#"* ]]; then if [[ "#grep#fetch#cleanup#diff#" != *"#$1#"* ]]; then
"$base_dir"/update_depot_tools "$@" "$base_dir"/update_depot_tools "$@"
case $? in
123)
# msys environment was upgraded, need to quit.
exit 0
;;
0)
;;
*)
exit $?
esac
fi fi
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/gclient.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/gclient.py" "$@"
...@@ -42,6 +42,16 @@ fi ...@@ -42,6 +42,16 @@ fi
# We want to update the bundled tools even under MinGW. # We want to update the bundled tools even under MinGW.
if [ $MINGW = 0 ]; then if [ $MINGW = 0 ]; then
$COMSPEC /c `cygpath -w "$base_dir/bootstrap/win/win_tools.bat"` $COMSPEC /c `cygpath -w "$base_dir/bootstrap/win/win_tools.bat"`
case $? in
123)
# msys environment was upgraded, need to quit.
exit 123
;;
0)
;;
*)
exit $?
esac
fi fi
CANONICAL_GIT_URL="https://chromium.googlesource.com/chromium/tools/depot_tools.git" CANONICAL_GIT_URL="https://chromium.googlesource.com/chromium/tools/depot_tools.git"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment