Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
|
borenet
2014/01/09 19:27:28
Use the local codereview.settings file rather than
| |
| 2 | 2 |
| 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 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 | 7 |
| 8 """ | 8 """ |
| 9 submit_try: Submit a try request. | 9 submit_try: Submit a try request. |
| 10 | 10 |
| 11 This is a thin wrapper around the try request utilities in depot_tools which | 11 This is a thin wrapper around the try request utilities in depot_tools which |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 35 | 35 |
| 36 ALL_ALIASES = [ALL_BUILDERS, COMPILE_BUILDERS, CQ_BUILDERS, REGEX] | 36 ALL_ALIASES = [ALL_BUILDERS, COMPILE_BUILDERS, CQ_BUILDERS, REGEX] |
| 37 | 37 |
| 38 # Contact information for the build master. | 38 # Contact information for the build master. |
| 39 SKIA_BUILD_MASTER_HOST = str(buildbot_globals.Get('public_master_host')) | 39 SKIA_BUILD_MASTER_HOST = str(buildbot_globals.Get('public_master_host')) |
| 40 SKIA_BUILD_MASTER_PORT = str(buildbot_globals.Get('public_external_port')) | 40 SKIA_BUILD_MASTER_PORT = str(buildbot_globals.Get('public_external_port')) |
| 41 | 41 |
| 42 # All try builders have this suffix. | 42 # All try builders have this suffix. |
| 43 TRYBOT_SUFFIX = '-Trybot' | 43 TRYBOT_SUFFIX = '-Trybot' |
| 44 | 44 |
| 45 # Location of the codereview.settings file in the Skia repo. | |
| 46 SKIA_URL = 'skia.googlecode.com' | |
| 47 CODEREVIEW_SETTINGS = '/svn/codereview.settings' | |
| 48 | |
| 49 # String for matching the svn url of the try server inside codereview.settings. | 45 # String for matching the svn url of the try server inside codereview.settings. |
| 50 TRYSERVER_SVN_URL = 'TRYSERVER_SVN_URL: ' | 46 TRYSERVER_SVN_URL = 'TRYSERVER_SVN_URL: ' |
| 51 | 47 |
| 52 # Strings used for matching svn config properties. | 48 # Strings used for matching svn config properties. |
| 53 URL_STR = 'URL' | 49 URL_STR = 'URL' |
| 54 REPO_ROOT_STR = 'Repository Root' | 50 REPO_ROOT_STR = 'Repository Root' |
| 55 | 51 |
| 56 | 52 |
| 57 def FindDepotTools(): | 53 def FindDepotTools(): |
| 58 """ Find depot_tools on the local machine and return its location. """ | 54 """ Find depot_tools on the local machine and return its location. """ |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 85 else: | 81 else: |
| 86 cmd = ['git', 'rev-parse', '--show-toplevel'] | 82 cmd = ['git', 'rev-parse', '--show-toplevel'] |
| 87 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, | 83 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
| 88 stderr=subprocess.STDOUT) | 84 stderr=subprocess.STDOUT) |
| 89 if proc.wait() != 0: | 85 if proc.wait() != 0: |
| 90 raise Exception('Couldn\'t find checkout root!') | 86 raise Exception('Couldn\'t find checkout root!') |
| 91 return os.path.basename(proc.communicate()[0]) | 87 return os.path.basename(proc.communicate()[0]) |
| 92 | 88 |
| 93 | 89 |
| 94 def GetTryRepo(): | 90 def GetTryRepo(): |
| 95 """ Determine the TRYSERVER_SVN_URL from the codereview.settings file in the | 91 """Determine the TRYSERVER_SVN_URL from the codereview.settings file.""" |
| 96 Skia repo. """ | 92 codereview_settings_file = os.path.join(os.path.dirname(__file__), os.pardir, |
| 97 connection = httplib.HTTPConnection(SKIA_URL) | 93 'codereview.settings') |
| 98 connection.request('GET', CODEREVIEW_SETTINGS) | 94 with open(codereview_settings_file) as f: |
| 99 content = connection.getresponse().read() | 95 for line in f: |
| 100 for line in content.split('\n'): | 96 if line.startswith(TRYSERVER_SVN_URL): |
| 101 if line.startswith(TRYSERVER_SVN_URL): | 97 return line[len(TRYSERVER_SVN_URL):].rstrip() |
| 102 return line[len(TRYSERVER_SVN_URL):].rstrip() | |
| 103 raise Exception('Couldn\'t determine the TRYSERVER_SVN_URL. Make sure it is ' | 98 raise Exception('Couldn\'t determine the TRYSERVER_SVN_URL. Make sure it is ' |
| 104 'defined in the %s file.' % CODEREVIEW_SETTINGS) | 99 'defined in the %s file.' % codereview_settings_file) |
| 105 | 100 |
| 106 | 101 |
| 107 def RetrieveTrybotList(json_filename): | 102 def RetrieveTrybotList(json_filename): |
| 108 """ Retrieve the list of known trybots from the build master, stripping | 103 """ Retrieve the list of known trybots from the build master, stripping |
| 109 TRYBOT_SUFFIX from the name. """ | 104 TRYBOT_SUFFIX from the name. """ |
| 110 trybots = [] | 105 trybots = [] |
| 111 connection = httplib.HTTPConnection(SKIA_BUILD_MASTER_HOST, | 106 connection = httplib.HTTPConnection(SKIA_BUILD_MASTER_HOST, |
| 112 SKIA_BUILD_MASTER_PORT) | 107 SKIA_BUILD_MASTER_PORT) |
| 113 connection.request('GET', '/json/%s' % json_filename) | 108 connection.request('GET', '/json/%s' % json_filename) |
| 114 response = connection.getresponse() | 109 response = connection.getresponse() |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 | 287 |
| 293 # Parse and validate the command-line arguments. | 288 # Parse and validate the command-line arguments. |
| 294 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) | 289 args = ValidateArgs(sys.argv[1:], trybots=trybots, is_svn=is_svn) |
| 295 | 290 |
| 296 # Submit the try request. | 291 # Submit the try request. |
| 297 SubmitTryRequest(args, is_svn=is_svn) | 292 SubmitTryRequest(args, is_svn=is_svn) |
| 298 | 293 |
| 299 | 294 |
| 300 if __name__ == '__main__': | 295 if __name__ == '__main__': |
| 301 sys.exit(main()) | 296 sys.exit(main()) |
| OLD | NEW |