Revert "[presubmit_support] Fix CheckForRecursedeps to work for submodule based gclient DEPS."

This reverts commit bb2a896987.

Reason for revert: Looks like this was insufficient - https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/25451/overview

Will investigate more tomorrow.

Original change's description:
> [presubmit_support] Fix CheckForRecursedeps to work for submodule based gclient DEPS.
>
> R=sokcevic
>
> Bug: 401077549
> Change-Id: I51fcabad5e563a65614d4b35e6600e7e511f7ba4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6330092
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Auto-Submit: Robbie Iannucci <iannucci@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 401077549
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I0730ea3f119b0acea7ed7a219cf723fc8116cd07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334078
Owners-Override: Dan Le Febvre <dlf@google.com>
Commit-Queue: Dan Le Febvre <dlf@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Robbie Iannucci <iannucci@google.com>
Reviewed-by: Dan Le Febvre <dlf@google.com>
changes/78/6334078/2
Robbie Iannucci 2 months ago committed by LUCI CQ
parent bb2a896987
commit 01fcf2b8c5

@ -2081,12 +2081,13 @@ def CheckForCommitObjects(input_api, output_api):
url = dep if isinstance(dep, str) else dep['url']
commit_hash = url.split('@')[-1]
# Two exceptions were in made in two projects prior to this check
# enforcement. We need to address those exceptions, but in the meantime
# we can't fail this global presubmit check
# https://chromium.googlesource.com/infra/infra/+/refs/heads/main/DEPS#45
if dep_path == 'recipes-py' and commit_hash == 'refs/heads/main':
continue
# One exception is made prior to this check enforcement.
#
# We need to address this exception, but in the meantime we can't fail
# this global presubmit check.
#
# https://chromium.googlesource.com/angle/angle/+/refs/heads/main/DEPS#412
if dep_path == 'third_party/dummy_chromium':
continue
@ -2167,32 +2168,7 @@ def CheckForRecursedeps(input_api, output_api):
# No recursedeps entry, carry on!
return []
existing_deps: set[str] = set()
# If git_dependencies is SYNC or SUBMODULES, prefer the submodule data.
if deps.get('git_dependencies', 'DEPS') == 'DEPS':
existing_deps = set(deps.get('deps', {}))
else:
existing_deps = input_api.change.AllLocalSubmodules()
# existing_deps is 'local paths' i.e. repo-relative. However, if deps is
# NOT use_relative_paths, then we need to adjust these to be
# client-root-relative.
#
# Sadly, as of 25Q1, the default is still False.
if deps.get('use_relative_paths', False):
# Find the relative path between the gclient root and the repo root.
relpath = input_api.os_path.relpath(
input_api.change.RepositoryRoot(),
start = input_api.gclient_paths.FindGclientRoot(
input_api.change.RepositoryRoot()))
# All submodules are relative to the repo root, so join
#
# gclient-to-repo ++ repo-to-submodule
#
# To get path strings which should appear in recursedeps.
existing_deps = set(
input_api.os_path.join(relpath, p)
for p in existing_deps
)
existing_deps = deps.get('deps', {})
errors = []
for check_dep in deps['recursedeps']:
@ -2202,7 +2178,6 @@ def CheckForRecursedeps(input_api, output_api):
f'Found recuredep entry {check_dep} but it is not found '
'in\n deps itself. Remove it from recurcedeps or add '
'deps entry.'))
return errors

@ -1435,10 +1435,6 @@ class Change(object):
"""Returns local paths for affected submodules."""
return [af.LocalPath() for af in self.AffectedSubmodules()]
def AllLocalSubmodules(self) -> set[str]:
"""Returns local paths for all submodules."""
return set(self._repo_submodules())
def AbsoluteLocalPaths(self):
"""Convenience function."""
return [af.AbsoluteLocalPath() for af in self.AffectedFiles()]

Loading…
Cancel
Save