Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: tools/gn/bin/roll_gn.py

Issue 1372203003: Fix various issues in the roll_gn script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove mac_chromium_gn_rel from CQ_EXTRA_TRYBOTS Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/bin/roll_gn.py
diff --git a/tools/gn/bin/roll_gn.py b/tools/gn/bin/roll_gn.py
index a479bdcf49126ad5d9dae6b9cfd3e87bde86ed79..1e9dec9e79d594fa0c6410dad55fe602e5cf5680 100644
--- a/tools/gn/bin/roll_gn.py
+++ b/tools/gn/bin/roll_gn.py
@@ -182,13 +182,26 @@ class GNRoller(object):
print('Checking build')
results = self.CheckBuild()
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('Sleeping for 30 seconds')
time.sleep(30)
print('Checking build')
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):
_, out, _ = self.Call('git-cl issue')
@@ -264,7 +277,8 @@ class GNRoller(object):
def RollBuildtools(self):
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:")
return 1
@@ -306,6 +320,11 @@ class GNRoller(object):
# merged branch.
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
def RollDEPS(self):
@@ -336,7 +355,7 @@ class GNRoller(object):
return 1
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,
new_buildtools_commitish)
@@ -349,11 +368,19 @@ class GNRoller(object):
finally:
os.remove(desc_file.name)
- # Intentionally leave the src checkout on the new branch with the roll
- # since we're not auto-committing it.
+ # Move off of the roll branch onto whatever we were on before.
+ # 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
+ 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):
gn_changes = self.GetGNChanges()
return (
@@ -382,8 +409,7 @@ class GNRoller(object):
'%s'
'\n'
'TBR=%s\n'
- 'CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_rel,'
- 'mac_chromium_gn_dbg;'
+ 'CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_dbg;'
'tryserver.chromium.win:win8_chromium_gn_dbg,'
'win_chromium_gn_x64_rel\n' % (
old_buildtools_commitish[:COMMITISH_DIGITS],
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698