Commit 20bef069 authored by dpranke@chromium.org's avatar dpranke@chromium.org

Fix setting the executable bit in download_from_google_storage.

The new GSUtil (or gs protocol, who knows) strips off the redundent x-goog-meta
string from the metadata key.  This CL compensates for that.

Also since we're on 4.7, we can use the faster gsutil stat instead of gsutil ls -L.

BUG=
TEST=ran download_from_google_storage against compiler_proxy.sha, works
NOTREECHECKS=true
NOTRY=true
R=dnj@chromium.org, pgervais@chromium.org

Review URL: https://codereview.chromium.org/809123003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293432 0039d316-1c4b-4281-b951-d872f2087c98
parent 199bc5f9
...@@ -248,15 +248,11 @@ def _downloader_worker_thread(thread_num, q, force, base_url, ...@@ -248,15 +248,11 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
elif sys.platform != 'win32': elif sys.platform != 'win32':
# On non-Windows platforms, key off of the custom header # On non-Windows platforms, key off of the custom header
# "x-goog-meta-executable". # "x-goog-meta-executable".
# code, out, _ = gsutil.check_call('stat', file_url)
# TODO(hinoka): It is supposedly faster to use "gsutil stat" but that
# doesn't appear to be supported by the gsutil currently in our tree. When
# we update, this code should use that instead of "gsutil ls -L".
code, out, _ = gsutil.check_call('ls', '-L', file_url)
if code != 0: if code != 0:
out_q.put('%d> %s' % (thread_num, err)) out_q.put('%d> %s' % (thread_num, err))
ret_codes.put((code, err)) ret_codes.put((code, err))
elif re.search('x-goog-meta-executable:', out): elif re.search(r'executable:\s*1', out):
st = os.stat(output_filename) st = os.stat(output_filename)
os.chmod(output_filename, st.st_mode | stat.S_IEXEC) os.chmod(output_filename, st.st_mode | stat.S_IEXEC)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment