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

Side by Side Diff: win_toolchain/toolchain2013.py

Issue 148613003: Pull toolchain isos from gs:// when on bots (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Extracts a Windows VS2013 toolchain from various downloadable pieces.""" 6 """Extracts a Windows VS2013 toolchain from various downloadable pieces."""
7 7
8 8
9 import ctypes 9 import ctypes
10 import optparse 10 import optparse
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 sys.stdout.write('Cleaning up temporaries...\n') 49 sys.stdout.write('Cleaning up temporaries...\n')
50 for temp in g_temp_dirs: 50 for temp in g_temp_dirs:
51 # shutil.rmtree errors out on read only attributes. 51 # shutil.rmtree errors out on read only attributes.
52 RunOrDie('rmdir /s/q "%s"' % temp) 52 RunOrDie('rmdir /s/q "%s"' % temp)
53 g_temp_dirs = [] 53 g_temp_dirs = []
54 54
55 55
56 def GetIsoUrl(pro): 56 def GetIsoUrl(pro):
57 """Gets the .iso URL. 57 """Gets the .iso URL.
58 58
59 If |pro| is False, downloads the Express edition. 59 If |pro| is False, downloads the Express edition. If |CHROME_HEADLESS| is
60 set in the environment, then we assume we're on an internal bot, and download
61 from internal google storage instead.
60 """ 62 """
61 prefix = 'http://download.microsoft.com/download/' 63 prefix = 'http://download.microsoft.com/download/'
62 if pro: 64 if pro:
63 return (prefix + 65 return (prefix +
64 'A/F/1/AF128362-A6A8-4DB3-A39A-C348086472CC/VS2013_RTM_PRO_ENU.iso') 66 'A/F/1/AF128362-A6A8-4DB3-A39A-C348086472CC/VS2013_RTM_PRO_ENU.iso')
65 else: 67 else:
66 return (prefix + 68 return (prefix +
67 '7/2/E/72E0F986-D247-4289-B9DC-C4FB07374894/VS2013_RTM_DskExp_ENU.iso') 69 '7/2/E/72E0F986-D247-4289-B9DC-C4FB07374894/VS2013_RTM_DskExp_ENU.iso')
68 70
69 71
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 rc = os.system(target_path + ' /quiet ' 148 rc = os.system(target_path + ' /quiet '
147 '/features OptionId.WindowsDesktopDebuggers ' 149 '/features OptionId.WindowsDesktopDebuggers '
148 '/layout ' + standalone_path) 150 '/layout ' + standalone_path)
149 if rc == 0: 151 if rc == 0:
150 return standalone_path 152 return standalone_path
151 count += 1 153 count += 1
152 sys.stdout.write('Windows 8 SDK failed to download, retrying.\n') 154 sys.stdout.write('Windows 8 SDK failed to download, retrying.\n')
153 raise SystemExit("After multiple retries, couldn't download Win8 SDK") 155 raise SystemExit("After multiple retries, couldn't download Win8 SDK")
154 156
155 157
158 def DownloadUsingGsutil(filename):
159 """Downloads the given file from Google Storage chrome-wintoolchain bucket."""
160 temp_dir = TempDir()
161 assert os.path.basename(filename) == filename
162 target_path = os.path.join(temp_dir, filename)
163 RunOrDie([
Ryan Tseng 2014/01/28 00:19:43 can use import download_from_google_storage ...
scottmg 2014/01/28 00:38:28 Thanks, done. Is os.devnull OK for boto_path? Tha
164 sys.executable,
165 os.path.join(BASEDIR, '..', 'third_party', 'gsutil', 'gsutil'),
166 'cp',
167 'gs://chrome-wintoolchain/' + filename,
168 target_path])
169 return target_path
170
171
172 def GetVSInternal():
173 """Uses gsutil to pull the toolchain from internal Google Storage bucket."""
174 return DownloadUsingGsutil('VS2013_RTM_PRO_ENU.iso')
175
176
177 def GetSDKInternal():
178 """Downloads a zipped copy of the SDK from internal Google Storage bucket,
179 and extracts it."""
180 zip_file = DownloadUsingGsutil('Standalone.zip')
181 return ExtractIso(zip_file)
182
183
156 class SourceImages(object): 184 class SourceImages(object):
157 def __init__(self, vs_path, sdk8_path): 185 def __init__(self, vs_path, sdk8_path):
158 self.vs_path = vs_path 186 self.vs_path = vs_path
159 self.sdk8_path = sdk8_path 187 self.sdk8_path = sdk8_path
160 188
161 189
162 def GetSourceImages(local_dir, pro): 190 def GetSourceImages(local_dir, pro):
163 url = GetIsoUrl(pro) 191 url = GetIsoUrl(pro)
164 if local_dir: 192 if os.environ.get('CHROME_HEADLESS'):
193 return SourceImages(GetVSInternal(), GetSDKInternal())
194 elif local_dir:
165 return SourceImages(os.path.join(local_dir, os.path.basename(url)), 195 return SourceImages(os.path.join(local_dir, os.path.basename(url)),
166 os.path.join(local_dir, 'Standalone')) 196 os.path.join(local_dir, 'Standalone'))
167 else: 197 else:
168 # Note that we do the SDK first, as it might cause an elevation prompt. 198 # Note that we do the SDK first, as it might cause an elevation prompt.
169 sdk8_path = DownloadSDK8() 199 sdk8_path = DownloadSDK8()
170 vs_path = DownloadMainIso(url) 200 vs_path = DownloadMainIso(url)
171 return SourceImages(vs_path, sdk8_path) 201 return SourceImages(vs_path, sdk8_path)
172 202
173 203
174 def ExtractMsiList(root_dir, packages): 204 def ExtractMsiList(root_dir, packages):
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 CopyToFinalLocation(extracted, target_dir) 364 CopyToFinalLocation(extracted, target_dir)
335 365
336 GenerateSetEnvCmd(target_dir, not options.express) 366 GenerateSetEnvCmd(target_dir, not options.express)
337 finally: 367 finally:
338 if options.clean: 368 if options.clean:
339 DeleteAllTempDirs() 369 DeleteAllTempDirs()
340 370
341 371
342 if __name__ == '__main__': 372 if __name__ == '__main__':
343 sys.exit(main()) 373 sys.exit(main())
OLDNEW
« 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