gclient: Fix for extra custom_deps.

Custom deps not present in DEPS files cause errors when syncing, since
we add them as strings in postprocess_deps, but deps_to_objects expects
a dictionary.

TBR=agable@chromium.org

Bug: 839925
Change-Id: Ic08a83e8692f1bf90d4456c72fe99493363ba747
Reviewed-on: https://chromium-review.googlesource.com/1063326
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
changes/26/1063326/6
Edward Lemur 7 years ago committed by Commit Bot
parent ed1bb34fc5
commit 23a358764d

@ -591,9 +591,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# If a line is in custom_deps, but not in the solution, we want to append
# this line to the solution.
for d in self.custom_deps:
if d not in deps:
deps[d] = self.custom_deps[d]
for dep_name, dep_info in self.custom_deps.iteritems():
if dep_name not in deps:
deps[dep_name] = {'url': dep_info, 'dep_type': 'git'}
# Make child deps conditional on any parent conditions. This ensures that,
# when flattened, recursed entries have the correct restrictions, even if

@ -5,4 +5,4 @@ Once upon a time, a budding web browser dev team needed a CI system.
All they had was one poor machine under a desk, and its name was Batty,
the Build and Test Yeti.
As the CI needs of the browser grew,
As the CI needs of the browser grew, Batty, the Build and Test Yeti,

@ -504,11 +504,54 @@ class GclientTest(trial_dir.TestCase):
[None, 'checkout_blorp'])
def testOverride(self):
"""Verifies expected behavior of OverrideURL."""
url = "git@github.com:dart-lang/spark.git"
d = gclient.Dependency(None, 'name', url, url,
None, None, None, None, '', True, False, None, True)
self.assertEquals(url, d.url)
"""Verifies expected behavior of URL overrides."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' "custom_deps": {\n'
' "foo/bar": "svn://example.com/override",\n'
' "foo/skip2": None,\n'
' "foo/new": "svn://example.com/new",\n'
' },\n'
' },]\n')
write(
os.path.join('foo', 'DEPS'),
'vars = {\n'
' "origin": "svn://example.com",\n'
'}\n'
'deps = {\n'
' "foo/skip": None,\n'
' "foo/bar": "{origin}/bar",\n'
' "foo/baz": "{origin}/baz",\n'
' "foo/skip2": "{origin}/skip2",\n'
' "foo/rel": "/rel",\n'
'}')
parser = gclient.OptionParser()
options, _ = parser.parse_args(['--jobs', '1'])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
sol = obj.dependencies[0]
self.assertEqual([
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/override'),
('foo/baz', 'svn://example.com/baz'),
('foo/new', 'svn://example.com/new'),
('foo/rel', 'svn://example.com/rel'),
], self._get_processed())
self.assertEqual(6, len(sol.dependencies))
self.assertEqual([
('foo/bar', 'svn://example.com/override'),
('foo/baz', 'svn://example.com/baz'),
('foo/new', 'svn://example.com/new'),
('foo/rel', 'svn://example.com/rel'),
('foo/skip', None),
('foo/skip2', None),
], [(dep.name, dep.url) for dep in sol.dependencies])
def testDepsOsOverrideDepsInDepsFile(self):
"""Verifies that a 'deps_os' path cannot override a 'deps' path. Also

Loading…
Cancel
Save