| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Windows can't run .sh files, so this is a Python implementation of | 6 """Windows can't run .sh files, so this is a Python implementation of |
| 7 update.sh. This script should replace update.sh on all platforms eventually.""" | 7 update.sh. This script should replace update.sh on all platforms eventually.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import contextlib | 10 import contextlib |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 # Check if there's a prebuilt binary and if so just fetch that. That's | 397 # Check if there's a prebuilt binary and if so just fetch that. That's |
| 398 # faster, and goma relies on having matching binary hashes on client and | 398 # faster, and goma relies on having matching binary hashes on client and |
| 399 # server too. | 399 # server too. |
| 400 print 'Trying to download prebuilt clang' | 400 print 'Trying to download prebuilt clang' |
| 401 | 401 |
| 402 # clang packages are smaller than 50 MB, small enough to keep in memory. | 402 # clang packages are smaller than 50 MB, small enough to keep in memory. |
| 403 with contextlib.closing(cStringIO.StringIO()) as f: | 403 with contextlib.closing(cStringIO.StringIO()) as f: |
| 404 try: | 404 try: |
| 405 DownloadUrl(cds_full_url, f) | 405 DownloadUrl(cds_full_url, f) |
| 406 f.seek(0) | 406 f.seek(0) |
| 407 # TODO(thakis): Delete LLVM_BUILD_DIR before extracting. |
| 407 tarfile.open(mode='r:gz', fileobj=f).extractall(path=LLVM_BUILD_DIR) | 408 tarfile.open(mode='r:gz', fileobj=f).extractall(path=LLVM_BUILD_DIR) |
| 408 print 'clang %s unpacked' % PACKAGE_VERSION | 409 print 'clang %s unpacked' % PACKAGE_VERSION |
| 409 # Download the gold plugin if requested to by an environment variable. | 410 # Download the gold plugin if requested to by an environment variable. |
| 410 # This is used by the CFI ClusterFuzz bot. | 411 # This is used by the CFI ClusterFuzz bot. |
| 411 if 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ: | 412 if 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ: |
| 412 RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py']) | 413 RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py']) |
| 413 WriteStampFile(PACKAGE_VERSION) | 414 WriteStampFile(PACKAGE_VERSION) |
| 414 return 0 | 415 return 0 |
| 415 except urllib2.HTTPError: | 416 except urllib2.HTTPError: |
| 416 print 'Did not find prebuilt clang %s, building locally' % cds_file | 417 print 'Did not find prebuilt clang %s, building locally' % cds_file |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 763 |
| 763 args.force_local_build = True | 764 args.force_local_build = True |
| 764 # Skip local patches when using HEAD: they probably don't apply anymore. | 765 # Skip local patches when using HEAD: they probably don't apply anymore. |
| 765 args.with_patches = False | 766 args.with_patches = False |
| 766 | 767 |
| 767 return UpdateClang(args) | 768 return UpdateClang(args) |
| 768 | 769 |
| 769 | 770 |
| 770 if __name__ == '__main__': | 771 if __name__ == '__main__': |
| 771 sys.exit(main()) | 772 sys.exit(main()) |
| OLD | NEW |