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