Commit 7ccf2f0c authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

gclient: Report what dependencies were not processed.

Report the dependencies that were not synced, due to their, or their parent's
condition evaluating to False.

Bug: 853010
Change-Id: I375703a1b91e3c3e31e444b0df1c95ecae17b6ba
Reviewed-on: https://chromium-review.googlesource.com/1111113Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 83a57e01
...@@ -527,7 +527,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): ...@@ -527,7 +527,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self.name) self.name)
if not self.should_process: if not self.should_process:
# Return early, no need to set requirements. # Return early, no need to set requirements.
return True return not any(d.name == self.name for d in self.root.subtree(True))
# This require a full tree traversal with locks. # This require a full tree traversal with locks.
siblings = [d for d in self.root.subtree(False) if d.name == self.name] siblings = [d for d in self.root.subtree(False) if d.name == self.name]
...@@ -601,10 +601,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): ...@@ -601,10 +601,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if dep_type == 'cipd': if dep_type == 'cipd':
cipd_root = self.GetCipdRoot() cipd_root = self.GetCipdRoot()
for package in dep_value.get('packages', []): for package in dep_value.get('packages', []):
if 'version' in package:
# Matches version to vars value.
version = package['version']
package['version'] = version
deps_to_add.append( deps_to_add.append(
CipdDependency( CipdDependency(
parent=self, parent=self,
...@@ -2565,14 +2561,11 @@ def CMDsync(parser, args): ...@@ -2565,14 +2561,11 @@ def CMDsync(parser, args):
slns = {} slns = {}
for d in client.subtree(True): for d in client.subtree(True):
normed = d.name.replace('\\', '/').rstrip('/') + '/' normed = d.name.replace('\\', '/').rstrip('/') + '/'
if normed in slns and not d.should_process:
# If an unprocessed dependency would override an existing dependency,
# ignore it.
continue
slns[normed] = { slns[normed] = {
'revision': d.got_revision, 'revision': d.got_revision,
'scm': d.used_scm.name if d.used_scm else None, 'scm': d.used_scm.name if d.used_scm else None,
'url': str(d.url) if d.url else None, 'url': str(d.url) if d.url else None,
'was_processed': d.should_process,
} }
with open(options.output_json, 'wb') as f: with open(options.output_json, 'wb') as f:
json.dump({'solutions': slns}, f) json.dump({'solutions': slns}, f)
......
...@@ -412,6 +412,10 @@ deps = { ...@@ -412,6 +412,10 @@ deps = {
deps = { deps = {
'src/repo2': '%(git_base)srepo_2@%(hash)s', 'src/repo2': '%(git_base)srepo_2@%(hash)s',
'src/repo2/repo_renamed': '/repo_3', 'src/repo2/repo_renamed': '/repo_3',
'src/should_not_process': {
'url': '/repo_4',
'condition': 'False',
}
} }
# I think this is wrong to have the hooks run from the base of the gclient # I think this is wrong to have the hooks run from the base of the gclient
# checkout. It's maybe a bit too late to change that behavior. # checkout. It's maybe a bit too late to change that behavior.
......
...@@ -369,23 +369,33 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -369,23 +369,33 @@ class GClientSmokeGIT(GClientSmokeBase):
with open(output_json) as f: with open(output_json) as f:
output_json = json.load(f) output_json = json.load(f)
self.maxDiff = None
out = { out = {
'solutions': { 'solutions': {
'src/': { 'src/': {
'scm': 'git', 'scm': 'git',
'url': self.git_base + 'repo_1', 'url': self.git_base + 'repo_1',
'revision': self.githash('repo_1', 2), 'revision': self.githash('repo_1', 2),
'was_processed': True,
}, },
'src/repo2/': { 'src/repo2/': {
'scm': 'git', 'scm': 'git',
'url': 'url':
self.git_base + 'repo_2@' + self.githash('repo_2', 1)[:7], self.git_base + 'repo_2@' + self.githash('repo_2', 1)[:7],
'revision': self.githash('repo_2', 1), 'revision': self.githash('repo_2', 1),
'was_processed': True,
}, },
'src/repo2/repo_renamed/': { 'src/repo2/repo_renamed/': {
'scm': 'git', 'scm': 'git',
'url': self.git_base + 'repo_3', 'url': self.git_base + 'repo_3',
'revision': self.githash('repo_3', 2), 'revision': self.githash('repo_3', 2),
'was_processed': True,
},
'src/should_not_process/': {
'scm': None,
'url': self.git_base + 'repo_4',
'revision': None,
'was_processed': False,
}, },
}, },
} }
...@@ -839,6 +849,7 @@ class GClientSmokeGIT(GClientSmokeBase): ...@@ -839,6 +849,7 @@ class GClientSmokeGIT(GClientSmokeBase):
self.git_base, self.githash('repo_2', 1)), self.git_base, self.githash('repo_2', 1)),
'src/repo2/repo_renamed': '%srepo_3@%s' % ( 'src/repo2/repo_renamed': '%srepo_3@%s' % (
self.git_base, self.githash('repo_3', 2)), self.git_base, self.githash('repo_3', 2)),
'src/should_not_process': None,
}, },
}] }]
self.assertEqual(out, output_json) self.assertEqual(out, output_json)
......
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