| 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 """A tool to extract a build, executed by a buildbot slave. | 6 """A tool to extract a build, executed by a buildbot slave. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 abs_webkit_dir = None | 71 abs_webkit_dir = None |
| 72 if options.webkit_dir: | 72 if options.webkit_dir: |
| 73 abs_webkit_dir = os.path.join(abs_build_dir, '..', options.webkit_dir) | 73 abs_webkit_dir = os.path.join(abs_build_dir, '..', options.webkit_dir) |
| 74 base_filename, version_suffix = slave_utils.GetZipFileNames( | 74 base_filename, version_suffix = slave_utils.GetZipFileNames( |
| 75 options.build_properties, abs_build_dir, abs_webkit_dir, extract=True) | 75 options.build_properties, abs_build_dir, abs_webkit_dir, extract=True) |
| 76 | 76 |
| 77 replace_dict = dict(options.build_properties) | 77 replace_dict = dict(options.build_properties) |
| 78 # If builddir isn't specified, assume buildbot used the builder name | 78 # If builddir isn't specified, assume buildbot used the builder name |
| 79 # as the root folder for the build. | 79 # as the root folder for the build. |
| 80 if not replace_dict.get('parent_builddir'): | 80 if not replace_dict.get('parent_builddir') and replace_dict.get('parentname'): |
| 81 replace_dict['parent_builddir'] = replace_dict['parentname'] | 81 replace_dict['parent_builddir'] = replace_dict.get('parentname', '') |
| 82 replace_dict['base_filename'] = base_filename | 82 replace_dict['base_filename'] = base_filename |
| 83 url = options.build_url or options.factory_properties.get('build_url') | 83 url = options.build_url or options.factory_properties.get('build_url') |
| 84 if not url: | 84 if not url: |
| 85 url = ('http://%(parentslavename)s/b/build/slave/%(parent_builddir)s/' | 85 url = ('http://%(parentslavename)s/b/build/slave/%(parent_builddir)s/' |
| 86 'chrome_staging') | 86 'chrome_staging') |
| 87 if url[-4:] != '.zip': # assume filename not specified | 87 if url[-4:] != '.zip': # assume filename not specified |
| 88 url = os.path.join(url, '%(base_filename)s.zip') | 88 # Append the filename to the base URL. First strip any trailing slashes. |
| 89 url = url.rstrip('/') |
| 90 url = '%s/%s' % (url, '%(base_filename)s.zip') |
| 89 url = url % replace_dict | 91 url = url % replace_dict |
| 90 | 92 |
| 91 versioned_url = url.replace('.zip', version_suffix + '.zip') | 93 versioned_url = url.replace('.zip', version_suffix + '.zip') |
| 92 return url, versioned_url | 94 return url, versioned_url |
| 93 | 95 |
| 94 | 96 |
| 95 def real_main(options): | 97 def real_main(options): |
| 96 """ Download a build, extract it to build\BuildDir\full-build-win32 | 98 """ Download a build, extract it to build\BuildDir\full-build-win32 |
| 97 and rename it to build\BuildDir\Target | 99 and rename it to build\BuildDir\Target |
| 98 """ | 100 """ |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if not options.target: | 237 if not options.target: |
| 236 options.target = options.factory_properties.get('target', 'Release') | 238 options.target = options.factory_properties.get('target', 'Release') |
| 237 if not options.webkit_dir: | 239 if not options.webkit_dir: |
| 238 options.webkit_dir = options.factory_properties.get('webkit_dir') | 240 options.webkit_dir = options.factory_properties.get('webkit_dir') |
| 239 | 241 |
| 240 return real_main(options) | 242 return real_main(options) |
| 241 | 243 |
| 242 | 244 |
| 243 if '__main__' == __name__: | 245 if '__main__' == __name__: |
| 244 sys.exit(main()) | 246 sys.exit(main()) |
| OLD | NEW |