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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 deps_content = fp.read() | 174 deps_content = fp.read() |
175 new_deps = deps_content.replace("'buildtools_revision':", | 175 new_deps = deps_content.replace("'buildtools_revision':", |
176 "'buildtools_revision': ") | 176 "'buildtools_revision': ") |
177 | 177 |
178 with open('DEPS', 'w') as fp: | 178 with open('DEPS', 'w') as fp: |
179 fp.write(new_deps) | 179 fp.write(new_deps) |
180 | 180 |
181 def WaitForBuildToFinish(self): | 181 def WaitForBuildToFinish(self): |
182 print('Checking build') | 182 print('Checking build') |
183 results = self.CheckBuild() | 183 results = self.CheckBuild() |
184 while any(r['state'] == 'pending' for r in results.values()): | 184 while (len(results) or |
| 185 any(r['state'] == 'pending' for r in results.values())): |
185 print() | 186 print() |
186 print('Sleeping for 30 seconds') | 187 print('Sleeping for 30 seconds') |
187 time.sleep(30) | 188 time.sleep(30) |
188 print('Checking build') | 189 print('Checking build') |
189 results = self.CheckBuild() | 190 results = self.CheckBuild() |
190 return 0 if all(r['state'] == 'success' for r in results.values()) else 1 | 191 return 0 if all(r['state'] == 'success' for r in results.values()) else 1 |
191 | 192 |
192 def CheckBuild(self): | 193 def CheckBuild(self): |
193 _, out, _ = self.Call('git-cl issue') | 194 _, out, _ = self.Call('git-cl issue') |
194 | 195 |
(...skipping 11 matching lines...) Expand all Loading... |
206 | 207 |
207 try: | 208 try: |
208 patchset_data = json.loads(rpc_server.Send('/api/%d/%d' % | 209 patchset_data = json.loads(rpc_server.Send('/api/%d/%d' % |
209 (issue, patchset))) | 210 (issue, patchset))) |
210 except Exception as _e: | 211 except Exception as _e: |
211 raise | 212 raise |
212 | 213 |
213 try_job_results = patchset_data['try_job_results'] | 214 try_job_results = patchset_data['try_job_results'] |
214 if not try_job_results: | 215 if not try_job_results: |
215 print('No try jobs found on most recent patchset') | 216 print('No try jobs found on most recent patchset') |
216 return 1 | 217 return {} |
217 | 218 |
218 results = {} | 219 results = {} |
219 for job in try_job_results: | 220 for job in try_job_results: |
220 builder = job['builder'] | 221 builder = job['builder'] |
221 if builder == 'linux_chromium_gn_upload': | 222 if builder == 'linux_chromium_gn_upload': |
222 platform = 'linux64' | 223 platform = 'linux64' |
223 elif builder == 'mac_chromium_gn_upload': | 224 elif builder == 'mac_chromium_gn_upload': |
224 platform = 'mac' | 225 platform = 'mac' |
225 elif builder == 'win8_chromium_gn_upload': | 226 elif builder == 'win8_chromium_gn_upload': |
226 platform = 'win' | 227 platform = 'win' |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 def Call(self, cmd, cwd=None): | 406 def Call(self, cmd, cwd=None): |
406 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, | 407 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, |
407 cwd=(cwd or self.chromium_src_dir)) | 408 cwd=(cwd or self.chromium_src_dir)) |
408 out, err = proc.communicate() | 409 out, err = proc.communicate() |
409 return proc.returncode, out, err | 410 return proc.returncode, out, err |
410 | 411 |
411 | 412 |
412 if __name__ == '__main__': | 413 if __name__ == '__main__': |
413 roller = GNRoller() | 414 roller = GNRoller() |
414 sys.exit(roller.Roll()) | 415 sys.exit(roller.Roll()) |
OLD | NEW |