setup & share path to depot_tools checkout

A lot of scripts like to compute the dirname of $0 to find itself to
load more files.  Have some scripts export & resuse this value so we
avoid recalculating when not needed.

Bug: 1469696
Change-Id: I3aac2e6119dbfa3c68715208df2786f67cdce92e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4750430
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
Mike Frysinger
2023-08-03 22:05:10 +00:00
committed by LUCI CQ
parent 04e04ae337
commit 248aa8ba81
6 changed files with 21 additions and 12 deletions

View File

@@ -11,6 +11,9 @@ then
exit
fi
# Export for other depot_tools scripts to re-use.
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
# Test if this script is running under a MSYS install. This is likely an error
# if it is, so we warn the user accordingly.
OUTPUT="$(uname | grep 'MSYS')"
@@ -25,7 +28,7 @@ if [ $MSYS = 0 ]; then
echo
fi
base_dir=$(dirname "$0")
base_dir="${DEPOT_TOOLS_DIR}"
if [ -e "$base_dir/.disable_auto_update" ]; then
exit
fi