Add a platform filtering and executable setting abilities to download_from_google_storage.

Adds a command line flag --platform to control which platforms the given download occurs on.

Automatically marks downloads executable on non-Windows if the header x-goog-meta-executable is set. Automatically set this flag on upload when the executable bit is set.

BUG=233100

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@231387 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
brettw@chromium.org
2013-10-28 19:55:48 +00:00
parent fd5b638293
commit ba63bcbe0f
2 changed files with 41 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import optparse
import os
import Queue
import re
import stat
import sys
import threading
import time
@@ -103,6 +104,18 @@ def _upload_worker(
(filename, file_url, err)))
continue
# Mark executable files with the header "x-goog-meta-executable: 1" which
# the download script will check for to preserve the executable bit.
if not sys.platform.startswith('win'):
if os.stat(filename).st_mode & stat.S_IEXEC:
code, _, err = gsutil.check_call('setmeta', '-h',
'x-goog-meta-executable:1', file_url)
if code:
ret_codes.put(
(code,
'Encountered error on setting metadata on %s\n%s' %
(file_url, err)))
def get_targets(args, parser, use_null_terminator):
if not args: