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

gclient flatten: include info about DEPS files: repos and paths

This CL includes this as comments in flattened DEPS, as requested
on the bug. For automated processes using this, we should export
the data in machine-readable form outside of the DEPS file.

Bug: 756474, 570091
Change-Id: I78cd2105113f41d599e293e772e1f1ca42679f3c
Reviewed-on: https://chromium-review.googlesource.com/621726Reviewed-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 adae2a62
......@@ -1764,12 +1764,21 @@ class Flattener(object):
for os_deps in self._deps_os.itervalues():
for dep in os_deps.itervalues():
# OS-specific deps need to have their full URL resolved manually.
assert not dep.parsed_url, (dep, dep.parsed_url)
dep._parsed_url = dep.LateOverride(dep.url)
self._pin_dep(dep)
deps_files = set()
def add_deps_file(dep):
deps_path = os.path.join(self._client.root_dir, dep.name, dep.deps_file)
if not os.path.exists(deps_path):
return
assert dep.parsed_url
deps_files.add((dep.parsed_url, dep.deps_file))
for dep in self._deps.itervalues():
add_deps_file(dep)
for os_deps in self._deps_os.itervalues():
for dep in os_deps.itervalues():
add_deps_file(dep)
self._deps_string = '\n'.join(
_GNSettingsToLines(
self._client.dependencies[0]._gn_args_file,
......@@ -1781,6 +1790,8 @@ class Flattener(object):
_HooksToLines('pre_deps_hooks', self._pre_deps_hooks) +
_HooksOsToLines(self._hooks_os) +
_VarsToLines(self._vars) +
['# %s, %s' % (url, deps_file)
for url, deps_file in sorted(deps_files)] +
['']) # Ensure newline at end of file.
def _add_dep(self, dep):
......@@ -1806,6 +1817,10 @@ class Flattener(object):
self._deps_os.get(dep_os, {}).get(os_dep.name) == os_dep), (
os_dep.name, self._deps_os.get(dep_os, {}).get(os_dep.name))
if os_dep.url:
# OS-specific deps need to have their full URL resolved manually.
assert not os_dep.parsed_url, (os_dep, os_dep.parsed_url)
os_dep._parsed_url = os_dep.LateOverride(os_dep.url)
self._deps_os.setdefault(dep_os, {})[os_dep.name] = os_dep
def _flatten_dep(self, dep, dep_os=None):
......
......@@ -717,6 +717,11 @@ class GClientSmokeGIT(GClientSmokeBase):
'',
'}',
'',
'# git://127.0.0.1:20000/git/repo_2@%s, DEPS' % (
self.githash('repo_2', 1)[:7]),
'# git://127.0.0.1:20000/git/repo_5, DEPS',
'# git://127.0.0.1:20000/git/repo_6, DEPS',
'# git://127.0.0.1:20000/git/repo_8, DEPS'
], deps_contents.splitlines())
def testFlattenPinAllDeps(self):
......@@ -869,6 +874,14 @@ class GClientSmokeGIT(GClientSmokeBase):
'',
'}',
'',
'# git://127.0.0.1:20000/git/repo_2@%s, DEPS' % (
self.githash('repo_2', 1)),
'# git://127.0.0.1:20000/git/repo_5@%s, DEPS' % (
self.githash('repo_5', 3)),
'# git://127.0.0.1:20000/git/repo_6@%s, DEPS' % (
self.githash('repo_6', 1)),
'# git://127.0.0.1:20000/git/repo_8@%s, DEPS' % (
self.githash('repo_8', 1)),
], deps_contents.splitlines())
def testFlattenRecursedeps(self):
......@@ -964,6 +977,13 @@ class GClientSmokeGIT(GClientSmokeBase):
'',
'}',
'',
'# git://127.0.0.1:20000/git/repo_10, DEPS',
'# git://127.0.0.1:20000/git/repo_11, DEPS',
'# git://127.0.0.1:20000/git/repo_5, DEPS',
'# git://127.0.0.1:20000/git/repo_6, DEPS',
'# git://127.0.0.1:20000/git/repo_7, DEPS',
'# git://127.0.0.1:20000/git/repo_8, DEPS',
'# git://127.0.0.1:20000/git/repo_9, DEPS',
], deps_contents.splitlines())
......
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