mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
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: Edward Lesmes <ehmaldonado@chromium.org> Reviewed-by: Aaron Gable <agable@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
589ac56c23
commit
c35aba51d3
@@ -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())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user