Roll back checking in the third_party directory
This goes back to using a subtree mirror of Chromium's third_party directory (managed by gclient). The related scripts for syncing the files are also deleted. The plan is to solve the conflict by creating third_party directories in subdirectories of WebRTC rather than the repo root. Bug: webrtc:8366 Change-Id: I0b9f6a86c6d4075e2fa12c2db19aa54682ddb11f Reviewed-on: https://webrtc-review.googlesource.com/85300 Reviewed-by: Oleh Prypin <oprypin@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23757}
This commit is contained in:
@ -12,7 +12,6 @@
|
||||
import argparse
|
||||
import base64
|
||||
import collections
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
@ -23,7 +22,6 @@ import urllib2
|
||||
# Skip these dependencies (list without solution name prefix).
|
||||
DONT_AUTOROLL_THESE = [
|
||||
'src/examples/androidtests/third_party/gradle',
|
||||
'src/third_party_chromium',
|
||||
'src/third_party/ffmpeg',
|
||||
]
|
||||
|
||||
@ -34,11 +32,9 @@ EXTRA_TRYBOTS = (
|
||||
|
||||
WEBRTC_URL = 'https://webrtc.googlesource.com/src'
|
||||
CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src'
|
||||
CHROMIUM_THIRD_PARTY_URL = '%s/third_party' % CHROMIUM_SRC_URL
|
||||
CHROMIUM_COMMIT_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s'
|
||||
CHROMIUM_LOG_TEMPLATE = CHROMIUM_SRC_URL + '/+log/%s'
|
||||
CHROMIUM_FILE_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s/%s'
|
||||
CHROMIUM_3P_LOG_TEMPLATE = CHROMIUM_SRC_URL + '/third_party/+log/%s'
|
||||
|
||||
COMMIT_POSITION_RE = re.compile('^Cr-Commit-Position: .*#([0-9]+).*$')
|
||||
CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION = \'(\d+)\'$')
|
||||
@ -67,9 +63,7 @@ ChangedCipdPackage = collections.namedtuple(
|
||||
|
||||
ChromiumRevisionUpdate = collections.namedtuple('ChromiumRevisionUpdate',
|
||||
('current_chromium_rev '
|
||||
'new_chromium_rev '
|
||||
'current_third_party_rev '
|
||||
'new_third_party_rev'))
|
||||
'new_chromium_rev '))
|
||||
|
||||
|
||||
class RollError(Exception):
|
||||
@ -331,18 +325,13 @@ def GenerateCommitMessage(rev_update, current_commit_pos,
|
||||
current_cr_rev = rev_update.current_chromium_rev[0:10]
|
||||
new_cr_rev = rev_update.new_chromium_rev[0:10]
|
||||
rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev)
|
||||
rev_3p_interval = '%s..%s' % (rev_update.current_third_party_rev[0:10],
|
||||
rev_update.new_third_party_rev[0:10])
|
||||
git_number_interval = '%s:%s' % (current_commit_pos, new_commit_pos)
|
||||
|
||||
commit_msg = ['Roll chromium_revision %s (%s)\n' % (rev_interval,
|
||||
git_number_interval),
|
||||
'Change log: %s' % (CHROMIUM_LOG_TEMPLATE % rev_interval),
|
||||
'Full diff: %s\n' % (CHROMIUM_COMMIT_TEMPLATE %
|
||||
rev_interval),
|
||||
'Roll chromium third_party %s' % rev_3p_interval,
|
||||
'Change log: %s\n' % (
|
||||
CHROMIUM_3P_LOG_TEMPLATE % rev_3p_interval)]
|
||||
rev_interval)]
|
||||
tbr_authors = ''
|
||||
if changed_deps_list:
|
||||
commit_msg.append('Changed dependencies:')
|
||||
@ -380,7 +369,6 @@ def GenerateCommitMessage(rev_update, current_commit_pos,
|
||||
commit_msg.append('TBR=%s' % tbr_authors)
|
||||
commit_msg.append('BUG=None')
|
||||
commit_msg.append('CQ_INCLUDE_TRYBOTS=%s' % EXTRA_TRYBOTS)
|
||||
commit_msg.append('NO_AUTOIMPORT_DEPS_CHECK=true')
|
||||
return '\n'.join(commit_msg)
|
||||
|
||||
|
||||
@ -392,8 +380,6 @@ def UpdateDepsFile(deps_filename, rev_update, changed_deps):
|
||||
deps_content = deps_file.read()
|
||||
deps_content = deps_content.replace(rev_update.current_chromium_rev,
|
||||
rev_update.new_chromium_rev)
|
||||
deps_content = deps_content.replace(rev_update.current_third_party_rev,
|
||||
rev_update.new_third_party_rev)
|
||||
with open(deps_filename, 'wb') as deps_file:
|
||||
deps_file.write(deps_content)
|
||||
|
||||
@ -416,48 +402,6 @@ def UpdateDepsFile(deps_filename, rev_update, changed_deps):
|
||||
working_dir=CHECKOUT_SRC_DIR)
|
||||
|
||||
|
||||
def _LoadThirdPartyDepsAndFiles(filename):
|
||||
with open(filename, 'rb') as f:
|
||||
data = json.load(f)
|
||||
return data.get('dependencies', [])
|
||||
|
||||
|
||||
def UpdateThirdPartyDeps(new_rev, dest_dir, source_dir,
|
||||
third_party_deps_file):
|
||||
"""Syncing deps, specified in third_party_deps_file with repo in source_dir.
|
||||
|
||||
Will exit if sync failed for some reasons.
|
||||
Params:
|
||||
new_rev - revision of third_party to update to
|
||||
dest_dir - webrtc directory, that will be used as root for third_party deps
|
||||
source_dir - checked out chromium third_party repo
|
||||
third_party_deps_file - file with list of third_party deps to copy
|
||||
"""
|
||||
|
||||
deps_to_checkout = _LoadThirdPartyDepsAndFiles(third_party_deps_file)
|
||||
# Update existing chromium third_party checkout to new rev.
|
||||
_RunCommand(['git', 'fetch', 'origin'], working_dir=source_dir)
|
||||
_RunCommand(['git', 'checkout', new_rev], working_dir=source_dir)
|
||||
# Checkout chromium repo into dest dir basing on source checkout.
|
||||
_RunCommand(
|
||||
['git', '--git-dir', '%s/.git' % source_dir, 'checkout',
|
||||
new_rev] + deps_to_checkout, working_dir=dest_dir)
|
||||
# Ensure all chromium dependencies are presented
|
||||
deps_set = set(deps_to_checkout)
|
||||
stdout, _ = _RunCommand(['git', 'ls-tree', '--name-only', 'HEAD'],
|
||||
working_dir=source_dir)
|
||||
if not deps_set.issubset(set(stdout.split('\n'))):
|
||||
raise RollError('Missed required chromium dependencies in chromium '
|
||||
'third_party repo: %s' % json.dumps(
|
||||
list(deps_set.difference(set(stdout.split('\n'))))))
|
||||
stdout, _ = _RunCommand(['git', 'ls-tree', '--name-only', 'HEAD'],
|
||||
working_dir=dest_dir)
|
||||
if not deps_set.issubset(set(stdout.split('\n'))):
|
||||
raise RollError('Missed required chromium dependencies after checking in '
|
||||
'chromium third_party repo: %s' % json.dumps(
|
||||
list(deps_set.difference(set(stdout.split('\n'))))))
|
||||
|
||||
|
||||
def _IsTreeClean():
|
||||
stdout, _ = _RunCommand(['git', 'status', '--porcelain'])
|
||||
if len(stdout) == 0:
|
||||
@ -500,7 +444,6 @@ def _LocalCommit(commit_msg, dry_run):
|
||||
logging.info('Committing changes locally.')
|
||||
if not dry_run:
|
||||
_RunCommand(['git', 'add', '--update', '.'])
|
||||
_RunCommand(['git', 'add', '-A', 'third_party'])
|
||||
_RunCommand(['git', 'commit', '-m', commit_msg])
|
||||
|
||||
|
||||
@ -532,7 +475,6 @@ def _UploadCL(commit_queue_mode):
|
||||
|
||||
def GetRollRevisionRanges(opts, webrtc_deps):
|
||||
current_cr_rev = webrtc_deps['vars']['chromium_revision']
|
||||
current_third_party_rev = webrtc_deps['vars']['chromium_third_party_revision']
|
||||
new_cr_rev = opts.revision
|
||||
if not new_cr_rev:
|
||||
stdout, _ = _RunCommand(['git', 'ls-remote', CHROMIUM_SRC_URL, 'HEAD'])
|
||||
@ -540,18 +482,7 @@ def GetRollRevisionRanges(opts, webrtc_deps):
|
||||
logging.info('No revision specified. Using HEAD: %s', head_rev)
|
||||
new_cr_rev = head_rev
|
||||
|
||||
new_third_party_rev = opts.third_party_revision
|
||||
if not new_third_party_rev:
|
||||
stdout, _ = _RunCommand(
|
||||
['git', 'ls-remote', CHROMIUM_THIRD_PARTY_URL, 'HEAD'])
|
||||
new_third_party_rev = stdout.strip().split('\t')[0]
|
||||
logging.info(
|
||||
'No third_party revision specified. Using HEAD: %s',
|
||||
new_third_party_rev)
|
||||
|
||||
return ChromiumRevisionUpdate(current_cr_rev, new_cr_rev,
|
||||
current_third_party_rev,
|
||||
new_third_party_rev)
|
||||
return ChromiumRevisionUpdate(current_cr_rev, new_cr_rev)
|
||||
|
||||
|
||||
def main():
|
||||
@ -561,9 +492,6 @@ def main():
|
||||
p.add_argument('-r', '--revision',
|
||||
help=('Chromium Git revision to roll to. Defaults to the '
|
||||
'Chromium HEAD revision if omitted.'))
|
||||
p.add_argument('--third-party-revision',
|
||||
help=('Chromium third_party Git revision to roll to. Default '
|
||||
'to the Chromium third_party HEAD revision if omitted.'))
|
||||
p.add_argument('-u', '--rietveld-email',
|
||||
help=('E-mail address to use for creating the CL at Rietveld'
|
||||
'If omitted a previously cached one will be used or an '
|
||||
@ -603,15 +531,6 @@ def main():
|
||||
|
||||
deps_filename = os.path.join(CHECKOUT_SRC_DIR, 'DEPS')
|
||||
webrtc_deps = ParseLocalDepsFile(deps_filename)
|
||||
cr_3p_repo = os.path.join(CHECKOUT_SRC_DIR, 'third_party_chromium')
|
||||
if not os.path.exists(cr_3p_repo):
|
||||
raise RollError('missing third_party_chromium/. '
|
||||
'Please add this to your gclient: \n'
|
||||
'"custom_vars": {\n'
|
||||
' "roll_chromium_into_webrtc": True,\n'
|
||||
'},\n'
|
||||
'Then run "gclient sync" again.')
|
||||
|
||||
rev_update = GetRollRevisionRanges(opts, webrtc_deps)
|
||||
|
||||
current_commit_pos = ParseCommitPosition(
|
||||
@ -628,12 +547,6 @@ def main():
|
||||
logging.debug('Commit message:\n%s', commit_msg)
|
||||
|
||||
_CreateRollBranch(opts.dry_run)
|
||||
third_party_chromium_deps_list = os.path.join(
|
||||
CHECKOUT_SRC_DIR, 'THIRD_PARTY_CHROMIUM_DEPS.json')
|
||||
UpdateThirdPartyDeps(rev_update.new_third_party_rev,
|
||||
os.path.join(CHECKOUT_SRC_DIR, 'third_party'),
|
||||
cr_3p_repo,
|
||||
third_party_chromium_deps_list)
|
||||
UpdateDepsFile(deps_filename, rev_update, changed_deps)
|
||||
if _IsTreeClean():
|
||||
logging.info("No DEPS changes detected, skipping CL creation.")
|
||||
|
||||
Reference in New Issue
Block a user