Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Downloads pre-built sanitizer-instrumented third-party libraries from GCS.""" | |
| 7 | |
| 8 import os | |
| 9 import subprocess | |
| 10 import sys | |
| 11 | |
| 12 def get_ubuntu_release(): | |
| 13 supported_releases = ['precise', 'trusty'] | |
| 14 release = subprocess.check_output(['lsb_release', '-cs']).strip() | |
| 15 if release not in supported_releases: | |
| 16 raise Exception("Supported Ubuntu versions: %s", str(supported_releases)) | |
| 17 return release | |
| 18 | |
| 19 | |
| 20 def get_configuration(gyp_defines): | |
| 21 if 'msan=1' in gyp_defines: | |
| 22 if 'msan_track_origins=2' in gyp_defines: | |
|
Nico
2015/03/19 18:31:00
do we need to support multiple modes for this? can
earthdok
2015/03/23 13:02:56
We may want to support track_origins=0. It's used
Nico
2015/03/23 16:35:09
If there's only one mode, where would the abi inco
| |
| 23 return 'msan-chained-origins' | |
| 24 if 'msan_track_origins' not in gyp_defines: | |
| 25 # NB: must be the same as the default value in common.gypi | |
| 26 return 'msan-chained-origins' | |
| 27 raise Exception( | |
| 28 "Prebuilt instrumented libraries not available for your configuration.") | |
| 29 | |
| 30 | |
| 31 def get_archive_name(gyp_defines): | |
| 32 return "%s-%s.tgz" % (get_configuration(gyp_defines), get_ubuntu_release()) | |
| 33 | |
| 34 | |
| 35 def main(args): | |
| 36 gyp_defines = os.environ.get('GYP_DEFINES', '') | |
| 37 if not 'use_prebuilt_instrumented_libraries=1' in gyp_defines: | |
| 38 return 0 | |
| 39 | |
|
Nico
2015/03/19 18:31:00
error out here if not on linux?
earthdok
2015/03/23 13:02:56
Done.
| |
| 40 archive_name = get_archive_name(gyp_defines) | |
| 41 sha1file = '%s.sha1' % archive_name | |
| 42 target_directory = 'src/third_party/instrumented_libraries/binaries/' | |
| 43 | |
| 44 subprocess.check_call([ | |
| 45 'download_from_google_storage', | |
| 46 '--no_resume', | |
| 47 '--no_auth', | |
| 48 '--bucket', 'chromium-instrumented-libraries', | |
| 49 '-s', sha1file], cwd=target_directory) | |
| 50 | |
| 51 return 0 | |
| 52 | |
| 53 | |
| 54 if __name__ == '__main__': | |
| 55 sys.exit(main(sys.argv[1:])) | |
| OLD | NEW |