Commit 801c2021 authored by Corentin Wallez's avatar Corentin Wallez Committed by LUCI CQ

gclient: deprecated use_relative_hooks

And merge it in use_relative_paths. In all Chromium repos,
use_relative_hooks is True iff:

 - use_relative_paths is True, and
 - there is at least one hook

It makes sense that you'd want to use relative hooks if you use relative
paths so this CL merges both flags into use_relative_paths.

Bug: chromium:1107325
Change-Id: I0fe40eba1e1c61be26c812c7ca4329efb72c7f90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2306795
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent b655a28e
......@@ -793,13 +793,12 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self._postprocess_deps(deps, rel_prefix), self._use_relative_paths)
# compute which working directory should be used for hooks
use_relative_hooks = local_scope.get('use_relative_hooks', False)
if local_scope.get('use_relative_hooks', False):
print('use_relative_hooks is deprecated, please remove it from DEPS. ' +
'(it was merged in use_relative_paths)')
hooks_cwd = self.root.root_dir
if use_relative_hooks:
if not self._use_relative_paths:
raise gclient_utils.Error(
'ParseDepsFile(%s): use_relative_hooks must be used with '
'use_relative_paths' % self.name)
if self._use_relative_paths:
hooks_cwd = os.path.join(hooks_cwd, self.name)
logging.warning('Updating hook base working directory to %s.',
hooks_cwd)
......
......@@ -688,7 +688,7 @@ hooks = [{
'origin': 'git/repo_14@2\n'
})
# A repo with a hook to be recursed in, without use_relative_hooks
# A repo with a hook to be recursed in, without use_relative_paths
self._commit_git('repo_15', {
'DEPS': textwrap.dedent("""\
hooks = [{
......@@ -698,11 +698,10 @@ hooks = [{
}]"""),
'origin': 'git/repo_15@2\n'
})
# A repo with a hook to be recursed in, with use_relative_hooks
# A repo with a hook to be recursed in, with use_relative_paths
self._commit_git('repo_16', {
'DEPS': textwrap.dedent("""\
use_relative_paths=True
use_relative_hooks=True
hooks = [{
"name": "relative_cwd",
"pattern": ".",
......
......@@ -389,7 +389,7 @@ class GclientTest(trial_dir.TestCase):
def testRecurseDepsAndHooksCwd(self):
"""Verifies that hooks run in the correct directory with our without
use_relative_hooks"""
use_relative_paths"""
write(
'.gclient',
'solutions = [\n'
......@@ -417,7 +417,6 @@ class GclientTest(trial_dir.TestCase):
write(
os.path.join('foo', 'baz', 'DEPS'),
'use_relative_paths=True\n'
'use_relative_hooks=True\n'
'hooks = [{\n'
' "name": "lazors",\n'
' "pattern": ".",\n'
......
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