Fix the script used to roll GN.

This updates the script to handle the latest inconsistencies in
the buildbot step logging, and also removes the CQ_EXTRA_TRYBOTS
logic for the old builders.

R=brettw@chromium.org

Review-Url: https://codereview.chromium.org/2120673003
Cr-Original-Commit-Position: refs/heads/master@{#403693}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 061d24c115ac682e388c25fbccdd012fbb7c1a63
diff --git a/tools/gn/bin/roll_gn.py b/tools/gn/bin/roll_gn.py
index b15aaf0..91dad7e 100755
--- a/tools/gn/bin/roll_gn.py
+++ b/tools/gn/bin/roll_gn.py
@@ -270,9 +270,18 @@
         fp = urllib2.urlopen(jsurl)
         js = json.loads(fp.read())
         fp.close()
+        sha1_step_name = 'gn sha1'
         for step in js['steps']:
-          if step['name'] == 'gn sha1':
-            sha1 = step['text'][1]
+          if step['name'] == sha1_step_name:
+            # TODO: At some point infra changed the step text to
+            # contain the step name; once all of the masters have been
+            # restarted we can probably assert that the step text
+            # with the step_name.
+            sha1_step_text_prefix = sha1_step_name + '<br>'
+            if step['text'][-1].startswith(sha1_step_text_prefix):
+              sha1 = step['text'][-1][len(sha1_step_text_prefix):]
+            else:
+              sha1 = step['text'][-1]
 
       if results[platform]['build'] < build:
         results[platform]['build'] = build
@@ -430,9 +439,7 @@
       '\n'
       '%s'
       '\n'
-      'TBR=%s\n'
-      'CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_dbg;'
-      'tryserver.chromium.win:win8_chromium_gn_dbg\n' % (
+      'TBR=%s\n' % (
         old_buildtools_commitish[:COMMITISH_DIGITS],
         new_buildtools_commitish[:COMMITISH_DIGITS],
         self.old_gn_commitish[:COMMITISH_DIGITS],