setup & share current uname -s value

Avoid recomputing this value multiple times between vpython & cipd.

Bug: 1469696
Change-Id: If82d58180f94cb2833a5a177f7b1e431e08f2892
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4750040
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
changes/40/4750040/2
Mike Frysinger 2 years ago committed by LUCI CQ
parent ce3e819465
commit b9b690ec0e

@ -8,6 +8,7 @@ set -e -o pipefail
# Export for other depot_tools scripts to re-use.
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}"
export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
MYPATH="${DEPOT_TOOLS_DIR}"
CYGWIN=false
@ -15,7 +16,7 @@ CYGWIN=false
# Make sure this starts empty
ARCH=
UNAME=`uname -s | tr '[:upper:]' '[:lower:]'`
UNAME="${DEPOT_TOOLS_UNAME_S}"
case "${UNAME}" in
aix)
OS="${UNAME}"

@ -7,7 +7,7 @@ function cipd_bin_setup {
local ENSURE="$MYPATH/cipd_manifest.txt"
local ROOT="$MYPATH/.cipd_bin"
UNAME=`uname -s | tr '[:upper:]' '[:lower:]'`
UNAME="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
case $UNAME in
cygwin*)
ENSURE="$(cygpath -w $ENSURE)"

@ -37,12 +37,13 @@ fi
# Export for other depot_tools scripts to re-use.
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null
case $(uname -s) in
MINGW*|CYGWIN*)
case "${DEPOT_TOOLS_UNAME_S}" in
mingw*|cygwin*)
cmd.exe //c $0.bat "$@"
;;
*)

@ -35,12 +35,13 @@ fi
# Export for other depot_tools scripts to re-use.
export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}"
export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null
case $(uname -s) in
MINGW*|CYGWIN*)
case "${DEPOT_TOOLS_UNAME_S}" in
mingw*|cygwin*)
cmd.exe //c $0.bat "$@"
;;
*)

Loading…
Cancel
Save