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>
diff --git a/gclient.py b/gclient.py
index 3a70aa9..f8df1ac 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1858,6 +1858,9 @@
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 @@
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,
' },',
])