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

73 lines
2.5 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.
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
setlocal enabledelayedexpansion
:: 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.
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
:: !ERRORLEVEL! syntax is used to get delayed expansion, because %ERRORLEVEL%
:: would return a value that was set prior entering the IF block.
IF "%~nx0"=="update_depot_tools.bat" (
COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
if errorlevel 1 (
echo Error updating depot_tools, can't copy update_depot_tools.bat to TEMP.
exit /b !ERRORLEVEL!
)
:: Use call/exit to avoid leaving an orphaned window title.
call "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %*
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
exit /b !ERRORLEVEL!
)
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
setlocal disabledelayedexpansion
set DEPOT_TOOLS_DIR=%~1
SHIFT
:: Shall skip automatic update?
IF EXIST "%DEPOT_TOOLS_DIR%.disable_auto_update" GOTO :EOF
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
echo Updating depot_tools...
:: Trigger generating depot_tools' git wrappers in case they are in a bad state.
:: This can happen if there was a problem installing CIPD packages in the
:: previous attempt to update depot_tools, and the bootstrapping script was not
:: run.
call git --version > nul 2>&1
if %ERRORLEVEL% == 0 goto :GIT_UPDATE
call "%DEPOT_TOOLS_DIR%bootstrap\win_tools.bat"
if errorlevel 1 (
echo Error updating depot_tools - Git not found.
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
exit /b %ERRORLEVEL%
)
:GIT_UPDATE
:: Now clear errorlevel so it can be set by other programs later.
set errorlevel=
:: Make sure DEPOT_TOOLS_DIR is a git repo
IF NOT EXIST "%DEPOT_TOOLS_DIR%.git" (
echo Error: Your depot_tools directory does not appear to be a git repository, and cannot be updated.
echo Consider deleting your depot_tools directory and following the instructions at https://www.chromium.org/developers/how-tos/install-depot-tools/ to reinstall it.
exit /b 1
)
cd /d "%DEPOT_TOOLS_DIR%."
call git fetch -q origin > NUL
call git checkout -q origin/main > NUL
if errorlevel 1 (
echo Failed to update depot_tools.
Reland "Make depot_tools scripts return exit codes properly on all platforms." This reverts commit 6754c49e02b62d54b9b5d8b8b8a93e77bae935f8. Reason for revert: will be relanded with fixed batch comments that triggered parser error. Original change's description: > Revert "Make depot_tools scripts return exit codes properly on all platforms." > > This reverts commit 7c4f7ec40818ddd883aa0a3b132cea06af92a713. > > Reason for revert: bugs reported by users (see comments in Gerrit). > error: block. was unexpected at this time. > > Original change's description: > > Make depot_tools scripts return exit codes properly on all platforms. > > > > Changes: > > 1. Windows: exit /b %errorlevel% should be used instead of goto :EOF to get valid exit codes during cmd /c <script>.bat invocation. > > 2. Windows: delayed var expansion is required in update_depot_tools.bat exit code generation. > > 3. Posix: update_depot_tools returns exit code from update_git_repo function in case of a failure. > > > > A rule of thumb on Windows: goto :EOF should not be used if %errorlevel% must be returned for all possible invocations. > > > > Test case for update_depot_tools changes: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run update_depot_tools either directly or via gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% or $? depending on platform > > 5. Expected 1, but the actual result is 0. > > > > Test case for changes in other .bat files: > > 1. Make a change to depot_tools sources that will conflict with next depot_tools update > > 2. Run cmd /c gclient > > 3. Expect a git error is triggered > > 4. Inspect %errorlevel% > > 5. Expected 1, but the actual result is 0. > > > > Change-Id: I64459982bcd9cc3db1319a9b39224b7a7af8c5aa > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3688632 > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > Commit-Queue: Josip Sokcevic <sokcevic@google.com> > > Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com> > > Reviewed-by: Bruce Dawson <brucedawson@chromium.org> > > Change-Id: I85d598af01d75588cdee77165d6af22270ee031d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3694139 > Auto-Submit: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Change-Id: I377f966ea1b1a567de815caca703b5e124a76b64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696396 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Bruce Dawson <brucedawson@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
3 years ago
exit /b %ERRORLEVEL%
)
:: Sync CIPD and CIPD client tools.
call "%~dp0\cipd_bin_setup.bat"
:: Update python and generate git wrappers.
call "%DEPOT_TOOLS_DIR%bootstrap\win_tools.bat"