Revert "gclient: Add commands to edit dependencies and variables in DEPS"
This reverts commit 7f4c905fc53e7cbcc3277074c6a339ade8bc0f66.
Reason for revert:
When running "gclient sync" on a V8 checkout, it says:
File "/work/chrome/depot_tools/gclient.py", line 995, in run
self.ParseDepsFile()
File "/work/chrome/depot_tools/gclient.py", line 874, in ParseDepsFile
self._postprocess_deps(deps, rel_prefix), use_relative_paths)
File "/work/chrome/depot_tools/gclient.py", line 660, in _postprocess_deps
dval['condition'], self.condition)
TypeError: '_NodeDict' object does not support item assignment
on the recursive descent into third_party/android_tools/DEPS. Any chance that's related to https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/950405 ?
Original change's description:
> gclient: Add commands to edit dependencies and variables in DEPS
>
> Adds 'gclient setvar' and 'gclient setdep' commands to edit variables
> and dependencies in a DEPS file.
>
> Bug: 760633
> Change-Id: I6c0712cc079dbbbaee6541b7eda71f4b4813b77b
> Reviewed-on: https://chromium-review.googlesource.com/950405
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>
TBR=agable@chromium.org,ehmaldonado@chromium.org
Change-Id: If58f6b15d31b19fc53294f1e41d26b4e684a2cf9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 760633
Reviewed-on: https://chromium-review.googlesource.com/969165
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/gclient.py b/gclient.py
index 4c02db4..21eeeb5 100755
--- a/gclient.py
+++ b/gclient.py
@@ -804,7 +804,7 @@
self._gn_args_file = local_scope.get('gclient_gn_args_file')
self._gn_args = local_scope.get('gclient_gn_args', [])
- self._vars = dict(local_scope.get('vars', {}))
+ self._vars = local_scope.get('vars', {})
if self.parent:
for key, value in self.parent.get_vars().iteritems():
if key in self._vars:
@@ -2822,62 +2822,6 @@
return 0
-def CMDsetdep(parser, args):
- parser.add_option('--var', action='append',
- dest='vars', metavar='VAR=VAL', default=[],
- help='Sets a variable to the given value with the format '
- 'name=value.')
- parser.add_option('-r', '--revision', action='append',
- dest='revisions', metavar='DEP@REV', default=[],
- help='Sets the revision/version for the dependency with '
- 'the format dep@rev. If it is a git dependency, dep '
- 'must be a path and rev must be a git hash or '
- 'reference (e.g. src/dep@deadbeef). If it is a CIPD '
- 'dependency, dep must be of the form path:package and '
- 'rev must be the package version '
- '(e.g. src/pkg:chromium/pkg@2.1-cr0).')
- parser.add_option('--deps-file', default='DEPS',
- # TODO(ehmaldonado): Try to find the DEPS file pointed by
- # .gclient first.
- help='The DEPS file to be edited. Defaults to the DEPS '
- 'file in the current directory.')
- (options, args) = parser.parse_args(args)
-
- global_scope = {'Var': lambda var: '{%s}' % var}
-
- if not os.path.isfile(options.deps_file):
- raise gclient_utils.Error(
- 'DEPS file %s does not exist.' % options.deps_file)
- with open(options.deps_file) as f:
- contents = f.read()
- local_scope = gclient_eval.Exec(contents, global_scope, {})
-
- for var in options.vars:
- name, _, value = var.partition('=')
- if not name or not value:
- raise gclient_utils.Error(
- 'Wrong var format: %s should be of the form name=value.' % var)
- gclient_eval.SetVar(local_scope, name, value)
-
- for revision in options.revisions:
- name, _, value = revision.partition('@')
- if not name or not value:
- raise gclient_utils.Error(
- 'Wrong dep format: %s should be of the form dep@rev.' % revision)
- if ':' in name:
- name, _, package = name.partition(':')
- if not name or not package:
- raise gclient_utils.Error(
- 'Wrong CIPD format: %s:%s should be of the form path:pkg@version.'
- % (name, package))
- gclient_eval.SetCIPD(local_scope, name, package, value)
- else:
- gclient_eval.SetRevision(local_scope, global_scope, name, value)
-
- with open(options.deps_file) as f:
- f.write(gclient_eval.RenderDEPSFile(local_scope))
-
-
def CMDverify(parser, args):
"""Verifies the DEPS file deps are only from allowed_hosts."""
(options, args) = parser.parse_args(args)