Commit c401ad1c authored by cmp@chromium.org's avatar cmp@chromium.org

Update recurselist to be a set, call it recursedeps now.

Now that recurselist is no longer a list, it doesn't make
sense to call it recurselist.  recurseset is available, but
that's not as easy to read/say compared to recurselist.
Call this recursedeps, instead.

R=iannucci@chromium.org
BUG=390246

Review URL: https://codereview.chromium.org/363103002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@281107 0039d316-1c4b-4281-b951-d872f2087c98
parent aaee92f1
......@@ -311,10 +311,10 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# dependency. It is read from the actual DEPS file so cannot be set on
# class instantiation.
self.recursion_override = None
# recurselist is a mutable value that selectively overrides the default
# recursedeps is a mutable value that selectively overrides the default
# 'no recursion' setting on a dep-by-dep basis. It will replace
# recursion_override.
self.recurselist = None
self.recursedeps = None
if not self.name and self.parent:
raise gclient_utils.Error('Dependency without name')
......@@ -356,19 +356,19 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
return requirements
@property
def try_recurselist(self):
def try_recursedeps(self):
"""Returns False if recursion_override is ever specified."""
if self.recursion_override is not None:
return False
return self.parent.try_recurselist
return self.parent.try_recursedeps
@property
def recursion_limit(self):
"""Returns > 0 if this dependency is not too recursed to be processed."""
# We continue to support the absence of recurselist until tools and DEPS
# We continue to support the absence of recursedeps until tools and DEPS
# using recursion_override are updated.
if self.try_recurselist and self.parent.recurselist != None:
if self.name in self.parent.recurselist:
if self.try_recursedeps and self.parent.recursedeps != None:
if self.name in self.parent.recursedeps:
return 1
if self.recursion_override is not None:
......@@ -593,9 +593,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self.recursion_override = local_scope.get('recursion')
logging.warning(
'Setting %s recursion to %d.', self.name, self.recursion_limit)
self.recurselist = local_scope.get('recurselist', None)
if 'recurselist' in local_scope:
logging.warning('Found recurselist %r.', repr(self.recurselist))
self.recursedeps = local_scope.get('recursedeps', None)
if 'recursedeps' in local_scope:
logging.warning('Found recursedeps %r.', repr(self.recursedeps))
# If present, save 'target_os' in the local_target_os property.
if 'target_os' in local_scope:
self.local_target_os = local_scope['target_os']
......@@ -1490,8 +1490,8 @@ want to set 'managed': False in .gclient.
return self._recursion_limit
@property
def try_recurselist(self):
"""Whether to attempt using recurselist-style recursion processing."""
def try_recursedeps(self):
"""Whether to attempt using recursedeps-style recursion processing."""
return True
@property
......
......@@ -660,11 +660,11 @@ class GclientTest(trial_dir.TestCase):
],
self._get_processed())
def testRecurselistOverride(self):
"""Verifies gclient respects the |recurselist| var syntax.
def testRecursedepsOverride(self):
"""Verifies gclient respects the |recursedeps| var syntax.
This is what we mean to check here:
- |recurselist| = [...] on 2 levels means we pull exactly 3 deps
- |recursedeps| = {...} on 2 levels means we pull exactly 3 deps
(up to /fizz, but not /fuzz)
- pulling foo/bar with no recursion (in .gclient) is overriden by
a later pull of foo/bar with recursion (in the dep tree)
......@@ -683,13 +683,13 @@ class GclientTest(trial_dir.TestCase):
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recurselist = ["bar"]')
'recursedeps = {"bar"}')
write(
os.path.join('bar', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}\n'
'recurselist = ["baz"]')
'recursedeps = {"baz"}')
write(
os.path.join('baz', 'DEPS'),
'deps = {\n'
......@@ -720,37 +720,37 @@ class GclientTest(trial_dir.TestCase):
],
self._get_processed())
def testRecursionOverridesRecurselist(self):
"""Verifies gclient respects |recursion| over |recurselist|.
def testRecursionOverridesRecursedeps(self):
"""Verifies gclient respects |recursion| over |recursedeps|.
|recursion| is set in a top-level DEPS file. That value is meant
to affect how many subdeps are parsed via recursion.
|recurselist| is set in each DEPS file to control whether or not
|recursedeps| is set in each DEPS file to control whether or not
to recurse into the immediate next subdep.
This test verifies that if both syntaxes are mixed in a DEPS file,
we disable |recurselist| support and only obey |recursion|.
we disable |recursedeps| support and only obey |recursion|.
Since this setting is evaluated per DEPS file, recursed DEPS
files will each be re-evaluated according to the per DEPS rules.
So a DEPS that only contains |recurselist| could then override any
So a DEPS that only contains |recursedeps| could then override any
previous |recursion| setting. There is extra processing to ensure
this does not happen.
For this test to work correctly, we need to use a DEPS chain that
only contains recursion controls in the top DEPS file.
In foo, |recursion| and |recurselist| are specified. When we see
|recursion|, we stop trying to use |recurselist|.
In foo, |recursion| and |recursedeps| are specified. When we see
|recursion|, we stop trying to use |recursedeps|.
There are 2 constructions of DEPS here that are key to this test:
(1) In foo, if we used |recurselist| instead of |recursion|, we
(1) In foo, if we used |recursedeps| instead of |recursion|, we
would also pull in bar. Since bar's DEPS doesn't contain any
recursion statements, we would stop processing at bar.
(2) In fizz, if we used |recurselist| at all, we should pull in
(2) In fizz, if we used |recursedeps| at all, we should pull in
fuzz.
We expect to keep going past bar (satisfying 1) and we don't
......@@ -768,7 +768,7 @@ class GclientTest(trial_dir.TestCase):
' "bar": "/bar",\n'
'}\n'
'recursion = 3\n'
'recurselist = ["bar"]')
'recursedeps = {"bar"}')
write(
os.path.join('bar', 'DEPS'),
'deps = {\n'
......@@ -784,7 +784,7 @@ class GclientTest(trial_dir.TestCase):
'deps = {\n'
' "fuzz": "/fuzz",\n'
'}\n'
'recurselist = ["fuzz"]')
'recursedeps = {"fuzz"}')
write(
os.path.join('fuzz', 'DEPS'),
'deps = {\n'
......@@ -800,11 +800,11 @@ class GclientTest(trial_dir.TestCase):
'svn://example.com/bar',
'svn://example.com/foo/bar',
# Deps after this would have been skipped if we were obeying
# |recurselist|.
# |recursedeps|.
'svn://example.com/foo/bar/baz',
'svn://example.com/foo/bar/baz/fizz',
# And this dep would have been picked up if we were obeying
# |recurselist|.
# |recursedeps|.
# 'svn://example.com/foo/bar/baz/fuzz',
],
self._get_processed())
......
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