|
|
@ -358,7 +358,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent, name, url, managed, custom_deps,
|
|
|
|
def __init__(self, parent, name, url, managed, custom_deps,
|
|
|
|
custom_vars, custom_hooks, deps_file, should_process,
|
|
|
|
custom_vars, custom_hooks, deps_file, should_process,
|
|
|
|
relative, condition, print_outbuf=False):
|
|
|
|
should_recurse, relative, condition, print_outbuf=False):
|
|
|
|
gclient_utils.WorkItem.__init__(self, name)
|
|
|
|
gclient_utils.WorkItem.__init__(self, name)
|
|
|
|
DependencySettings.__init__(
|
|
|
|
DependencySettings.__init__(
|
|
|
|
self, parent, url, managed, custom_deps, custom_vars,
|
|
|
|
self, parent, url, managed, custom_deps, custom_vars,
|
|
|
@ -402,17 +402,14 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
# unavailable
|
|
|
|
# unavailable
|
|
|
|
self._got_revision = None
|
|
|
|
self._got_revision = None
|
|
|
|
|
|
|
|
|
|
|
|
# This is a mutable value that overrides the normal recursion limit for this
|
|
|
|
|
|
|
|
# dependency. It is read from the actual DEPS file so cannot be set on
|
|
|
|
|
|
|
|
# class instantiation.
|
|
|
|
|
|
|
|
self.recursion_override = None
|
|
|
|
|
|
|
|
# recursedeps 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.
|
|
|
|
# recursion_override.
|
|
|
|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# It will be a dictionary of {deps_name: {"deps_file": depfile_name}} or
|
|
|
|
# It will be a dictionary of {deps_name: depfile_namee}
|
|
|
|
# None.
|
|
|
|
self.recursedeps = {}
|
|
|
|
self.recursedeps = None
|
|
|
|
|
|
|
|
|
|
|
|
# Whether we should process this dependency's DEPS file.
|
|
|
|
|
|
|
|
self._should_recurse = should_recurse
|
|
|
|
|
|
|
|
|
|
|
|
self._OverrideUrl()
|
|
|
|
self._OverrideUrl()
|
|
|
|
# This is inherited from WorkItem. We want the URL to be a resource.
|
|
|
|
# This is inherited from WorkItem. We want the URL to be a resource.
|
|
|
@ -497,9 +494,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
# This becomes messy for >2 depth as the DEPS file format is a dictionary,
|
|
|
|
# This becomes messy for >2 depth as the DEPS file format is a dictionary,
|
|
|
|
# thus unsorted, while the .gclient format is a list thus sorted.
|
|
|
|
# thus unsorted, while the .gclient format is a list thus sorted.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# * _recursion_limit is hard coded 2 and there is no hope to change this
|
|
|
|
|
|
|
|
# value.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Interestingly enough, the following condition only works in the case we
|
|
|
|
# Interestingly enough, the following condition only works in the case we
|
|
|
|
# want: self is a 2nd level node. 3nd level node wouldn't need this since
|
|
|
|
# want: self is a 2nd level node. 3nd level node wouldn't need this since
|
|
|
|
# they already have their parent as a requirement.
|
|
|
|
# they already have their parent as a requirement.
|
|
|
@ -517,24 +511,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
return requirements
|
|
|
|
return requirements
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def try_recursedeps(self):
|
|
|
|
def should_recurse(self):
|
|
|
|
"""Returns False if recursion_override is ever specified."""
|
|
|
|
return self._should_recurse
|
|
|
|
if self.recursion_override is not None:
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
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 recursedeps until tools and DEPS
|
|
|
|
|
|
|
|
# using recursion_override are updated.
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
return self.recursion_override
|
|
|
|
|
|
|
|
return max(self.parent.recursion_limit - 1, 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def verify_validity(self):
|
|
|
|
def verify_validity(self):
|
|
|
|
"""Verifies that this Dependency is fine to add as a child of another one.
|
|
|
|
"""Verifies that this Dependency is fine to add as a child of another one.
|
|
|
@ -609,12 +587,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
"""Convert a deps dict to a dict of Dependency objects."""
|
|
|
|
"""Convert a deps dict to a dict of Dependency objects."""
|
|
|
|
deps_to_add = []
|
|
|
|
deps_to_add = []
|
|
|
|
for name, dep_value in deps.iteritems():
|
|
|
|
for name, dep_value in deps.iteritems():
|
|
|
|
should_process = self.recursion_limit and self.should_process
|
|
|
|
should_process = self.should_process
|
|
|
|
deps_file = self.deps_file
|
|
|
|
|
|
|
|
if self.recursedeps is not None:
|
|
|
|
|
|
|
|
ent = self.recursedeps.get(name)
|
|
|
|
|
|
|
|
if ent is not None:
|
|
|
|
|
|
|
|
deps_file = ent['deps_file']
|
|
|
|
|
|
|
|
if dep_value is None:
|
|
|
|
if dep_value is None:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
@ -653,8 +626,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
custom_deps=None,
|
|
|
|
custom_deps=None,
|
|
|
|
custom_vars=self.custom_vars,
|
|
|
|
custom_vars=self.custom_vars,
|
|
|
|
custom_hooks=None,
|
|
|
|
custom_hooks=None,
|
|
|
|
deps_file=deps_file,
|
|
|
|
deps_file=self.recursedeps.get(name, self.deps_file),
|
|
|
|
should_process=should_process,
|
|
|
|
should_process=should_process,
|
|
|
|
|
|
|
|
should_recurse=name in self.recursedeps,
|
|
|
|
relative=use_relative_paths,
|
|
|
|
relative=use_relative_paths,
|
|
|
|
condition=condition))
|
|
|
|
condition=condition))
|
|
|
|
|
|
|
|
|
|
|
@ -743,17 +717,15 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
rel_prefix = os.path.dirname(self.name)
|
|
|
|
rel_prefix = os.path.dirname(self.name)
|
|
|
|
|
|
|
|
|
|
|
|
if 'recursion' in local_scope:
|
|
|
|
if 'recursion' in local_scope:
|
|
|
|
self.recursion_override = local_scope.get('recursion')
|
|
|
|
|
|
|
|
logging.warning(
|
|
|
|
logging.warning(
|
|
|
|
'Setting %s recursion to %d.', self.name, self.recursion_limit)
|
|
|
|
'%s: Ignoring recursion = %d.', self.name, local_scope['recursion'])
|
|
|
|
self.recursedeps = None
|
|
|
|
|
|
|
|
if 'recursedeps' in local_scope:
|
|
|
|
if 'recursedeps' in local_scope:
|
|
|
|
self.recursedeps = {}
|
|
|
|
|
|
|
|
for ent in local_scope['recursedeps']:
|
|
|
|
for ent in local_scope['recursedeps']:
|
|
|
|
if isinstance(ent, basestring):
|
|
|
|
if isinstance(ent, basestring):
|
|
|
|
self.recursedeps[ent] = {"deps_file": self.deps_file}
|
|
|
|
self.recursedeps[ent] = self.deps_file
|
|
|
|
else: # (depname, depsfilename)
|
|
|
|
else: # (depname, depsfilename)
|
|
|
|
self.recursedeps[ent[0]] = {"deps_file": ent[1]}
|
|
|
|
self.recursedeps[ent[0]] = ent[1]
|
|
|
|
logging.warning('Found recursedeps %r.', repr(self.recursedeps))
|
|
|
|
logging.warning('Found recursedeps %r.', repr(self.recursedeps))
|
|
|
|
|
|
|
|
|
|
|
|
if rel_prefix:
|
|
|
|
if rel_prefix:
|
|
|
@ -788,7 +760,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
if 'action' in hook:
|
|
|
|
if 'action' in hook:
|
|
|
|
hooks_to_run.append(hook)
|
|
|
|
hooks_to_run.append(hook)
|
|
|
|
|
|
|
|
|
|
|
|
if self.recursion_limit:
|
|
|
|
if self.should_recurse:
|
|
|
|
self._pre_deps_hooks = [
|
|
|
|
self._pre_deps_hooks = [
|
|
|
|
Hook.from_dict(hook, variables=self.get_vars(), verbose=True,
|
|
|
|
Hook.from_dict(hook, variables=self.get_vars(), verbose=True,
|
|
|
|
conditions=self.condition)
|
|
|
|
conditions=self.condition)
|
|
|
@ -914,12 +886,12 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
while file_list[i].startswith(('\\', '/')):
|
|
|
|
while file_list[i].startswith(('\\', '/')):
|
|
|
|
file_list[i] = file_list[i][1:]
|
|
|
|
file_list[i] = file_list[i][1:]
|
|
|
|
|
|
|
|
|
|
|
|
if self.recursion_limit:
|
|
|
|
if self.should_recurse:
|
|
|
|
self.ParseDepsFile()
|
|
|
|
self.ParseDepsFile()
|
|
|
|
|
|
|
|
|
|
|
|
self._run_is_done(file_list or [])
|
|
|
|
self._run_is_done(file_list or [])
|
|
|
|
|
|
|
|
|
|
|
|
if self.recursion_limit:
|
|
|
|
if self.should_recurse:
|
|
|
|
if command in ('update', 'revert') and not options.noprehooks:
|
|
|
|
if command in ('update', 'revert') and not options.noprehooks:
|
|
|
|
self.RunPreDepsHooks()
|
|
|
|
self.RunPreDepsHooks()
|
|
|
|
# Parse the dependencies of this dependency.
|
|
|
|
# Parse the dependencies of this dependency.
|
|
|
@ -1015,7 +987,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
|
|
|
|
RunOnDeps() must have been called before to load the DEPS.
|
|
|
|
RunOnDeps() must have been called before to load the DEPS.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
result = []
|
|
|
|
result = []
|
|
|
|
if not self.should_process or not self.recursion_limit:
|
|
|
|
if not self.should_process or not self.should_recurse:
|
|
|
|
# Don't run the hook when it is above recursion_limit.
|
|
|
|
# Don't run the hook when it is above recursion_limit.
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
# If "--force" was specified, run all hooks regardless of what files have
|
|
|
|
# If "--force" was specified, run all hooks regardless of what files have
|
|
|
@ -1304,6 +1276,7 @@ solutions = %(solution_list)s
|
|
|
|
custom_hooks=None,
|
|
|
|
custom_hooks=None,
|
|
|
|
deps_file='unused',
|
|
|
|
deps_file='unused',
|
|
|
|
should_process=True,
|
|
|
|
should_process=True,
|
|
|
|
|
|
|
|
should_recurse=True,
|
|
|
|
relative=None,
|
|
|
|
relative=None,
|
|
|
|
condition=None,
|
|
|
|
condition=None,
|
|
|
|
print_outbuf=True)
|
|
|
|
print_outbuf=True)
|
|
|
@ -1407,6 +1380,7 @@ it or fix the checkout.
|
|
|
|
custom_hooks=s.get('custom_hooks', []),
|
|
|
|
custom_hooks=s.get('custom_hooks', []),
|
|
|
|
deps_file=s.get('deps_file', 'DEPS'),
|
|
|
|
deps_file=s.get('deps_file', 'DEPS'),
|
|
|
|
should_process=True,
|
|
|
|
should_process=True,
|
|
|
|
|
|
|
|
should_recurse=True,
|
|
|
|
relative=None,
|
|
|
|
relative=None,
|
|
|
|
condition=None,
|
|
|
|
condition=None,
|
|
|
|
print_outbuf=True))
|
|
|
|
print_outbuf=True))
|
|
|
@ -1798,16 +1772,6 @@ it or fix the checkout.
|
|
|
|
"""What deps_os entries that are to be parsed."""
|
|
|
|
"""What deps_os entries that are to be parsed."""
|
|
|
|
return self._enforced_os
|
|
|
|
return self._enforced_os
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def recursion_limit(self):
|
|
|
|
|
|
|
|
"""How recursive can each dependencies in DEPS file can load DEPS file."""
|
|
|
|
|
|
|
|
return self._recursion_limit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def try_recursedeps(self):
|
|
|
|
|
|
|
|
"""Whether to attempt using recursedeps-style recursion processing."""
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def target_os(self):
|
|
|
|
def target_os(self):
|
|
|
|
return self._enforced_os
|
|
|
|
return self._enforced_os
|
|
|
@ -1837,6 +1801,7 @@ class CipdDependency(Dependency):
|
|
|
|
custom_hooks=None,
|
|
|
|
custom_hooks=None,
|
|
|
|
deps_file=None,
|
|
|
|
deps_file=None,
|
|
|
|
should_process=should_process,
|
|
|
|
should_process=should_process,
|
|
|
|
|
|
|
|
should_recurse=False,
|
|
|
|
relative=relative,
|
|
|
|
relative=relative,
|
|
|
|
condition=condition)
|
|
|
|
condition=condition)
|
|
|
|
if relative:
|
|
|
|
if relative:
|
|
|
@ -2047,8 +2012,7 @@ class Flattener(object):
|
|
|
|
|
|
|
|
|
|
|
|
def add_deps_file(dep):
|
|
|
|
def add_deps_file(dep):
|
|
|
|
# Only include DEPS files referenced by recursedeps.
|
|
|
|
# Only include DEPS files referenced by recursedeps.
|
|
|
|
if not (dep.parent is None or
|
|
|
|
if not dep.should_recurse:
|
|
|
|
(dep.name in (dep.parent.recursedeps or {}))):
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
deps_file = dep.deps_file
|
|
|
|
deps_file = dep.deps_file
|
|
|
|
deps_path = os.path.join(self._client.root_dir, dep.name, deps_file)
|
|
|
|
deps_path = os.path.join(self._client.root_dir, dep.name, deps_file)
|
|
|
@ -2129,9 +2093,9 @@ class Flattener(object):
|
|
|
|
for sub_dep in dep.dependencies:
|
|
|
|
for sub_dep in dep.dependencies:
|
|
|
|
self._add_dep(sub_dep)
|
|
|
|
self._add_dep(sub_dep)
|
|
|
|
|
|
|
|
|
|
|
|
deps_by_name = {d.name: d for d in dep.dependencies}
|
|
|
|
for d in dep.dependencies:
|
|
|
|
for recurse_dep_name in (dep.recursedeps or []):
|
|
|
|
if d.should_recurse:
|
|
|
|
self._flatten_dep(deps_by_name[recurse_dep_name])
|
|
|
|
self._flatten_dep(d)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def CMDflatten(parser, args):
|
|
|
|
def CMDflatten(parser, args):
|
|
|
|