Browse Source

Skip run() for GCS/CIPD dependencies during runhooks and revinfo.

Bug: 349643421
Change-Id: Ia01e99edf25830e4b2e2038f4a6a0b6b1802f022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5659261
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Joanna Wang 1 year ago
parent
commit
96b30594ce
1 changed files with 12 additions and 2 deletions
  1. 12 2
      gclient.py

+ 12 - 2
gclient.py

@@ -1211,7 +1211,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
         # All known hooks are expected to run unconditionally regardless of
         # All known hooks are expected to run unconditionally regardless of
         # working copy state, so skip the SCM status check.
         # working copy state, so skip the SCM status check.
         run_scm = command not in ('flatten', 'runhooks', 'recurse', 'validate',
         run_scm = command not in ('flatten', 'runhooks', 'recurse', 'validate',
-                                  None)
+                                  'revinfo', None)
         file_list = [] if not options.nohooks else None
         file_list = [] if not options.nohooks else None
         revision_override = revision_overrides.pop(
         revision_override = revision_overrides.pop(
             self.FuzzyMatchUrl(revision_overrides), None)
             self.FuzzyMatchUrl(revision_overrides), None)
@@ -2521,7 +2521,7 @@ it or fix the checkout.
             if s.should_process:
             if s.should_process:
                 work_queue.enqueue(s)
                 work_queue.enqueue(s)
         work_queue.flush({},
         work_queue.flush({},
-                         None, [],
+                         'revinfo', [],
                          options=self._options,
                          options=self._options,
                          patch_refs=None,
                          patch_refs=None,
                          target_branches=None,
                          target_branches=None,
@@ -2712,6 +2712,9 @@ class GcsDependency(Dependency):
             patch_refs, target_branches, skip_sync_revisions):
             patch_refs, target_branches, skip_sync_revisions):
         """Downloads GCS package."""
         """Downloads GCS package."""
         logging.info('GcsDependency(%s).run()' % self.name)
         logging.info('GcsDependency(%s).run()' % self.name)
+        # GCS dependencies do not need to run during runhooks or revinfo.
+        if command in ['runhooks', 'revinfo']:
+            return
         if not self.should_process:
         if not self.should_process:
             return
             return
         self.DownloadGoogleStorage()
         self.DownloadGoogleStorage()
@@ -2926,6 +2929,13 @@ class CipdDependency(Dependency):
             patch_refs, target_branches, skip_sync_revisions):
             patch_refs, target_branches, skip_sync_revisions):
         """Runs |command| then parse the DEPS file."""
         """Runs |command| then parse the DEPS file."""
         logging.info('CipdDependency(%s).run()' % self.name)
         logging.info('CipdDependency(%s).run()' % self.name)
+        # GCS dependencies do not need to run during runhooks.
+        # TODO(b/349643421): Note, for a GCSDependency we also return early
+        # for the `revinfo` command, however doing the same for cipd
+        # currently breaks testRevInfoActual() in gclient_cipd_smoketest.py.
+        # b/349699772 may be relevant.
+        if command == 'runhooks':
+            return
         if not self.should_process:
         if not self.should_process:
             return
             return
         self._CreatePackageIfNecessary()
         self._CreatePackageIfNecessary()