Commit c35aba51 authored by John Budorick's avatar John Budorick Committed by Commit Bot

gclient: escape cipd variables when flattening DEPS.

crrev.com/c/1097623 broke the official bots because the cipd variable
escaping present in the normal DEPS file wasn't present in the flattened
DEPS file.

Change-Id: Iaae8b95a9d8c5ce0ed80071169e731a24e98b4c4
Reviewed-on: https://chromium-review.googlesource.com/1112935
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent 589ac56c
......@@ -1858,6 +1858,9 @@ class CipdDependency(Dependency):
def ToLines(self):
"""Return a list of lines representing this in a DEPS file."""
def escape_cipd_var(package):
return package.replace('{', '{{').replace('}', '}}')
s = []
self._CreatePackageIfNecessary()
if self._cipd_package.authority_for_subdir:
......@@ -1873,7 +1876,7 @@ class CipdDependency(Dependency):
cmp=lambda x, y: cmp(x.name, y.name)):
s.extend([
' {',
' "package": "%s",' % p.name,
' "package": "%s",' % escape_cipd_var(p.name),
' "version": "%s",' % p.version,
' },',
])
......
......@@ -730,6 +730,7 @@ deps = {
self._commit_git('repo_14', {
'DEPS': textwrap.dedent("""\
vars = {}
deps = {
'src/cipd_dep': {
'packages': [
......@@ -753,6 +754,15 @@ deps = {
],
'dep_type': 'cipd',
},
'src/cipd_dep_with_cipd_variable': {
'packages': [
{
'package': 'package3/${{platform}}',
'version': '1.2',
},
],
'dep_type': 'cipd',
},
}"""),
'origin': 'git/repo_14@2\n'
})
......
......@@ -1423,6 +1423,17 @@ class GClientSmokeGIT(GClientSmokeBase):
' "dep_type": "cipd",',
' },',
'',
' # src -> src/cipd_dep_with_cipd_variable',
' "src/cipd_dep_with_cipd_variable": {',
' "packages": [',
' {',
' "package": "package3/${{platform}}",',
' "version": "1.2",',
' },',
' ],',
' "dep_type": "cipd",',
' },',
'',
'}',
'',
'# ' + self.git_base + 'repo_14, DEPS',
......@@ -1797,6 +1808,9 @@ class GClientSmokeCipd(GClientSmokeBase):
'@Subdir src/cipd_dep',
'package0 0.1',
'',
'@Subdir src/cipd_dep_with_cipd_variable',
'package3/${platform} 1.2',
'',
], 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