| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 the V8 project authors. All rights reserved. | 2 # Copyright 2015 the V8 project authors. All rights reserved. |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Script to download LLVM gold plugin from google storage.""" | 7 """Script to download LLVM gold plugin from google storage.""" |
| 8 | 8 |
| 9 import json | 9 import json |
| 10 import os | 10 import os |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 # Bailout if this is not a cfi build. | 50 # Bailout if this is not a cfi build. |
| 51 print 'Skipping gold plugin download for non-cfi build.' | 51 print 'Skipping gold plugin download for non-cfi build.' |
| 52 return 0 | 52 return 0 |
| 53 if (os.path.exists(GOLD_PLUGIN_PATH) and | 53 if (os.path.exists(GOLD_PLUGIN_PATH) and |
| 54 update.ReadStampFile().strip() == update.PACKAGE_VERSION): | 54 update.ReadStampFile().strip() == update.PACKAGE_VERSION): |
| 55 # Bailout if clang is up-to-date. This requires the script to be run before | 55 # Bailout if clang is up-to-date. This requires the script to be run before |
| 56 # the clang update step! I.e. afterwards clang would always be up-to-date. | 56 # the clang update step! I.e. afterwards clang would always be up-to-date. |
| 57 print 'Skipping gold plugin download. File present and clang up to date.' | 57 print 'Skipping gold plugin download. File present and clang up to date.' |
| 58 return 0 | 58 return 0 |
| 59 | 59 |
| 60 # Make sure this works on empty checkouts (i.e. clang not downloaded yet). |
| 61 if not os.path.exists(LLVM_BUILD_PATH): |
| 62 os.makedirs(LLVM_BUILD_PATH) |
| 63 |
| 60 targz_name = 'llvmgold-%s.tgz' % CLANG_REVISION | 64 targz_name = 'llvmgold-%s.tgz' % CLANG_REVISION |
| 61 remote_path = '%s/%s' % (CLANG_BUCKET, targz_name) | 65 remote_path = '%s/%s' % (CLANG_BUCKET, targz_name) |
| 62 | 66 |
| 63 os.chdir(LLVM_BUILD_PATH) | 67 os.chdir(LLVM_BUILD_PATH) |
| 64 | 68 |
| 65 # TODO(pcc): Fix gsutil.py cp url file < /dev/null 2>&0 | 69 # TODO(pcc): Fix gsutil.py cp url file < /dev/null 2>&0 |
| 66 # (currently aborts with exit code 1, | 70 # (currently aborts with exit code 1, |
| 67 # https://github.com/GoogleCloudPlatform/gsutil/issues/289) or change the | 71 # https://github.com/GoogleCloudPlatform/gsutil/issues/289) or change the |
| 68 # stdin->stderr redirect in update.py to do something else (crbug.com/494442). | 72 # stdin->stderr redirect in update.py to do something else (crbug.com/494442). |
| 69 subprocess.check_call(['python', GSUTIL_PATH, | 73 subprocess.check_call(['python', GSUTIL_PATH, |
| 70 'cp', remote_path, targz_name], | 74 'cp', remote_path, targz_name], |
| 71 stderr=open('/dev/null', 'w')) | 75 stderr=open('/dev/null', 'w')) |
| 72 subprocess.check_call(['tar', 'xzf', targz_name]) | 76 subprocess.check_call(['tar', 'xzf', targz_name]) |
| 73 os.remove(targz_name) | 77 os.remove(targz_name) |
| 74 return 0 | 78 return 0 |
| 75 | 79 |
| 76 if __name__ == '__main__': | 80 if __name__ == '__main__': |
| 77 sys.exit(main()) | 81 sys.exit(main()) |
| OLD | NEW |