Эх сурвалжийг харах

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>
Mike Frysinger 2 жил өмнө
parent
commit
b9b690ec0e
4 өөрчлөгдсөн 9 нэмэгдсэн , 6 устгасан
  1. 2 1
      cipd
  2. 1 1
      cipd_bin_setup.sh
  3. 3 2
      vpython
  4. 3 2
      vpython3

+ 2 - 1
cipd

@@ -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}"

+ 1 - 1
cipd_bin_setup.sh

@@ -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)"

+ 3 - 2
vpython

@@ -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 "$@"
   ;;
 *)

+ 3 - 2
vpython3

@@ -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 "$@"
   ;;
 *)