Commit c6846aa2 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Commit Bot

gclient flatten: fix a bug with deps_os getting omitted for recursed deps

Bug: 570091
Change-Id: I4fac33ca683ff2011fa7307d5175592f3d9e258e
Reviewed-on: https://chromium-review.googlesource.com/560171Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
parent 4baaa11c
......@@ -1825,9 +1825,7 @@ def _FlattenDep(dep, allowed_hosts, deps, deps_os, hooks, hooks_os,
_AddDep(dep, allowed_hosts, deps, unpinned_deps)
for dep_os, os_deps in dep.os_dependencies.iteritems():
for os_dep in os_deps:
deps_os.setdefault(dep_os, {})[os_dep.name] = os_dep
_FlattenDepsOs(dep, deps_os)
deps_by_name = dict((d.name, d) for d in dep.dependencies)
for recurse_dep_name in (dep.recursedeps or []):
......@@ -1860,11 +1858,29 @@ def _FlattenRecurse(dep, allowed_hosts, deps, deps_os, hooks, hooks_os,
"""
logging.debug('_FlattenRecurse(%r)', dep)
_FlattenDepsOs(dep, deps_os)
for sub_dep in dep.orig_dependencies:
_FlattenDep(sub_dep, allowed_hosts, deps, deps_os, hooks, hooks_os,
pre_deps_hooks, unpinned_deps)
def _FlattenDepsOs(dep, deps_os):
"""Helper to add a dependency to flattened lists.
Arguments:
dep (Dependency): dependency to process
Out-parameters:
deps_os (dict): will be filled with flattened deps_os
"""
logging.debug('_FlattenDepsOs(%r)', dep)
for dep_os, os_deps in dep.os_dependencies.iteritems():
for os_dep in os_deps:
deps_os.setdefault(dep_os, {})[os_dep.name] = os_dep
def _AddDep(dep, allowed_hosts, deps, unpinned_deps):
"""Helper to add a dependency to flattened lists.
......
......@@ -298,7 +298,7 @@ class FakeReposBase(object):
class FakeRepos(FakeReposBase):
"""Implements populateGit()."""
NB_GIT_REPOS = 7
NB_GIT_REPOS = 8
def populateGit(self):
# Testing:
......@@ -473,6 +473,7 @@ deps = {
'url': '/repo_4',
'condition': 'False',
},
'src/repo8': '/repo_8',
}
deps_os ={
'mac': {
......@@ -513,6 +514,7 @@ hooks_os = {
}
recursedeps = [
'src/repo2',
'src/repo8',
]""" % {
'git_base': self.git_base,
'hash': self.git_hashes['repo_2'][1][0][:7]
......@@ -541,6 +543,19 @@ hooks = [
'origin': 'git/repo_7@1\n',
})
self._commit_git('repo_8', {
'DEPS': """
deps_os ={
'mac': {
'src/recursed_os_repo': '/repo_5',
},
'unix': {
'src/recursed_os_repo': '/repo_5',
},
}""",
'origin': 'git/repo_8@1\n',
})
class FakeRepoSkiaDEPS(FakeReposBase):
"""Simulates the Skia DEPS transition in Chrome."""
......
......@@ -609,6 +609,11 @@ class GClientSmokeGIT(GClientSmokeBase):
' "condition": "False",',
' },',
'',
' # src -> src/repo8',
' "src/repo8": {',
' "url": "/repo_8",',
' },',
'',
'}',
'',
'deps_os = {',
......@@ -618,9 +623,19 @@ class GClientSmokeGIT(GClientSmokeBase):
' "url": "/repo_5",',
' },',
'',
' # src -> src/repo8 -> src/recursed_os_repo',
' "src/recursed_os_repo": {',
' "url": "/repo_5",',
' },',
'',
' },',
'',
' "unix": {',
' # src -> src/repo8 -> src/recursed_os_repo',
' "src/recursed_os_repo": {',
' "url": "/repo_5",',
' },',
'',
' # src -> src/unix_repo',
' "src/unix_repo": {',
' "url": "/repo_5",',
......
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