Commit b848d5b7 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix multi-solution use case with conflicting custom_deps overrides.

Let's say there's 2 solutions, solA and solB, both fetching the dependency depA
with different urls, solA has 'depA': 'http://foo/bar' and solB has 'depA':
From('depB', 'bar').

This case used to not work, because LateOverride() was not called in
verify_validity(), so it was not comparing the resolved urls but instead what is
textually specified in both DEPS files.

Also because LateOverride() was not called, verify_validity() was comparing the
original urls even if custom_deps is specified in the solution(s).

Finally, allow one to mismatch the other IFF one is None.

R=szager@chromium.org
BUG=


Review URL: https://chromiumcodereview.appspot.com/11088023

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@161228 0039d316-1c4b-4281-b951-d872f2087c98
parent d3734c9c
......@@ -325,10 +325,20 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# This require a full tree traversal with locks.
siblings = [d for d in self.root.subtree(False) if d.name == self.name]
for sibling in siblings:
if self.url != sibling.url:
self_url = self.LateOverride(self.url)
sibling_url = sibling.LateOverride(sibling.url)
# Allow to have only one to be None or ''.
if self_url != sibling_url and bool(self_url) == bool(sibling_url):
raise gclient_utils.Error(
'Dependency %s specified more than once:\n %s\nvs\n %s' %
(self.name, sibling.hierarchy(), self.hierarchy()))
('Dependency %s specified more than once:\n'
' %s [%s]\n'
'vs\n'
' %s [%s]') % (
self.name,
sibling.hierarchy(),
sibling_url,
self.hierarchy(),
self_url))
# In theory we could keep it as a shadow of the other one. In
# practice, simply ignore it.
logging.warn('Won\'t process duplicate dependency %s' % sibling)
......
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