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

Side by Side Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 1382873003: win_toolchain: Update packaging script to package win10 sdk (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: . Created 5 years, 2 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
« no previous file with comments | « no previous file | win_toolchain/package_from_installed.py » ('j') | 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 """Downloads and unpacks a toolchain for building on Windows. The contents are 6 """Downloads and unpacks a toolchain for building on Windows. The contents are
7 matched by sha1 which will be updated when the toolchain is updated. 7 matched by sha1 which will be updated when the toolchain is updated.
8 8
9 Having a toolchain script in depot_tools means that it's not versioned 9 Having a toolchain script in depot_tools means that it's not versioned
10 directly with the source code. That is, if the toolchain is upgraded, but 10 directly with the source code. That is, if the toolchain is upgraded, but
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 shutil.rmtree(path, ignore_errors=True) 196 shutil.rmtree(path, ignore_errors=True)
197 else: 197 else:
198 # shutil.rmtree() doesn't delete read-only files on Windows. 198 # shutil.rmtree() doesn't delete read-only files on Windows.
199 subprocess.check_call('rmdir /s/q "%s"' % path, shell=True) 199 subprocess.check_call('rmdir /s/q "%s"' % path, shell=True)
200 200
201 201
202 def DoTreeMirror(target_dir, tree_sha1): 202 def DoTreeMirror(target_dir, tree_sha1):
203 """In order to save temporary space on bots that do not have enough space to 203 """In order to save temporary space on bots that do not have enough space to
204 download ISOs, unpack them, and copy to the target location, the whole tree 204 download ISOs, unpack them, and copy to the target location, the whole tree
205 is uploaded as a zip to internal storage, and then mirrored here.""" 205 is uploaded as a zip to internal storage, and then mirrored here."""
206 temp_dir, local_zip = DownloadUsingGsutil(tree_sha1 + '.zip') 206 use_local_zip = bool(int(os.environ.get('USE_LOCAL_ZIP', 0)))
207 if use_local_zip:
208 temp_dir = None
209 local_zip = tree_sha1 + '.zip'
210 else:
211 temp_dir, local_zip = DownloadUsingGsutil(tree_sha1 + '.zip')
207 sys.stdout.write('Extracting %s...\n' % local_zip) 212 sys.stdout.write('Extracting %s...\n' % local_zip)
208 sys.stdout.flush() 213 sys.stdout.flush()
209 with zipfile.ZipFile(local_zip, 'r', zipfile.ZIP_DEFLATED, True) as zf: 214 with zipfile.ZipFile(local_zip, 'r', zipfile.ZIP_DEFLATED, True) as zf:
210 zf.extractall(target_dir) 215 zf.extractall(target_dir)
211 if temp_dir: 216 if temp_dir:
212 RmDir(temp_dir) 217 RmDir(temp_dir)
213 218
214 219
215 def main(): 220 def main():
216 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) 221 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 current_hash = CalculateHash(target_dir) 264 current_hash = CalculateHash(target_dir)
260 if current_hash not in desired_hashes: 265 if current_hash not in desired_hashes:
261 should_use_gs = False 266 should_use_gs = False
262 if (HaveSrcInternalAccess() or 267 if (HaveSrcInternalAccess() or
263 LooksLikeGoogler() or 268 LooksLikeGoogler() or
264 CanAccessToolchainBucket()): 269 CanAccessToolchainBucket()):
265 should_use_gs = True 270 should_use_gs = True
266 if not CanAccessToolchainBucket(): 271 if not CanAccessToolchainBucket():
267 RequestGsAuthentication() 272 RequestGsAuthentication()
268 if not should_use_gs: 273 if not should_use_gs:
269 print('Please follow the instructions at ' 274 print('\n\n\nPlease follow the instructions at '
270 'http://www.chromium.org/developers/how-tos/' 275 'https://www.chromium.org/developers/how-tos/'
271 'build-instructions-windows') 276 'build-instructions-windows\n\n')
272 return 1 277 return 1
273 print('Windows toolchain out of date or doesn\'t exist, updating (Pro)...') 278 print('Windows toolchain out of date or doesn\'t exist, updating (Pro)...')
274 print(' current_hash: %s' % current_hash) 279 print(' current_hash: %s' % current_hash)
275 print(' desired_hashes: %s' % ', '.join(desired_hashes)) 280 print(' desired_hashes: %s' % ', '.join(desired_hashes))
276 sys.stdout.flush() 281 sys.stdout.flush()
277 DelayBeforeRemoving(target_dir) 282 DelayBeforeRemoving(target_dir)
278 if sys.platform == 'win32': 283 if sys.platform == 'win32':
279 # This stays resident and will make the rmdir below fail. 284 # This stays resident and will make the rmdir below fail.
280 with open(os.devnull, 'wb') as nul: 285 with open(os.devnull, 'wb') as nul:
281 subprocess.call(['taskkill', '/f', '/im', 'mspdbsrv.exe'], 286 subprocess.call(['taskkill', '/f', '/im', 'mspdbsrv.exe'],
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 329
325 if options.output_json: 330 if options.output_json:
326 shutil.copyfile(os.path.join(target_dir, '..', 'data.json'), 331 shutil.copyfile(os.path.join(target_dir, '..', 'data.json'),
327 options.output_json) 332 options.output_json)
328 333
329 return 0 334 return 0
330 335
331 336
332 if __name__ == '__main__': 337 if __name__ == '__main__':
333 sys.exit(main()) 338 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | win_toolchain/package_from_installed.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698