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

Side by Side Diff: tools/gn/bin/roll_gn.py

Issue 2120673003: Fix the script used to roll GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """An auto-roller for GN binaries into Chromium. 6 """An auto-roller for GN binaries into Chromium.
7 7
8 This script is used to update the GN binaries that a Chromium 8 This script is used to update the GN binaries that a Chromium
9 checkout uses. In order to update the binaries, one must follow 9 checkout uses. In order to update the binaries, one must follow
10 four steps in order: 10 four steps in order:
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 build = url_str.split('/')[-1] 263 build = url_str.split('/')[-1]
264 264
265 sha1 = '-' 265 sha1 = '-'
266 results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str}) 266 results.setdefault(platform, {'build': -1, 'sha1': '', 'url': url_str})
267 267
268 if state == 'success': 268 if state == 'success':
269 jsurl = url_str.replace('/builders/', '/json/builders/') 269 jsurl = url_str.replace('/builders/', '/json/builders/')
270 fp = urllib2.urlopen(jsurl) 270 fp = urllib2.urlopen(jsurl)
271 js = json.loads(fp.read()) 271 js = json.loads(fp.read())
272 fp.close() 272 fp.close()
273 sha1_step_name = 'gn sha1'
273 for step in js['steps']: 274 for step in js['steps']:
274 if step['name'] == 'gn sha1': 275 if step['name'] == sha1_step_name:
275 sha1 = step['text'][1] 276 # TODO: At some point infra changed the step text to
277 # contain the step name; once all of the masters have been
278 # restarted we can probably assert that the step text
brettw 2016/07/03 23:26:29 This doesn't quite parse in English "assert that t
279 # with the step_name.
280 sha1_step_text_prefix = sha1_step_name + '<br>'
281 if step['text'][-1].startswith(sha1_step_text_prefix):
282 sha1 = step['text'][-1][len(sha1_step_text_prefix):]
283 else:
284 sha1 = step['text'][-1]
276 285
277 if results[platform]['build'] < build: 286 if results[platform]['build'] < build:
278 results[platform]['build'] = build 287 results[platform]['build'] = build
279 results[platform]['sha1'] = sha1 288 results[platform]['sha1'] = sha1
280 results[platform]['state'] = state 289 results[platform]['state'] = state
281 results[platform]['url'] = url_str 290 results[platform]['url'] = url_str
282 291
283 for platform, r in results.items(): 292 for platform, r in results.items():
284 print(platform) 293 print(platform)
285 print(' sha1: %s' % r['sha1']) 294 print(' sha1: %s' % r['sha1'])
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 gn_changes = self.GetGNChanges() 432 gn_changes = self.GetGNChanges()
424 433
425 return ( 434 return (
426 'Roll buildtools %s..%s\n' 435 'Roll buildtools %s..%s\n'
427 '\n' 436 '\n'
428 ' In order to roll GN %s..%s (r%s:r%s) and pick up\n' 437 ' In order to roll GN %s..%s (r%s:r%s) and pick up\n'
429 ' the following changes:\n' 438 ' the following changes:\n'
430 '\n' 439 '\n'
431 '%s' 440 '%s'
432 '\n' 441 '\n'
433 'TBR=%s\n' 442 'TBR=%s\n' % (
434 'CQ_EXTRA_TRYBOTS=tryserver.chromium.mac:mac_chromium_gn_dbg;'
435 'tryserver.chromium.win:win8_chromium_gn_dbg\n' % (
436 old_buildtools_commitish[:COMMITISH_DIGITS], 443 old_buildtools_commitish[:COMMITISH_DIGITS],
437 new_buildtools_commitish[:COMMITISH_DIGITS], 444 new_buildtools_commitish[:COMMITISH_DIGITS],
438 self.old_gn_commitish[:COMMITISH_DIGITS], 445 self.old_gn_commitish[:COMMITISH_DIGITS],
439 self.new_gn_commitish[:COMMITISH_DIGITS], 446 self.new_gn_commitish[:COMMITISH_DIGITS],
440 self.old_gn_version, 447 self.old_gn_version,
441 self.new_gn_version, 448 self.new_gn_version,
442 gn_changes, 449 gn_changes,
443 self.reviewer, 450 self.reviewer,
444 )) 451 ))
445 452
446 def GetGNChanges(self): 453 def GetGNChanges(self):
447 _, out, _ = self.Call( 454 _, out, _ = self.Call(
448 "git log --pretty=' %h %s' " + 455 "git log --pretty=' %h %s' " +
449 "%s..%s tools/gn" % (self.old_gn_commitish, self.new_gn_commitish)) 456 "%s..%s tools/gn" % (self.old_gn_commitish, self.new_gn_commitish))
450 return out 457 return out
451 458
452 def Call(self, cmd, cwd=None): 459 def Call(self, cmd, cwd=None):
453 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, 460 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
454 cwd=(cwd or self.chromium_src_dir)) 461 cwd=(cwd or self.chromium_src_dir))
455 out, err = proc.communicate() 462 out, err = proc.communicate()
456 return proc.returncode, out, err 463 return proc.returncode, out, err
457 464
458 465
459 if __name__ == '__main__': 466 if __name__ == '__main__':
460 roller = GNRoller() 467 roller = GNRoller()
461 sys.exit(roller.Roll()) 468 sys.exit(roller.Roll())
OLDNEW
« 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