Index: third_party/instrumented_libraries/scripts/download_binaries.py |
diff --git a/third_party/instrumented_libraries/scripts/download_binaries.py b/third_party/instrumented_libraries/scripts/download_binaries.py |
index b7e87b2eda6f79270c8645d7eae50b58a1822ab1..fa339cc76badba3e450cbd2da826db301a64ec54 100755 |
--- a/third_party/instrumented_libraries/scripts/download_binaries.py |
+++ b/third_party/instrumented_libraries/scripts/download_binaries.py |
@@ -3,69 +3,34 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-"""Downloads pre-built sanitizer-instrumented third-party libraries from GCS.""" |
+"""Downloads pre-built sanitizer-instrumented third-party libraries from GCS. |
+This script should only be run from gn. |
Michael Achenbach
2017/03/28 07:55:05
Maybe differentiate: It's not run from gn, it's ru
|
+""" |
-import os |
-import re |
import subprocess |
import sys |
-SCRIPT_PATH = os.path.abspath(__file__) |
-BASE_PATH = os.path.normpath(os.path.join(SCRIPT_PATH, *(4 * ['..']))) |
- |
-# This defaults to the consuming project's base directory, e.g. 'src' in |
-# chromium. |
-BASE_DIR = os.path.basename(BASE_PATH) |
- |
- |
-def get_ubuntu_release(): |
- supported_releases = ['trusty'] |
- release = subprocess.check_output(['lsb_release', '-cs']).strip() |
- if release not in supported_releases: |
- raise Exception("Supported Ubuntu versions: %s", str(supported_releases)) |
- return release |
- |
- |
-def get_configuration(gyp_defines): |
- if re.search(r'\b(msan)=1', gyp_defines): |
- if 'msan_track_origins=0' in gyp_defines: |
- return 'msan-no-origins' |
- if 'msan_track_origins=2' in gyp_defines: |
- return 'msan-chained-origins' |
- if 'msan_track_origins=' not in gyp_defines: |
- # NB: must be the same as the default value in common.gypi |
- return 'msan-chained-origins' |
- raise Exception( |
- "Prebuilt instrumented libraries not available for your configuration.") |
- |
- |
-def get_archive_name(gyp_defines): |
- return "%s-%s.tgz" % (get_configuration(gyp_defines), get_ubuntu_release()) |
- |
- |
def main(args): |
- gyp_defines = os.environ.get('GYP_DEFINES', '') |
- if not 'use_prebuilt_instrumented_libraries=1' in gyp_defines: |
- return 0 |
- |
if not sys.platform.startswith('linux'): |
- raise Exception("'use_prebuilt_instrumented_libraries=1' requires Linux.") |
+ raise Exception("Prebuilt instrumented libraries require Linux.") |
- archive_name = get_archive_name(gyp_defines) |
- sha1file = '%s.sha1' % archive_name |
- target_directory = os.path.join( |
- BASE_DIR, 'third_party', 'instrumented_libraries', 'binaries') |
+ sha1file = args[0] |
+ tarfile = args[1] |
subprocess.check_call([ |
'download_from_google_storage', |
'--no_resume', |
'--no_auth', |
'--bucket', 'chromium-instrumented-libraries', |
- '-s', sha1file], cwd=target_directory) |
+ '-s', sha1file, '-o', tarfile]) |
return 0 |
if __name__ == '__main__': |
+ # TODO(thomasanderson): Remove this once all third_party DEPS |
+ # entires for this script are removed. |
+ if (len(sys.argv) == 1): |
+ sys.exit(0) |
sys.exit(main(sys.argv[1:])) |