Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 import argparse | 6 import argparse |
| 7 import collections | 7 import collections |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 CHROMIUM_GIT_URL = 'https://chromium.googlesource.com/chromium/src.git' | 29 CHROMIUM_GIT_URL = 'https://chromium.googlesource.com/chromium/src.git' |
| 30 COMMIT_POSITION_RE = re.compile('^Cr-Original-Commit-Position: .*#([0-9]+).*$') | 30 COMMIT_POSITION_RE = re.compile('^Cr-Original-Commit-Position: .*#([0-9]+).*$') |
| 31 CL_ISSUE_RE = re.compile('^Issue number: ([0-9]+) \((.*)\)$') | 31 CL_ISSUE_RE = re.compile('^Issue number: ([0-9]+) \((.*)\)$') |
| 32 RIETVELD_URL_RE = re.compile('^https?://(.*)/(.*)') | 32 RIETVELD_URL_RE = re.compile('^https?://(.*)/(.*)') |
| 33 ROLL_BRANCH_NAME = 'special_webrtc_roll_branch' | 33 ROLL_BRANCH_NAME = 'special_webrtc_roll_branch' |
| 34 TRYJOB_STATUS_SLEEP_SECONDS = 30 | 34 TRYJOB_STATUS_SLEEP_SECONDS = 30 |
| 35 | 35 |
| 36 # Use a shell for subcommands on Windows to get a PATH search. | 36 # Use a shell for subcommands on Windows to get a PATH search. |
| 37 IS_WIN = sys.platform.startswith('win') | 37 IS_WIN = sys.platform.startswith('win') |
| 38 WEBRTC_PATH = os.path.join('third_party', 'webrtc') | 38 WEBRTC_PATH = os.path.join('third_party', 'webrtc') |
| 39 LIBJINGLE_PATH = os.path.join('third_party', 'libjingle', 'source', 'talk') | |
| 40 LIBJINGLE_README = os.path.join('third_party', 'libjingle', 'README.chromium') | |
| 41 # Run these CQ trybots in addition to the default ones in infra/config/cq.cfg. | 39 # Run these CQ trybots in addition to the default ones in infra/config/cq.cfg. |
| 42 EXTRA_TRYBOTS = ('tryserver.chromium.linux:linux_chromium_archive_rel_ng;' | 40 EXTRA_TRYBOTS = ('tryserver.chromium.linux:linux_chromium_archive_rel_ng;' |
| 43 'tryserver.chromium.mac:mac_chromium_archive_rel_ng') | 41 'tryserver.chromium.mac:mac_chromium_archive_rel_ng') |
| 44 | 42 |
| 45 # Result codes from build/third_party/buildbot_8_4p1/buildbot/status/results.py | 43 # Result codes from build/third_party/buildbot_8_4p1/buildbot/status/results.py |
| 46 # plus the -1 code which is used when there's no result yet. | 44 # plus the -1 code which is used when there's no result yet. |
| 47 TRYJOB_STATUS = { | 45 TRYJOB_STATUS = { |
| 48 -1: 'RUNNING', | 46 -1: 'RUNNING', |
| 49 0: 'SUCCESS', | 47 0: 'SUCCESS', |
| 50 1: 'WARNINGS', | 48 1: 'WARNINGS', |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 for trybot_result in tryjob_results: | 146 for trybot_result in tryjob_results: |
| 149 status = TRYJOB_STATUS.get(trybot_result['result'], 'UNKNOWN') | 147 status = TRYJOB_STATUS.get(trybot_result['result'], 'UNKNOWN') |
| 150 status_to_name.setdefault(status, []) | 148 status_to_name.setdefault(status, []) |
| 151 status_to_name[status].append(trybot_result['builder']) | 149 status_to_name[status].append(trybot_result['builder']) |
| 152 | 150 |
| 153 print '\n========== TRYJOBS STATUS ==========' | 151 print '\n========== TRYJOBS STATUS ==========' |
| 154 for status,name_list in status_to_name.iteritems(): | 152 for status,name_list in status_to_name.iteritems(): |
| 155 print '%s: %s' % (status, ','.join(sorted(name_list))) | 153 print '%s: %s' % (status, ','.join(sorted(name_list))) |
| 156 | 154 |
| 157 | 155 |
| 158 def _GenerateCLDescriptionCommand(webrtc_current, libjingle_current, | 156 def _GenerateCLDescriptionCommand(webrtc_current, webrtc_new): |
| 159 webrtc_new, libjingle_new): | |
| 160 delim = '' | 157 delim = '' |
| 161 webrtc_str = '' | 158 webrtc_str = '' |
| 162 def GetChangeLogURL(git_repo_url, current_hash, new_hash): | 159 def GetChangeLogURL(git_repo_url, current_hash, new_hash): |
| 163 return '%s/+log/%s..%s' % (git_repo_url, current_hash[0:7], new_hash[0:7]) | 160 return '%s/+log/%s..%s' % (git_repo_url, current_hash[0:7], new_hash[0:7]) |
| 164 | 161 |
| 165 if webrtc_current.git_commit != webrtc_new.git_commit: | 162 if webrtc_current.git_commit != webrtc_new.git_commit: |
|
kjellander_chromium
2016/05/13 09:47:17
Please remove line 165: it should always be true n
| |
| 166 webrtc_str = 'WebRTC %s:%s' % (webrtc_current.commit_position, | 163 webrtc_str = 'WebRTC %s:%s' % (webrtc_current.commit_position, |
| 167 webrtc_new.commit_position) | 164 webrtc_new.commit_position) |
| 168 webrtc_changelog_url = GetChangeLogURL(webrtc_current.git_repo_url, | 165 webrtc_changelog_url = GetChangeLogURL(webrtc_current.git_repo_url, |
| 169 webrtc_current.git_commit, | 166 webrtc_current.git_commit, |
| 170 webrtc_new.git_commit) | 167 webrtc_new.git_commit) |
| 171 | 168 |
| 172 libjingle_str = '' | 169 description = [ '-m', 'Roll ' + webrtc_str ] |
| 173 if libjingle_current.git_commit != libjingle_new.git_commit: | |
| 174 if webrtc_str: | |
| 175 delim += ', ' | |
| 176 libjingle_str = 'Libjingle %s:%s' % (libjingle_current.commit_position, | |
| 177 libjingle_new.commit_position) | |
| 178 libjingle_changelog_url = GetChangeLogURL(libjingle_current.git_repo_url, | |
| 179 libjingle_current.git_commit, | |
| 180 libjingle_new.git_commit) | |
| 181 | |
| 182 description = [ '-m', 'Roll ' + webrtc_str + delim + libjingle_str ] | |
| 183 if webrtc_str: | 170 if webrtc_str: |
|
kjellander_chromium
2016/05/13 09:47:17
You can remove line 183 too after removing the che
| |
| 184 description.extend(['-m', webrtc_str]) | 171 description.extend(['-m', webrtc_str]) |
|
kjellander_chromium
2016/05/13 09:47:17
I suggest dropping adding this to the description.
| |
| 185 description.extend(['-m', 'Changes: %s' % webrtc_changelog_url]) | 172 description.extend(['-m', 'Changes: %s' % webrtc_changelog_url]) |
| 186 if libjingle_str: | |
| 187 description.extend(['-m', libjingle_str]) | |
| 188 description.extend(['-m', 'Changes: %s' % libjingle_changelog_url]) | |
| 189 description.extend(['-m', 'TBR=']) | 173 description.extend(['-m', 'TBR=']) |
| 190 description.extend(['-m', 'CQ_EXTRA_TRYBOTS=%s' % EXTRA_TRYBOTS]) | 174 description.extend(['-m', 'CQ_EXTRA_TRYBOTS=%s' % EXTRA_TRYBOTS]) |
| 191 return description | 175 return description |
| 192 | 176 |
| 193 | 177 |
| 194 class AutoRoller(object): | 178 class AutoRoller(object): |
| 195 def __init__(self, chromium_src): | 179 def __init__(self, chromium_src): |
| 196 self._chromium_src = chromium_src | 180 self._chromium_src = chromium_src |
| 197 | 181 |
| 198 def _RunCommand(self, command, working_dir=None, ignore_exit_code=False, | 182 def _RunCommand(self, command, working_dir=None, ignore_exit_code=False, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 self._RunCommand(['git', 'pull']) | 280 self._RunCommand(['git', 'pull']) |
| 297 | 281 |
| 298 self._RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) | 282 self._RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) |
| 299 | 283 |
| 300 # Modify Chromium's DEPS file. | 284 # Modify Chromium's DEPS file. |
| 301 | 285 |
| 302 # Parse current hashes. | 286 # Parse current hashes. |
| 303 deps_filename = os.path.join(self._chromium_src, 'DEPS') | 287 deps_filename = os.path.join(self._chromium_src, 'DEPS') |
| 304 deps = _ParseDepsFile(deps_filename) | 288 deps = _ParseDepsFile(deps_filename) |
| 305 webrtc_current = self._GetDepsCommitInfo(deps, WEBRTC_PATH) | 289 webrtc_current = self._GetDepsCommitInfo(deps, WEBRTC_PATH) |
| 306 libjingle_current = self._GetDepsCommitInfo(deps, LIBJINGLE_PATH) | |
| 307 | 290 |
| 308 # Find ToT revisions. | 291 # Find ToT revisions. |
| 309 webrtc_latest = self._GetCommitInfo(WEBRTC_PATH) | 292 webrtc_latest = self._GetCommitInfo(WEBRTC_PATH) |
| 310 libjingle_latest = self._GetCommitInfo(LIBJINGLE_PATH) | |
| 311 | 293 |
| 312 if IS_WIN: | 294 if IS_WIN: |
| 313 # Make sure the roll script doesn't use Windows line endings. | 295 # Make sure the roll script doesn't use Windows line endings. |
| 314 self._RunCommand(['git', 'config', 'core.autocrlf', 'true']) | 296 self._RunCommand(['git', 'config', 'core.autocrlf', 'true']) |
| 315 | 297 |
| 316 self._UpdateDep(deps_filename, WEBRTC_PATH, webrtc_latest) | 298 self._UpdateDep(deps_filename, WEBRTC_PATH, webrtc_latest) |
| 317 self._UpdateDep(deps_filename, LIBJINGLE_PATH, libjingle_latest) | |
| 318 | 299 |
| 319 if self._IsTreeClean(): | 300 if self._IsTreeClean(): |
| 320 print 'The latest revision is already rolled for WebRTC and libjingle.' | 301 print 'The latest revision is already rolled for WebRTC.' |
| 321 self._DeleteRollBranch() | 302 self._DeleteRollBranch() |
| 322 else: | 303 else: |
| 323 self._UpdateReadmeFile(LIBJINGLE_README, libjingle_latest.commit_position) | |
| 324 description = _GenerateCLDescriptionCommand( | 304 description = _GenerateCLDescriptionCommand( |
| 325 webrtc_current, libjingle_current, webrtc_latest, libjingle_latest) | 305 webrtc_current, webrtc_latest) |
| 326 logging.debug('Committing changes locally.') | 306 logging.debug('Committing changes locally.') |
| 327 self._RunCommand(['git', 'add', '--update', '.']) | 307 self._RunCommand(['git', 'add', '--update', '.']) |
| 328 self._RunCommand(['git', 'commit'] + description) | 308 self._RunCommand(['git', 'commit'] + description) |
| 329 logging.debug('Uploading changes...') | 309 logging.debug('Uploading changes...') |
| 330 self._RunCommand(['git', 'cl', 'upload'], | 310 self._RunCommand(['git', 'cl', 'upload'], |
| 331 extra_env={'EDITOR': 'true'}) | 311 extra_env={'EDITOR': 'true'}) |
| 332 cl_info = self._GetCLInfo() | 312 cl_info = self._GetCLInfo() |
| 333 logging.debug('Issue: %d URL: %s', cl_info.issue, cl_info.url) | 313 logging.debug('Issue: %d URL: %s', cl_info.issue, cl_info.url) |
| 334 | 314 |
| 335 if not dry_run and not no_commit: | 315 if not dry_run and not no_commit: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 def WaitForTrybots(self): | 374 def WaitForTrybots(self): |
| 395 active_branch, _ = self._GetBranches() | 375 active_branch, _ = self._GetBranches() |
| 396 if active_branch != ROLL_BRANCH_NAME: | 376 if active_branch != ROLL_BRANCH_NAME: |
| 397 self._RunCommand(['git', 'checkout', ROLL_BRANCH_NAME]) | 377 self._RunCommand(['git', 'checkout', ROLL_BRANCH_NAME]) |
| 398 cl_info = self._GetCLInfo() | 378 cl_info = self._GetCLInfo() |
| 399 return _WaitForTrybots(cl_info.issue, cl_info.rietveld_server) | 379 return _WaitForTrybots(cl_info.issue, cl_info.rietveld_server) |
| 400 | 380 |
| 401 | 381 |
| 402 def main(): | 382 def main(): |
| 403 parser = argparse.ArgumentParser( | 383 parser = argparse.ArgumentParser( |
| 404 description='Find webrtc and libjingle revisions for roll.') | 384 description='Find webrtc revisions for roll.') |
| 405 parser.add_argument('--abort', | 385 parser.add_argument('--abort', |
| 406 help=('Aborts a previously prepared roll. ' | 386 help=('Aborts a previously prepared roll. ' |
| 407 'Closes any associated issues and deletes the roll branches'), | 387 'Closes any associated issues and deletes the roll branches'), |
| 408 action='store_true') | 388 action='store_true') |
| 409 parser.add_argument('--no-commit', | 389 parser.add_argument('--no-commit', |
| 410 help=('Don\'t send the CL to the CQ. This is useful if additional changes ' | 390 help=('Don\'t send the CL to the CQ. This is useful if additional changes ' |
| 411 'are needed to the CL (like for API changes).'), | 391 'are needed to the CL (like for API changes).'), |
| 412 action='store_true') | 392 action='store_true') |
| 413 parser.add_argument('--wait-for-trybots', | 393 parser.add_argument('--wait-for-trybots', |
| 414 help=('Waits until all trybots from a previously created roll are either ' | 394 help=('Waits until all trybots from a previously created roll are either ' |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 437 if args.abort: | 417 if args.abort: |
| 438 return autoroller.Abort() | 418 return autoroller.Abort() |
| 439 elif args.wait_for_trybots: | 419 elif args.wait_for_trybots: |
| 440 return autoroller.WaitForTrybots() | 420 return autoroller.WaitForTrybots() |
| 441 else: | 421 else: |
| 442 return autoroller.PrepareRoll(args.dry_run, args.ignore_checks, | 422 return autoroller.PrepareRoll(args.dry_run, args.ignore_checks, |
| 443 args.no_commit, args.close_previous_roll) | 423 args.no_commit, args.close_previous_roll) |
| 444 | 424 |
| 445 if __name__ == '__main__': | 425 if __name__ == '__main__': |
| 446 sys.exit(main()) | 426 sys.exit(main()) |
| OLD | NEW |