You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_tools/update_depot_tools.bat

62 lines
1.9 KiB
Batchfile

@echo off
:: Copyright (c) 2012 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
:: This batch file will try to sync the root directory.
setlocal
:: Windows freaks out if a file is overwritten while it's being executed. Copy
:: this script off to a temporary location and reinvoke from there before
:: running any git commands.
IF "%~nx0"=="update_depot_tools.bat" (
COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul
if errorlevel 1 goto :EOF
"%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %*
)
set DEPOT_TOOLS_DIR=%~1
SHIFT
IF EXIST "%DEPOT_TOOLS_DIR%.disable_auto_update" GOTO :EOF
set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git
:: Will download git and python.
Revert "Reland "depot_tools: Bootstrap Python 3 on Linux/Mac"" This reverts commits 0e85f633c7c4364f4d616e9e13dce2c9a9dd518e and 9d25ad41920eff43a8249f663e5f66d7d1b89d5f. Reason for revert: Causes problems for MinGW users. Original change's description: > Reland "depot_tools: Bootstrap Python 3 on Linux/Mac" > > This is a reland of dbca865e55f706efc3843eab2e88a65aa810be49 > > Original change's description: > > depot_tools: Bootstrap Python 3 on Linux/Mac > > > > This will make it possible for developers to execute depot_tools > > scripts using Python 3 in a known environment. > > > > Bug: 1002153 > > Change-Id: I5ff492a49d227c1b5876f49adba020f51a575bdd > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1762664 > > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org> > > Reviewed-by: Dirk Pranke <dpranke@chromium.org> > > Reviewed-by: Andrii Shyshkalov <tandrii@google.com> > > Bug: 1002153 > Change-Id: I6938a76ffa05366c21f7c56aed3d07ecb2b84443 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1798845 > Reviewed-by: Dirk Pranke <dpranke@chromium.org> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org> TBR=iannucci@chromium.org,dpranke@chromium.org,tandrii@google.com,ehmaldonado@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 1002153 Change-Id: I3ee87b95b2532ec694d7f4f87cce8cde8ccf86eb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1808137 Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
call "%DEPOT_TOOLS_DIR%bootstrap\win\win_tools.bat"
if errorlevel 1 goto :EOF
:: Now clear errorlevel so it can be set by other programs later.
set errorlevel=
:: Shall skip automatic update?
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF
:: We need .\.git\. to be able to sync.
IF EXIST "%DEPOT_TOOLS_DIR%.git\." GOTO :GIT_UPDATE
echo Error updating depot_tools, no revision tool found.
goto :EOF
:GIT_UPDATE
cd /d "%DEPOT_TOOLS_DIR%."
call git config remote.origin.fetch > NUL
for /F %%x in ('git config --get remote.origin.url') DO (
IF not "%%x" == "%GIT_URL%" (
echo Your depot_tools checkout is configured to fetch from an obsolete URL
choice /N /T 60 /D N /M "Would you like to update it? [y/N]: "
IF not errorlevel 2 (
call git config remote.origin.url "%GIT_URL%"
)
)
)
call git fetch -q origin > NUL
call git checkout -q origin/master > NUL
if errorlevel 1 (
echo Failed to update depot_tools.
goto :EOF
)
:: Sync CIPD and CIPD client tools.
call "%~dp0\cipd_bin_setup.bat"