Commit 64e33cba authored by John Budorick's avatar John Budorick Committed by Commit Bot

Fix gclient flattening of CIPD deps.

Bug: 813460
Change-Id: Ie52a20dcdf5cb60ab47b787dcfa05aa8a712a727
Reviewed-on: https://chromium-review.googlesource.com/926709Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
parent 7707c8a1
......@@ -1918,8 +1918,10 @@ class CipdDependency(Dependency):
])
for p in self._cipd_root.packages(self._cipd_subdir):
s.extend([
' "package": "%s",' % p.name,
' "version": "%s",' % p.version,
' {',
' "package": "%s",' % p.name,
' "version": "%s",' % p.version,
' },',
])
s.extend([
' ],',
......
......@@ -15,6 +15,7 @@ import re
import socket
import sys
import tempfile
import textwrap
import time
# trial_dir must be first for non-system libraries.
......@@ -304,7 +305,7 @@ class FakeReposBase(object):
class FakeRepos(FakeReposBase):
"""Implements populateGit()."""
NB_GIT_REPOS = 13
NB_GIT_REPOS = 14
def populateGit(self):
# Testing:
......@@ -695,6 +696,22 @@ deps = {
'origin': 'git/repo_13@2\n',
})
self._commit_git('repo_14', {
'DEPS': textwrap.dedent("""\
deps = {
'src/cipd_dep': {
'packages': [
{
'package': 'package0',
'version': '0.1',
},
],
'dep_type': 'cipd',
},
}"""),
'origin': 'git/repo_14@2\n'
})
class FakeRepoSkiaDEPS(FakeReposBase):
"""Simulates the Skia DEPS transition in Chrome."""
......
......@@ -1116,6 +1116,43 @@ class GClientSmokeGIT(GClientSmokeBase):
{'url': 'git://127.0.0.1:20000/git/repo_9', 'deps_file': 'DEPS'},
], deps_files_contents)
def testFlattenCipd(self):
if not self.enabled:
return
output_deps = os.path.join(self.root_dir, 'DEPS.flattened')
self.assertFalse(os.path.exists(output_deps))
self.gclient(['config', self.git_base + 'repo_14', '--name', 'src'])
self.gclient(['sync'])
self.gclient(['flatten', '-v', '-v', '-v', '--output-deps', output_deps])
with open(output_deps) as f:
deps_contents = f.read()
self.maxDiff = None
self.assertEqual([
'deps = {',
' # src',
' "src": {',
' "url": "git://127.0.0.1:20000/git/repo_14",',
' },',
'',
' # src -> src/cipd_dep',
' "src/cipd_dep": {',
' "packages": [',
' {',
' "package": "package0",',
' "version": "0.1",',
' },',
' ],',
' "dep_type": "cipd",',
' },',
'',
'}',
''
], deps_contents.splitlines())
class GClientSmokeGITMutates(GClientSmokeBase):
"""testRevertAndStatus mutates the git repo so move it to its own suite."""
......
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