Commit 513d9488 authored by dpranke's avatar dpranke Committed by Commit bot

Fix various issues in the roll_gn script.

This patch address a bunch of issues people have found in the roll_gn script:

- Fixes yet another bug where we weren't waiting for the try jobs
  to finish.
- Fixes a bug where we were adding an extra '\n' onto the DEPS file
  in the final roll CL.
- Closes the 'build_gn' CL once the build has completed.
- Adds better logging at the end of the 'wait' and 'roll_buildtools' steps.
- Removes mac_chromium_gn_rel from CQ_EXTRA_TRYBOTS, since
  it is part of the default set now.

R=brettw@chromium.org, andybons@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1372203003

Cr-Commit-Position: refs/heads/master@{#351141}
parent b07a99f3
...@@ -182,13 +182,26 @@ class GNRoller(object): ...@@ -182,13 +182,26 @@ class GNRoller(object):
print('Checking build') print('Checking build')
results = self.CheckBuild() results = self.CheckBuild()
while (len(results) < 3 or while (len(results) < 3 or
any(r['state'] == 'pending' for r in results.values())): any(r['state'] in ('pending', 'started')
for r in results.values())):
print() print()
print('Sleeping for 30 seconds') print('Sleeping for 30 seconds')
time.sleep(30) time.sleep(30)
print('Checking build') print('Checking build')
results = self.CheckBuild() results = self.CheckBuild()
return 0 if all(r['state'] == 'success' for r in results.values()) else 1
ret = 0 if all(r['state'] == 'success' for r in results.values()) else 1
if ret:
print('Build failed.')
else:
print('Builds ready.')
# Close the build CL and move off of the build branch back to whatever
# we were on before.
self.Call('git-cl set-close')
self.MovetoLastHead()
return ret
def CheckBuild(self): def CheckBuild(self):
_, out, _ = self.Call('git-cl issue') _, out, _ = self.Call('git-cl issue')
...@@ -264,7 +277,8 @@ class GNRoller(object): ...@@ -264,7 +277,8 @@ class GNRoller(object):
def RollBuildtools(self): def RollBuildtools(self):
results = self.CheckBuild() results = self.CheckBuild()
if not all(r['state'] == 'success' for r in results.values()): if (len(results) < 3 or
not all(r['state'] == 'success' for r in results.values())):
print("Roll isn't done or didn't succeed, exiting:") print("Roll isn't done or didn't succeed, exiting:")
return 1 return 1
...@@ -306,6 +320,11 @@ class GNRoller(object): ...@@ -306,6 +320,11 @@ class GNRoller(object):
# merged branch. # merged branch.
self.Call('git checkout origin/master', cwd=self.buildtools_dir) self.Call('git checkout origin/master', cwd=self.buildtools_dir)
_, out, _ = self.Call('git rev-parse origin/master',
cwd=self.buildtools_dir)
new_buildtools_commitish = out.strip()
print('Ready to roll buildtools to %s in DEPS' % new_buildtools_commitish)
return 0 return 0
def RollDEPS(self): def RollDEPS(self):
...@@ -336,7 +355,7 @@ class GNRoller(object): ...@@ -336,7 +355,7 @@ class GNRoller(object):
return 1 return 1
with open('DEPS', 'w') as fp: with open('DEPS', 'w') as fp:
fp.write(''.join(new_deps_lines) + '\n') fp.write(''.join(new_deps_lines))
desc = self.GetDEPSRollDesc(old_buildtools_commitish, desc = self.GetDEPSRollDesc(old_buildtools_commitish,
new_buildtools_commitish) new_buildtools_commitish)
...@@ -349,11 +368,19 @@ class GNRoller(object): ...@@ -349,11 +368,19 @@ class GNRoller(object):
finally: finally:
os.remove(desc_file.name) os.remove(desc_file.name)
# Intentionally leave the src checkout on the new branch with the roll # Move off of the roll branch onto whatever we were on before.
# since we're not auto-committing it. # Do not explicitly close the roll CL issue, however; the CQ
# will close it when the roll lands, assuming it does so.
self.MoveToLastHead()
return 0 return 0
def MovetoLastHead(self):
_, out, _ = self.Call('git reflog -1')
m = re.match('moving from ([^\s]+)', out)
last_head = m.group(1)
self.Call('git checkout %s' % last_head)
def GetBuildtoolsDesc(self): def GetBuildtoolsDesc(self):
gn_changes = self.GetGNChanges() gn_changes = self.GetGNChanges()
return ( return (
...@@ -382,8 +409,7 @@ class GNRoller(object): ...@@ -382,8 +409,7 @@ class GNRoller(object):
'%s' '%s'
'\n' '\n'
'TBR=%s\n' 'TBR=%s\n'
'CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_rel,' 'CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_dbg;'
'mac_chromium_gn_dbg;'
'tryserver.chromium.win:win8_chromium_gn_dbg,' 'tryserver.chromium.win:win8_chromium_gn_dbg,'
'win_chromium_gn_x64_rel\n' % ( 'win_chromium_gn_x64_rel\n' % (
old_buildtools_commitish[:COMMITISH_DIGITS], old_buildtools_commitish[:COMMITISH_DIGITS],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment