| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """An auto-roller for GN binaries into Chromium. | 5 """An auto-roller for GN binaries into Chromium. |
| 6 | 6 |
| 7 This script is used to update the GN binaries that a Chromium | 7 This script is used to update the GN binaries that a Chromium |
| 8 checkout uses. In order to update the binaries, one must follow | 8 checkout uses. In order to update the binaries, one must follow |
| 9 four steps in order: | 9 four steps in order: |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 raise | 203 raise |
| 204 | 204 |
| 205 patchset = int(props['patchsets'][-1]) | 205 patchset = int(props['patchsets'][-1]) |
| 206 | 206 |
| 207 try: | 207 try: |
| 208 patchset_data = json.loads(rpc_server.Send('/api/%d/%d' % | 208 patchset_data = json.loads(rpc_server.Send('/api/%d/%d' % |
| 209 (issue, patchset))) | 209 (issue, patchset))) |
| 210 except Exception as _e: | 210 except Exception as _e: |
| 211 raise | 211 raise |
| 212 | 212 |
| 213 TRY_JOB_RESULT_STATES = ('success', 'warnings', 'failure', 'skipped', | |
| 214 'exception', 'retry', 'pending') | |
| 215 try_job_results = patchset_data['try_job_results'] | 213 try_job_results = patchset_data['try_job_results'] |
| 216 if not try_job_results: | 214 if not try_job_results: |
| 217 print('No try jobs found on most recent patchset') | 215 print('No try jobs found on most recent patchset') |
| 218 return 1 | 216 return 1 |
| 219 | 217 |
| 220 results = {} | 218 results = {} |
| 221 for job in try_job_results: | 219 for job in try_job_results: |
| 222 builder = job['builder'] | 220 builder = job['builder'] |
| 223 if builder == 'linux_chromium_gn_upload': | 221 if builder == 'linux_chromium_gn_upload': |
| 224 platform = 'linux64' | 222 platform = 'linux64' |
| 225 elif builder == 'mac_chromium_gn_upload': | 223 elif builder == 'mac_chromium_gn_upload': |
| 226 platform = 'mac' | 224 platform = 'mac' |
| 227 elif builder == 'win8_chromium_gn_upload': | 225 elif builder == 'win8_chromium_gn_upload': |
| 228 platform = 'win' | 226 platform = 'win' |
| 229 else: | 227 else: |
| 230 print('Unexpected builder: %s') | 228 print('Unexpected builder: %s') |
| 231 continue | 229 continue |
| 232 | 230 |
| 233 state = TRY_JOB_RESULT_STATES[int(job['result'])] | 231 TRY_JOB_RESULT_STATES = ('started', 'success', 'warnings', 'failure', |
| 232 'skipped', 'exception', 'retry', 'pending') |
| 233 state = TRY_JOB_RESULT_STATES[int(job['result']) + 1] |
| 234 url_str = ' %s' % job['url'] | 234 url_str = ' %s' % job['url'] |
| 235 build = url_str.split('/')[-1] | 235 build = url_str.split('/')[-1] |
| 236 | 236 |
| 237 sha1 = '-' | 237 sha1 = '-' |
| 238 results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str}) | 238 results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str}) |
| 239 | 239 |
| 240 if state == 'success': | 240 if state == 'success': |
| 241 jsurl = url_str.replace('/builders/', '/json/builders/') | 241 jsurl = url_str.replace('/builders/', '/json/builders/') |
| 242 fp = urllib2.urlopen(jsurl) | 242 fp = urllib2.urlopen(jsurl) |
| 243 js = json.loads(fp.read()) | 243 js = json.loads(fp.read()) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 def Call(self, cmd, cwd=None): | 405 def Call(self, cmd, cwd=None): |
| 406 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, | 406 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, |
| 407 cwd=(cwd or self.chromium_src_dir)) | 407 cwd=(cwd or self.chromium_src_dir)) |
| 408 out, err = proc.communicate() | 408 out, err = proc.communicate() |
| 409 return proc.returncode, out, err | 409 return proc.returncode, out, err |
| 410 | 410 |
| 411 | 411 |
| 412 if __name__ == '__main__': | 412 if __name__ == '__main__': |
| 413 roller = GNRoller() | 413 roller = GNRoller() |
| 414 sys.exit(roller.Roll()) | 414 sys.exit(roller.Roll()) |
| OLD | NEW |