Commit afc32ce3 authored by scottmg@chromium.org's avatar scottmg@chromium.org

Less attempted magic in pulling toolchain

- Don't try to wrap download_from_google_storage --config, instead just
request that the user runs it manually. (This is annoying either way
but making it magically run makes it less clear what's going on, and so
harder to debug when something goes wrong, per linked bug).

- Check that SHA1s are passed as expected on the command line in case
the script is run directly, rather than from gyp_chromium.

R=scherkus@chromium.org
BUG=349596

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@256049 0039d316-1c4b-4281-b951-d872f2087c98
parent d0b0a5b0
...@@ -147,31 +147,28 @@ def CanAccessToolchainBucket(): ...@@ -147,31 +147,28 @@ def CanAccessToolchainBucket():
return code == 0 return code == 0
def ConfigureGsAccess(): def RequestGsAuthentication():
"""Starts the authentication flow for gs://, and confirms that it's """Requests that the user authenticate to be able to access gs:// as a
accessible after completion, or retries indefinitely. Googler. This allows much faster downloads, and pulling (old) toolchains
that match src/ revisions.
""" """
while not CanAccessToolchainBucket():
print 'Access to gs://chrome-wintoolchain/ not configured.' print 'Access to gs://chrome-wintoolchain/ not configured.'
print '-----------------------------------------------------------------' print '-----------------------------------------------------------------'
print print
print 'You appear to be a Googler.' print 'You appear to be a Googler.'
print print
print 'I\'m sorry for the hassle, but you need to do a one-time manual' print 'I\'m sorry for the hassle, but you need to do a one-time manual'
print 'authentication. Instructions will open in a new window. This is' print 'authentication. Please run:'
print 'a run of "gsutil config".'
print print
print 'NOTE: Just press Enter when asked for a "project-id".' print ' download_from_google_storage --config'
print
print 'and follow the instructions. NOTE: Just press Enter when asked for'
print 'a "project-id".'
print print
print '-----------------------------------------------------------------' print '-----------------------------------------------------------------'
print print
sys.stdout.flush() sys.stdout.flush()
# gclient's buffering makes this hang if we're run from inside gclient sys.exit(1)
# as is typical. So, spawn a new window for the config prompt. :(
subprocess.check_call(
['start', '/wait', 'cmd', '/c',
'download_from_google_storage', '--config'],
shell=True)
def DelayBeforeRemoving(target_dir): def DelayBeforeRemoving(target_dir):
...@@ -197,6 +194,8 @@ def main(): ...@@ -197,6 +194,8 @@ def main():
# We assume that the Pro hash is the first one. # We assume that the Pro hash is the first one.
desired_hashes = args desired_hashes = args
if len(desired_hashes) == 0:
sys.exit('Desired hashes are required.')
# Move to depot_tools\win_toolchain where we'll store our files, and where # Move to depot_tools\win_toolchain where we'll store our files, and where
# the downloader script is. # the downloader script is.
...@@ -211,11 +210,10 @@ def main(): ...@@ -211,11 +210,10 @@ def main():
current_hash = CalculateHash(target_dir) current_hash = CalculateHash(target_dir)
if current_hash not in desired_hashes: if current_hash not in desired_hashes:
should_use_gs = False should_use_gs = False
if (CanAccessToolchainBucket() or if HaveSrcInternalAccess() or LooksLikeGoogler():
HaveSrcInternalAccess() or
LooksLikeGoogler()):
should_use_gs = True should_use_gs = True
ConfigureGsAccess() if not CanAccessToolchainBucket():
RequestGsAuthentication()
print('Windows toolchain out of date or doesn\'t exist, updating (%s)...' % print('Windows toolchain out of date or doesn\'t exist, updating (%s)...' %
('Pro' if should_use_gs else 'Express')) ('Pro' if should_use_gs else 'Express'))
print(' current_hash: %s' % current_hash) print(' current_hash: %s' % current_hash)
......
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