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

Side by Side Diff: tools/autoroller/roll_chromium_revision.py

Issue 1375153004: autoroller: Add CQ_EXTRA_TRYBOTS, CQ feature and --skip-cq flag. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 5 years, 2 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 (c) 2015 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 """Script to roll chromium_revision in the WebRTC DEPS file.""" 10 """Script to roll chromium_revision in the WebRTC DEPS file."""
11 11
12 import argparse 12 import argparse
13 import base64 13 import base64
14 import collections 14 import collections
15 import logging 15 import logging
16 import os 16 import os
17 import re 17 import re
18 import subprocess 18 import subprocess
19 import sys 19 import sys
20 import urllib 20 import urllib
21 21
22 22
23 CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src' 23 CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src'
24 CHROMIUM_COMMIT_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s' 24 CHROMIUM_COMMIT_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s'
25 CHROMIUM_LOG_TEMPLATE = CHROMIUM_SRC_URL + '/+log/%s' 25 CHROMIUM_LOG_TEMPLATE = CHROMIUM_SRC_URL + '/+log/%s'
26 CHROMIUM_FILE_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s/%s' 26 CHROMIUM_FILE_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s/%s'
27 27
28 # Run these CQ trybots in addition to the default ones in infra/config/cq.cfg.
29 EXTRA_TRYBOTS = 'tryserver.webrtc:win_baremetal,mac_baremetal,linux_baremetal'
30
28 COMMIT_POSITION_RE = re.compile('^Cr-Commit-Position: .*#([0-9]+).*$') 31 COMMIT_POSITION_RE = re.compile('^Cr-Commit-Position: .*#([0-9]+).*$')
29 CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION=(\d+)$') 32 CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION=(\d+)$')
30 ROLL_BRANCH_NAME = 'roll_chromium_revision' 33 ROLL_BRANCH_NAME = 'roll_chromium_revision'
31 34
32 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 35 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
33 CHECKOUT_ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, os.pardir, 36 CHECKOUT_ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, os.pardir,
34 os.pardir)) 37 os.pardir))
35 sys.path.append(CHECKOUT_ROOT_DIR) 38 sys.path.append(CHECKOUT_ROOT_DIR)
36 import setup_links 39 import setup_links
37 40
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 current_cr_rev = current_cr_rev[0:7] 256 current_cr_rev = current_cr_rev[0:7]
254 new_cr_rev = new_cr_rev[0:7] 257 new_cr_rev = new_cr_rev[0:7]
255 rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev) 258 rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev)
256 git_number_interval = '%s:%s' % (current_commit_pos, new_commit_pos) 259 git_number_interval = '%s:%s' % (current_commit_pos, new_commit_pos)
257 260
258 commit_msg = ['Roll chromium_revision %s (%s)\n' % (rev_interval, 261 commit_msg = ['Roll chromium_revision %s (%s)\n' % (rev_interval,
259 git_number_interval)] 262 git_number_interval)]
260 commit_msg.append('Change log: %s' % (CHROMIUM_LOG_TEMPLATE % rev_interval)) 263 commit_msg.append('Change log: %s' % (CHROMIUM_LOG_TEMPLATE % rev_interval))
261 commit_msg.append('Full diff: %s\n' % (CHROMIUM_COMMIT_TEMPLATE % 264 commit_msg.append('Full diff: %s\n' % (CHROMIUM_COMMIT_TEMPLATE %
262 rev_interval)) 265 rev_interval))
263
264 # TBR field will be empty unless in some custom cases, where some engineers 266 # TBR field will be empty unless in some custom cases, where some engineers
265 # are added. 267 # are added.
266 tbr_authors = '' 268 tbr_authors = ''
267
268 if changed_deps_list: 269 if changed_deps_list:
269 commit_msg.append('Changed dependencies:') 270 commit_msg.append('Changed dependencies:')
270 271
271 for c in changed_deps_list: 272 for c in changed_deps_list:
272 commit_msg.append('* %s: %s/+log/%s..%s' % (c.path, c.url, 273 commit_msg.append('* %s: %s/+log/%s..%s' % (c.path, c.url,
273 c.current_rev[0:7], 274 c.current_rev[0:7],
274 c.new_rev[0:7])) 275 c.new_rev[0:7]))
275 if 'libvpx' in c.path: 276 if 'libvpx' in c.path:
276 tbr_authors += 'marpan@webrtc.org, stefan@webrtc.org, ' 277 tbr_authors += 'marpan@webrtc.org, stefan@webrtc.org, '
277 278
278 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS') 279 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS')
279 commit_msg.append('DEPS diff: %s\n' % change_url) 280 commit_msg.append('DEPS diff: %s\n' % change_url)
280 else: 281 else:
281 commit_msg.append('No dependencies changed.') 282 commit_msg.append('No dependencies changed.')
282 283
283 if clang_change.current_rev != clang_change.new_rev: 284 if clang_change.current_rev != clang_change.new_rev:
284 commit_msg.append('Clang version changed %s:%s' % 285 commit_msg.append('Clang version changed %s:%s' %
285 (clang_change.current_rev, clang_change.new_rev)) 286 (clang_change.current_rev, clang_change.new_rev))
286 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 287 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval,
287 CLANG_UPDATE_SCRIPT_URL_PATH) 288 CLANG_UPDATE_SCRIPT_URL_PATH)
288 commit_msg.append('Details: %s' % change_url) 289 commit_msg.append('Details: %s\n' % change_url)
289 tbr_authors += 'pbos@webrtc.org' 290 tbr_authors += 'pbos@webrtc.org'
290 else: 291 else:
291 commit_msg.append('No update to Clang.') 292 commit_msg.append('No update to Clang.\n')
292 293
293 commit_msg.append('\nTBR=%s\n' % tbr_authors) 294 commit_msg.append('TBR=%s' % tbr_authors)
295 commit_msg.append('CQ_EXTRA_TRYBOTS=%s' % EXTRA_TRYBOTS)
294 return '\n'.join(commit_msg) 296 return '\n'.join(commit_msg)
295 297
296 298
297 def UpdateDeps(deps_filename, old_cr_revision, new_cr_revision): 299 def UpdateDeps(deps_filename, old_cr_revision, new_cr_revision):
298 """Update the DEPS file with the new revision.""" 300 """Update the DEPS file with the new revision."""
299 with open(deps_filename, 'rb') as deps_file: 301 with open(deps_filename, 'rb') as deps_file:
300 deps_content = deps_file.read() 302 deps_content = deps_file.read()
301 deps_content = deps_content.replace(old_cr_revision, new_cr_revision) 303 deps_content = deps_content.replace(old_cr_revision, new_cr_revision)
302 with open(deps_filename, 'wb') as deps_file: 304 with open(deps_filename, 'wb') as deps_file:
303 deps_file.write(deps_content) 305 deps_file.write(deps_content)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if not dry_run: 354 if not dry_run:
353 _RunCommand(['git', 'cl', 'upload'], extra_env={'EDITOR': 'true'}) 355 _RunCommand(['git', 'cl', 'upload'], extra_env={'EDITOR': 'true'})
354 356
355 357
356 def _LaunchTrybots(dry_run, skip_try): 358 def _LaunchTrybots(dry_run, skip_try):
357 logging.info('Sending tryjobs...') 359 logging.info('Sending tryjobs...')
358 if not dry_run and not skip_try: 360 if not dry_run and not skip_try:
359 _RunCommand(['git', 'cl', 'try']) 361 _RunCommand(['git', 'cl', 'try'])
360 362
361 363
364 def _SendToCQ(dry_run, skip_cq):
365 logging.info('Sending the CL to the CQ...')
366 if not dry_run and not skip_cq:
367 _RunCommand(['git', 'cl', 'set_commit'])
368 logging.info('Sent the CL to the CQ.')
369
370
362 def main(): 371 def main():
363 p = argparse.ArgumentParser() 372 p = argparse.ArgumentParser()
364 p.add_argument('--clean', action='store_true', default=False, 373 p.add_argument('--clean', action='store_true', default=False,
365 help='Removes any previous local roll branch.') 374 help='Removes any previous local roll branch.')
366 p.add_argument('-r', '--revision', 375 p.add_argument('-r', '--revision',
367 help=('Chromium Git revision to roll to. Defaults to the ' 376 help=('Chromium Git revision to roll to. Defaults to the '
368 'Chromium HEAD revision if omitted.')) 377 'Chromium HEAD revision if omitted.'))
369 p.add_argument('--dry-run', action='store_true', default=False, 378 p.add_argument('--dry-run', action='store_true', default=False,
370 help=('Calculate changes and modify DEPS, but don\'t create ' 379 help=('Calculate changes and modify DEPS, but don\'t create '
371 'any local branch, commit, upload CL or send any ' 380 'any local branch, commit, upload CL or send any '
372 'tryjobs.')) 381 'tryjobs.'))
373 p.add_argument('--allow-reverse', action='store_true', default=False, 382 p.add_argument('--allow-reverse', action='store_true', default=False,
374 help=('Allow rolling back in time (disabled by default but ' 383 help=('Allow rolling back in time (disabled by default but '
375 'may be useful to be able do to manually).')) 384 'may be useful to be able do to manually).'))
376 p.add_argument('-s', '--skip-try', action='store_true', default=False, 385 p.add_argument('-s', '--skip-try', action='store_true', default=False,
377 help='Do everything except sending tryjobs.') 386 help='Skip sending tryjobs (default: %(default)s)')
387 p.add_argument('--skip-cq', action='store_true', default=False,
388 help='Skip sending the CL to the CQ (default: %(default)s)')
378 p.add_argument('-v', '--verbose', action='store_true', default=False, 389 p.add_argument('-v', '--verbose', action='store_true', default=False,
379 help='Be extra verbose in printing of log messages.') 390 help='Be extra verbose in printing of log messages.')
380 opts = p.parse_args() 391 opts = p.parse_args()
381 392
382 if opts.verbose: 393 if opts.verbose:
383 logging.basicConfig(level=logging.DEBUG) 394 logging.basicConfig(level=logging.DEBUG)
384 else: 395 else:
385 logging.basicConfig(level=logging.INFO) 396 logging.basicConfig(level=logging.INFO)
386 397
387 if not _IsTreeClean(): 398 if not _IsTreeClean():
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 '--allow-reverse flag.\n' 434 '--allow-reverse flag.\n'
424 'Aborting without action.', current_cr_rev, current_commit_pos, 435 'Aborting without action.', current_cr_rev, current_commit_pos,
425 new_cr_rev, new_commit_pos) 436 new_cr_rev, new_commit_pos)
426 return 0 437 return 0
427 438
428 _CreateRollBranch(opts.dry_run) 439 _CreateRollBranch(opts.dry_run)
429 UpdateDeps(deps_filename, current_cr_rev, new_cr_rev) 440 UpdateDeps(deps_filename, current_cr_rev, new_cr_rev)
430 _LocalCommit(commit_msg, opts.dry_run) 441 _LocalCommit(commit_msg, opts.dry_run)
431 _UploadCL(opts.dry_run) 442 _UploadCL(opts.dry_run)
432 _LaunchTrybots(opts.dry_run, opts.skip_try) 443 _LaunchTrybots(opts.dry_run, opts.skip_try)
444 _SendToCQ(opts.dry_run, opts.skip_cq)
433 return 0 445 return 0
434 446
435 447
436 if __name__ == '__main__': 448 if __name__ == '__main__':
437 sys.exit(main()) 449 sys.exit(main())
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