Commit 810598d1 authored by Aravind Vasudevan's avatar Aravind Vasudevan Committed by LUCI CQ

Add protocol_override entry to .gclient

The meta quest browser has an issue with the initial design where the all the dependencies within the same tree are overridden with the solution URL's scheme. This fix updates fetch to add a .gclient entry instead of implicitly overriding the URL's scheme.

Bug: 1336027
Change-Id: Iabe5b9017f6eb9e682a0c721f43dd5f347ffcbfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3703942Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
parent 544594e0
......@@ -265,11 +265,10 @@ def run(options, spec, root):
os.getcwd().startswith('/google/src/cloud'):
options.protocol_override = 'sso'
# Replace https using the protocol specified in --protocol-override
# Update solutions with protocol_override field
if options.protocol_override is not None:
for solution in checkout_spec['solutions']:
solution['url'] = re.sub(
'^([a-z]+):', options.protocol_override + ':', solution['url'])
solution['protocol_override'] = options.protocol_override
try:
checkout = CheckoutFactory(checkout_type, options, checkout_spec, root)
......
......@@ -693,7 +693,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
GitDependency(
parent=self,
name=name,
# Update URL with parent dep's protocol
# Update URL with scheme in protocol_override
url=GitDependency.updateProtocol(url, self.protocol),
managed=True,
custom_deps=None,
......@@ -1446,14 +1446,6 @@ solutions = %(solution_list)s
self._cipd_root = None
self.config_content = None
@staticmethod
def _getScheme(url):
"""Returns the scheme part of the given URL"""
if not url or not re.match('^([a-z]+)://', url):
return None
return url.split('://')[0]
def _CheckConfig(self):
"""Verify that the config matches the state of the existing checked-out
solutions."""
......@@ -1536,7 +1528,9 @@ it or fix the checkout.
deps_to_add.append(GitDependency(
parent=self,
name=s['name'],
url=s['url'],
# Update URL with scheme in protocol_override
url=GitDependency.updateProtocol(
s['url'], s.get('protocol_override', None)),
managed=s.get('managed', True),
custom_deps=s.get('custom_deps', {}),
custom_vars=s.get('custom_vars', {}),
......@@ -1547,8 +1541,8 @@ it or fix the checkout.
relative=None,
condition=None,
print_outbuf=True,
# Pass parent URL protocol down the tree for child deps to use.
protocol=GClient._getScheme(s['url'])))
# Pass protocol_override down the tree for child deps to use.
protocol=s.get('protocol_override', None)))
except KeyError:
raise gclient_utils.Error('Invalid .gclient file. Solution is '
'incomplete: %s' % s)
......@@ -1777,7 +1771,7 @@ it or fix the checkout.
GitDependency(
parent=self,
name=entry,
# Update URL with parent dep's protocol
# Update URL with scheme in protocol_override
url=GitDependency.updateProtocol(prev_url, self.protocol),
managed=False,
custom_deps={},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment