Commit aae6725f authored by Aravind Vasudevan's avatar Aravind Vasudevan Committed by LUCI CQ

Fix recursedeps to be overridden using custom_deps in windows

R=gavinmak@google.com
Change-Id: Ibae42b9533b0da526c3a534cd327806611216327
Bug: 1215885
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3335580Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
parent 02d65eaf
......@@ -467,7 +467,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
def _OverrideUrl(self):
"""Resolves the parsed url from the parent hierarchy."""
parsed_url = self.get_custom_deps(self._name, self.url)
parsed_url = self.get_custom_deps(
self._name.replace(os.sep, posixpath.sep) \
if self._name else self._name, self.url)
if parsed_url != self.url:
logging.info('Dependency(%s)._OverrideUrl(%s) -> %s', self._name,
self.url, parsed_url)
......
......@@ -840,6 +840,43 @@ class GclientTest(trial_dir.TestCase):
],
self._get_processed())
def testRecursedepsCustomdepsOverride(self):
"""Verifies gclient overrides deps within recursedeps using custom deps"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' "custom_deps": {\n'
' "foo/bar": "svn://example.com/override",\n'
' },\n'
' },]\n')
write(
os.path.join('foo', 'DEPS'),
'use_relative_paths = True\n'
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursedeps = ["bar"]')
write(
os.path.join('foo', 'bar', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEqual(
[
('foo', 'svn://example.com/foo'),
(os.path.join('foo', 'bar'), 'svn://example.com/override'),
(os.path.join('foo', 'foo', 'bar'), 'svn://example.com/override'),
(os.path.join('foo', 'baz'), 'svn://example.com/baz'),
],
self._get_processed())
def testRelativeRecursion(self):
"""Verifies that nested use_relative_paths is always respected."""
write(
......
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