'dep_os' paths override 'deps' paths.

BUG=157979


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@166247 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
sivachandra@chromium.org 13 years ago
parent c37b2817b0
commit a0ad8ad9c9

@ -477,6 +477,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self.local_target_os = local_scope['target_os']
# load os specific dependencies if defined. these dependencies may
# override or extend the values defined by the 'deps' member.
target_os_deps = {}
if 'deps_os' in local_scope:
for deps_os_key in self.target_os:
os_deps = local_scope['deps_os'].get(deps_os_key, {})
@ -485,9 +486,13 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# platform, so we collect the broadest set of dependencies
# available. We may end up with the wrong revision of something for
# our platform, but this is the best we can do.
deps.update([x for x in os_deps.items() if not x[0] in deps])
target_os_deps.update(
[x for x in os_deps.items() if not x[0] in target_os_deps])
else:
deps.update(os_deps)
target_os_deps.update(os_deps)
# deps_os overrides paths from deps
deps.update(target_os_deps)
# If a line is in custom_deps, but not in the solution, we want to append
# this line to the solution.

@ -425,6 +425,46 @@ class GclientTest(trial_dir.TestCase):
],
sorted(self._get_processed()))
def testDepsOsOverrideDepsInDepsFile(self):
"""Verifies that a 'deps_os' path can override a 'deps' path.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' },]\n')
write(
os.path.join('foo', 'DEPS'),
'target_os = ["baz"]\n'
'deps = {\n'
' "foo/src": "/src",\n' # This path is to be overridden by similar path
# in deps_os['unix'].
'}\n'
'deps_os = {\n'
' "unix": { "foo/unix": "/unix",'
' "foo/src": "/src_unix"},\n'
' "baz": { "foo/baz": "/baz", },\n'
' "jaz": { "foo/jaz": "/jaz", },\n'
'}')
parser = gclient.Parser()
options, _ = parser.parse_args(['--jobs', '1'])
options.deps_os = 'unix'
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEqual(['unix'], sorted(obj.enforced_os))
self.assertEquals(
[
'svn://example.com/foo',
'svn://example.com/foo/baz',
'svn://example.com/foo/src_unix',
'svn://example.com/foo/unix',
],
sorted(self._get_processed()))
def testRecursionOverride(self):
"""Verifies gclient respects the recursion var syntax.

Loading…
Cancel
Save