| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 ret = 0 if all(r['state'] == 'success' for r in results.values()) else 1 | 193 ret = 0 if all(r['state'] == 'success' for r in results.values()) else 1 |
| 194 if ret: | 194 if ret: |
| 195 print('Build failed.') | 195 print('Build failed.') |
| 196 else: | 196 else: |
| 197 print('Builds ready.') | 197 print('Builds ready.') |
| 198 | 198 |
| 199 # Close the build CL and move off of the build branch back to whatever | 199 # Close the build CL and move off of the build branch back to whatever |
| 200 # we were on before. | 200 # we were on before. |
| 201 self.Call('git-cl set-close') | 201 self.Call('git-cl set-close') |
| 202 self.MovetoLastHead() | 202 self.MoveToLastHead() |
| 203 | 203 |
| 204 return ret | 204 return ret |
| 205 | 205 |
| 206 def CheckBuild(self): | 206 def CheckBuild(self): |
| 207 _, out, _ = self.Call('git-cl issue') | 207 _, out, _ = self.Call('git-cl issue') |
| 208 | 208 |
| 209 issue = int(out.split()[2]) | 209 issue = int(out.split()[2]) |
| 210 | 210 |
| 211 _, out, _ = self.Call('git config user.email') | 211 _, out, _ = self.Call('git config user.email') |
| 212 email = '' | 212 email = '' |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 finally: | 368 finally: |
| 369 os.remove(desc_file.name) | 369 os.remove(desc_file.name) |
| 370 | 370 |
| 371 # Move off of the roll branch onto whatever we were on before. | 371 # Move off of the roll branch onto whatever we were on before. |
| 372 # Do not explicitly close the roll CL issue, however; the CQ | 372 # Do not explicitly close the roll CL issue, however; the CQ |
| 373 # will close it when the roll lands, assuming it does so. | 373 # will close it when the roll lands, assuming it does so. |
| 374 self.MoveToLastHead() | 374 self.MoveToLastHead() |
| 375 | 375 |
| 376 return 0 | 376 return 0 |
| 377 | 377 |
| 378 def MovetoLastHead(self): | 378 def MoveToLastHead(self): |
| 379 _, out, _ = self.Call('git reflog -1') | 379 # When this is called, there will be a commit + a checkout as |
| 380 m = re.match('moving from ([^\s]+)', out) | 380 # the two most recent entries in the reflog, assuming nothing as |
| 381 # modified the repo while this script has been running. |
| 382 _, out, _ = self.Call('git reflog -2') |
| 383 m = re.search('moving from ([^\s]+)', out) |
| 381 last_head = m.group(1) | 384 last_head = m.group(1) |
| 382 self.Call('git checkout %s' % last_head) | 385 self.Call('git checkout %s' % last_head) |
| 383 | 386 |
| 384 def GetBuildtoolsDesc(self): | 387 def GetBuildtoolsDesc(self): |
| 385 gn_changes = self.GetGNChanges() | 388 gn_changes = self.GetGNChanges() |
| 386 return ( | 389 return ( |
| 387 'Roll gn %s..%s (r%s:r%s)\n' | 390 'Roll gn %s..%s (r%s:r%s)\n' |
| 388 '\n' | 391 '\n' |
| 389 '%s' | 392 '%s' |
| 390 '\n' | 393 '\n' |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 def Call(self, cmd, cwd=None): | 434 def Call(self, cmd, cwd=None): |
| 432 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, | 435 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, |
| 433 cwd=(cwd or self.chromium_src_dir)) | 436 cwd=(cwd or self.chromium_src_dir)) |
| 434 out, err = proc.communicate() | 437 out, err = proc.communicate() |
| 435 return proc.returncode, out, err | 438 return proc.returncode, out, err |
| 436 | 439 |
| 437 | 440 |
| 438 if __name__ == '__main__': | 441 if __name__ == '__main__': |
| 439 roller = GNRoller() | 442 roller = GNRoller() |
| 440 sys.exit(roller.Roll()) | 443 sys.exit(roller.Roll()) |
| OLD | NEW |