فهرست منبع

Fix depot_tools errors that cause runhooks to be inoperable for Cygwin

The vpython/CIPD work created some errors when attempting to build on
Cygwin. This patch fixes these errors by converting Cygwin paths to
Windows paths or using the depot_tools python instead of Cygwin python.

Bug:
Change-Id: Id62f59a357fa2937c7eb843bf306ef4303b0910e
Reviewed-on: https://chromium-review.googlesource.com/745727
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Chris Nardi 7 سال پیش
والد
کامیت
ab816ce8ff
2فایلهای تغییر یافته به همراه22 افزوده شده و 2 حذف شده
  1. 12 2
      cipd_bin_setup.sh
  2. 10 0
      gsutil.py

+ 12 - 2
cipd_bin_setup.sh

@@ -4,9 +4,19 @@
 
 function cipd_bin_setup {
     local MYPATH=$(dirname "${BASH_SOURCE[0]}")
+    local ENSURE="$MYPATH/cipd_manifest.txt"
+    local ROOT="$MYPATH/.cipd_bin"
+
+    UNAME=`uname -s | tr '[:upper:]' '[:lower:]'`
+    case $UNAME in
+      cygwin*)
+        ENSURE="$(cygpath -w $ENSURE)"
+        ROOT="$(cygpath -w $ROOT)"
+        ;;
+    esac
 
     "$MYPATH/cipd" ensure \
         -log-level warning \
-        -ensure-file "$MYPATH/cipd_manifest.txt" \
-        -root "$MYPATH/.cipd_bin"
+        -ensure-file "$ENSURE" \
+        -root "$ROOT"
 }

+ 10 - 0
gsutil.py

@@ -130,6 +130,16 @@ def run_gsutil(force_version, fallback, target, args, clean=False):
     gsutil_bin = fallback
   disable_update = ['-o', 'GSUtil:software_update_check_period=0']
 
+  if sys.platform == 'cygwin':
+    # This script requires Windows Python, so invoke with depot_tools'
+    # Python.
+    def winpath(path):
+      return subprocess.check_output(['cygpath', '-w', path]).strip()
+    cmd = ['python.bat', winpath(__file__)]
+    cmd.extend(args)
+    sys.exit(subprocess.call(cmd))
+  assert sys.platform != 'cygwin'
+
   # Run "gsutil" through "vpython". We need to do this because on GCE instances,
   # expectations are made about Python having access to "google-compute-engine"
   # and "boto" packages that are not met with non-system Python (e.g., bundles).