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

Side by Side Diff: tools/roll_webrtc.py

Issue 1974253003: Drop libjingle/source/talk directory from DEPS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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 | « tools/checklicenses/checklicenses.py ('k') | 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 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
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
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 = ''
161 webrtc_str = ''
162 def GetChangeLogURL(git_repo_url, current_hash, new_hash): 157 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]) 158 return '%s/+log/%s..%s' % (git_repo_url, current_hash[0:7], new_hash[0:7])
164 159
165 if webrtc_current.git_commit != webrtc_new.git_commit: 160 webrtc_str = 'WebRTC %s:%s' % (webrtc_current.commit_position,
166 webrtc_str = 'WebRTC %s:%s' % (webrtc_current.commit_position, 161 webrtc_new.commit_position)
167 webrtc_new.commit_position) 162 webrtc_changelog_url = GetChangeLogURL(webrtc_current.git_repo_url,
168 webrtc_changelog_url = GetChangeLogURL(webrtc_current.git_repo_url, 163 webrtc_current.git_commit,
169 webrtc_current.git_commit, 164 webrtc_new.git_commit)
170 webrtc_new.git_commit)
171 165
172 libjingle_str = '' 166 description = [ '-m', 'Roll ' + webrtc_str ]
173 if libjingle_current.git_commit != libjingle_new.git_commit: 167 description.extend(['-m', 'Changes: %s' % webrtc_changelog_url])
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:
184 description.extend(['-m', webrtc_str])
185 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=']) 168 description.extend(['-m', 'TBR='])
190 description.extend(['-m', 'CQ_EXTRA_TRYBOTS=%s' % EXTRA_TRYBOTS]) 169 description.extend(['-m', 'CQ_EXTRA_TRYBOTS=%s' % EXTRA_TRYBOTS])
191 return description 170 return description
192 171
193 172
194 class AutoRoller(object): 173 class AutoRoller(object):
195 def __init__(self, chromium_src): 174 def __init__(self, chromium_src):
196 self._chromium_src = chromium_src 175 self._chromium_src = chromium_src
197 176
198 def _RunCommand(self, command, working_dir=None, ignore_exit_code=False, 177 def _RunCommand(self, command, working_dir=None, ignore_exit_code=False,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 self._RunCommand(['git', 'pull']) 275 self._RunCommand(['git', 'pull'])
297 276
298 self._RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) 277 self._RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME])
299 278
300 # Modify Chromium's DEPS file. 279 # Modify Chromium's DEPS file.
301 280
302 # Parse current hashes. 281 # Parse current hashes.
303 deps_filename = os.path.join(self._chromium_src, 'DEPS') 282 deps_filename = os.path.join(self._chromium_src, 'DEPS')
304 deps = _ParseDepsFile(deps_filename) 283 deps = _ParseDepsFile(deps_filename)
305 webrtc_current = self._GetDepsCommitInfo(deps, WEBRTC_PATH) 284 webrtc_current = self._GetDepsCommitInfo(deps, WEBRTC_PATH)
306 libjingle_current = self._GetDepsCommitInfo(deps, LIBJINGLE_PATH)
307 285
308 # Find ToT revisions. 286 # Find ToT revisions.
309 webrtc_latest = self._GetCommitInfo(WEBRTC_PATH) 287 webrtc_latest = self._GetCommitInfo(WEBRTC_PATH)
310 libjingle_latest = self._GetCommitInfo(LIBJINGLE_PATH)
311 288
312 if IS_WIN: 289 if IS_WIN:
313 # Make sure the roll script doesn't use Windows line endings. 290 # Make sure the roll script doesn't use Windows line endings.
314 self._RunCommand(['git', 'config', 'core.autocrlf', 'true']) 291 self._RunCommand(['git', 'config', 'core.autocrlf', 'true'])
315 292
316 self._UpdateDep(deps_filename, WEBRTC_PATH, webrtc_latest) 293 self._UpdateDep(deps_filename, WEBRTC_PATH, webrtc_latest)
317 self._UpdateDep(deps_filename, LIBJINGLE_PATH, libjingle_latest)
318 294
319 if self._IsTreeClean(): 295 if self._IsTreeClean():
320 print 'The latest revision is already rolled for WebRTC and libjingle.' 296 print 'The latest revision is already rolled for WebRTC.'
321 self._DeleteRollBranch() 297 self._DeleteRollBranch()
322 else: 298 else:
323 self._UpdateReadmeFile(LIBJINGLE_README, libjingle_latest.commit_position)
324 description = _GenerateCLDescriptionCommand( 299 description = _GenerateCLDescriptionCommand(
325 webrtc_current, libjingle_current, webrtc_latest, libjingle_latest) 300 webrtc_current, webrtc_latest)
326 logging.debug('Committing changes locally.') 301 logging.debug('Committing changes locally.')
327 self._RunCommand(['git', 'add', '--update', '.']) 302 self._RunCommand(['git', 'add', '--update', '.'])
328 self._RunCommand(['git', 'commit'] + description) 303 self._RunCommand(['git', 'commit'] + description)
329 logging.debug('Uploading changes...') 304 logging.debug('Uploading changes...')
330 self._RunCommand(['git', 'cl', 'upload'], 305 self._RunCommand(['git', 'cl', 'upload'],
331 extra_env={'EDITOR': 'true'}) 306 extra_env={'EDITOR': 'true'})
332 cl_info = self._GetCLInfo() 307 cl_info = self._GetCLInfo()
333 logging.debug('Issue: %d URL: %s', cl_info.issue, cl_info.url) 308 logging.debug('Issue: %d URL: %s', cl_info.issue, cl_info.url)
334 309
335 if not dry_run and not no_commit: 310 if not dry_run and not no_commit:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 def WaitForTrybots(self): 369 def WaitForTrybots(self):
395 active_branch, _ = self._GetBranches() 370 active_branch, _ = self._GetBranches()
396 if active_branch != ROLL_BRANCH_NAME: 371 if active_branch != ROLL_BRANCH_NAME:
397 self._RunCommand(['git', 'checkout', ROLL_BRANCH_NAME]) 372 self._RunCommand(['git', 'checkout', ROLL_BRANCH_NAME])
398 cl_info = self._GetCLInfo() 373 cl_info = self._GetCLInfo()
399 return _WaitForTrybots(cl_info.issue, cl_info.rietveld_server) 374 return _WaitForTrybots(cl_info.issue, cl_info.rietveld_server)
400 375
401 376
402 def main(): 377 def main():
403 parser = argparse.ArgumentParser( 378 parser = argparse.ArgumentParser(
404 description='Find webrtc and libjingle revisions for roll.') 379 description='Find webrtc revisions for roll.')
405 parser.add_argument('--abort', 380 parser.add_argument('--abort',
406 help=('Aborts a previously prepared roll. ' 381 help=('Aborts a previously prepared roll. '
407 'Closes any associated issues and deletes the roll branches'), 382 'Closes any associated issues and deletes the roll branches'),
408 action='store_true') 383 action='store_true')
409 parser.add_argument('--no-commit', 384 parser.add_argument('--no-commit',
410 help=('Don\'t send the CL to the CQ. This is useful if additional changes ' 385 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).'), 386 'are needed to the CL (like for API changes).'),
412 action='store_true') 387 action='store_true')
413 parser.add_argument('--wait-for-trybots', 388 parser.add_argument('--wait-for-trybots',
414 help=('Waits until all trybots from a previously created roll are either ' 389 help=('Waits until all trybots from a previously created roll are either '
(...skipping 22 matching lines...) Expand all
437 if args.abort: 412 if args.abort:
438 return autoroller.Abort() 413 return autoroller.Abort()
439 elif args.wait_for_trybots: 414 elif args.wait_for_trybots:
440 return autoroller.WaitForTrybots() 415 return autoroller.WaitForTrybots()
441 else: 416 else:
442 return autoroller.PrepareRoll(args.dry_run, args.ignore_checks, 417 return autoroller.PrepareRoll(args.dry_run, args.ignore_checks,
443 args.no_commit, args.close_previous_roll) 418 args.no_commit, args.close_previous_roll)
444 419
445 if __name__ == '__main__': 420 if __name__ == '__main__':
446 sys.exit(main()) 421 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/checklicenses/checklicenses.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698