Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 189093017: Less attempted magic in pulling toolchain (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win_toolchain/get_toolchain_if_necessary.py
diff --git a/win_toolchain/get_toolchain_if_necessary.py b/win_toolchain/get_toolchain_if_necessary.py
index 49157240ee023d9bdafd52bf96819545af821ab7..0ea3d768d750311f5b929326a1588805dd6e6a76 100755
--- a/win_toolchain/get_toolchain_if_necessary.py
+++ b/win_toolchain/get_toolchain_if_necessary.py
@@ -147,31 +147,28 @@ def CanAccessToolchainBucket():
return code == 0
-def ConfigureGsAccess():
- """Starts the authentication flow for gs://, and confirms that it's
- accessible after completion, or retries indefinitely.
+def RequestGsAuthentication():
+ """Requests that the user authenticate to be able to access gs:// as a
+ 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 '-----------------------------------------------------------------'
- print
- print 'You appear to be a Googler.'
- print
- 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 'a run of "gsutil config".'
- print
- print 'NOTE: Just press Enter when asked for a "project-id".'
- print
- print '-----------------------------------------------------------------'
- print
- sys.stdout.flush()
- # gclient's buffering makes this hang if we're run from inside gclient
- # 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)
+ print 'Access to gs://chrome-wintoolchain/ not configured.'
+ print '-----------------------------------------------------------------'
+ print
+ print 'You appear to be a Googler.'
+ print
+ print 'I\'m sorry for the hassle, but you need to do a one-time manual'
+ print 'authentication. Please run:'
+ print
+ 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
+ sys.stdout.flush()
+ sys.exit(1)
def DelayBeforeRemoving(target_dir):
@@ -197,6 +194,8 @@ def main():
# We assume that the Pro hash is the first one.
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
# the downloader script is.
@@ -211,11 +210,10 @@ def main():
current_hash = CalculateHash(target_dir)
if current_hash not in desired_hashes:
should_use_gs = False
- if (CanAccessToolchainBucket() or
- HaveSrcInternalAccess() or
- LooksLikeGoogler()):
+ if HaveSrcInternalAccess() or LooksLikeGoogler():
should_use_gs = True
- ConfigureGsAccess()
+ if not CanAccessToolchainBucket():
+ RequestGsAuthentication()
print('Windows toolchain out of date or doesn\'t exist, updating (%s)...' %
('Pro' if should_use_gs else 'Express'))
print(' current_hash: %s' % current_hash)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698