From b848d5b7038c0f34844b45539f2ded797d33f6e8 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 10 Oct 2012 23:25:50 +0000 Subject: [PATCH] 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 --- gclient.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gclient.py b/gclient.py index c23b0023c..cef9f1afc 100644 --- a/gclient.py +++ b/gclient.py @@ -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)