| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2014 The Native Client 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 import argparse | 6 import argparse |
| 7 import os | 7 import os |
| 8 import subprocess | 8 import subprocess |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 12 import pynacl.platform | 12 import pynacl.platform |
| 13 | 13 |
| 14 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 14 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 15 NACL_DIR = os.path.dirname(SCRIPT_DIR) | 15 NACL_DIR = os.path.dirname(SCRIPT_DIR) |
| 16 BUILD_DIR = os.path.join(NACL_DIR, 'build') | 16 BUILD_DIR = os.path.join(NACL_DIR, 'build') |
| 17 | 17 |
| 18 PACKAGE_VERSION_DIR = os.path.join(BUILD_DIR, 'package_version') | 18 PACKAGE_VERSION_DIR = os.path.join(BUILD_DIR, 'package_version') |
| 19 PACKAGE_VERSION_SCRIPT = os.path.join(PACKAGE_VERSION_DIR, 'package_version.py') | 19 PACKAGE_VERSION_SCRIPT = os.path.join(PACKAGE_VERSION_DIR, 'package_version.py') |
| 20 | 20 |
| 21 | 21 |
| 22 def UploadPackages(filename, is_try): | 22 def UploadPackages(filename, is_try, is_sanitizer=False): |
| 23 """ Upload packages to Google Storage. | 23 """ Upload packages to Google Storage. |
| 24 | 24 |
| 25 Args: | 25 Args: |
| 26 filename: File to read package descriptions from. | 26 filename: File to read package descriptions from. |
| 27 is_try: True if the run is for a trybot, False if for a real buildbot. | 27 is_try: True if the run is for a trybot, False if for a real buildbot. |
| 28 is_sanitizer: True if building with a sanitizer. |
| 28 """ | 29 """ |
| 29 print '@@@BUILD_STEP upload_package_info@@@' | 30 print '@@@BUILD_STEP upload_package_info@@@' |
| 30 sys.stdout.flush() | 31 sys.stdout.flush() |
| 31 | 32 |
| 33 buildbot_buildername = os.getenv('BUILDBOT_BUILDERNAME', None) |
| 34 if buildbot_buildername is None: |
| 35 print 'Error - could not obtain buildbot builder name' |
| 36 sys.exit(1) |
| 32 if not is_try: | 37 if not is_try: |
| 33 buildbot_revision = os.getenv('BUILDBOT_GOT_REVISION', None) | 38 buildbot_revision = os.getenv('BUILDBOT_GOT_REVISION', None) |
| 34 if buildbot_revision is None: | 39 if buildbot_revision is None: |
| 35 print 'Error - Could not obtain buildbot revision number' | 40 print 'Error - Could not obtain buildbot revision number' |
| 36 sys.exit(1) | 41 sys.exit(1) |
| 37 upload_rev = buildbot_revision | 42 if is_sanitizer: |
| 43 upload_rev = '%s/%s' % (buildbot_buildername, buildbot_revision) |
| 44 else: |
| 45 upload_rev = buildbot_revision |
| 38 upload_args = [] | 46 upload_args = [] |
| 39 else: | 47 else: |
| 40 buildbot_buildername = os.getenv('BUILDBOT_BUILDERNAME', None) | |
| 41 if buildbot_buildername is None: | |
| 42 print 'Error - could not obtain buildbot builder name' | |
| 43 sys.exit(1) | |
| 44 buildbot_buildnumber = os.getenv('BUILDBOT_BUILDNUMBER', None) | 48 buildbot_buildnumber = os.getenv('BUILDBOT_BUILDNUMBER', None) |
| 45 if buildbot_buildnumber is None: | 49 if buildbot_buildnumber is None: |
| 46 print 'Error - could not obtain buildbot build number' | 50 print 'Error - could not obtain buildbot build number' |
| 47 sys.exit(1) | 51 sys.exit(1) |
| 48 upload_rev = '%s/%s' % (buildbot_buildername, buildbot_buildnumber) | 52 upload_rev = '%s/%s' % (buildbot_buildername, buildbot_buildnumber) |
| 49 upload_args = ['--cloud-bucket', 'nativeclient-trybot/packages'] | 53 upload_args = ['--cloud-bucket', 'nativeclient-trybot/packages'] |
| 50 | 54 |
| 51 with open(filename, 'rt') as f: | 55 with open(filename, 'rt') as f: |
| 52 for package_file in f.readlines(): | 56 for package_file in f.readlines(): |
| 53 package_file = package_file.strip() | 57 package_file = package_file.strip() |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 ExtractPackages(arguments.packages_file, | 149 ExtractPackages(arguments.packages_file, |
| 146 overlay_packages=arguments.overlay_packages, | 150 overlay_packages=arguments.overlay_packages, |
| 147 skip_missing=arguments.skip_missing) | 151 skip_missing=arguments.skip_missing) |
| 148 return 0 | 152 return 0 |
| 149 | 153 |
| 150 print 'Unknown Command:', arguments.command | 154 print 'Unknown Command:', arguments.command |
| 151 return 1 | 155 return 1 |
| 152 | 156 |
| 153 if __name__ == '__main__': | 157 if __name__ == '__main__': |
| 154 sys.exit(main(sys.argv[1:])) | 158 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |