Use the new DEPS conditionals feature to run fewer no-op hooks.

Incorporates the changes done in
https://chromium-review.googlesource.com/c/chromium/src/+/706825
https://chromium-review.googlesource.com/c/chromium/src/+/671383

Bug: webrtc:8327
Tested: Ran tools_webrtc/autoroller/roll_deps.py --dry-run successfully.
Notry: True
Change-Id: I29baf24cb8b26eeb52eb6d310b0a0318f8faaf3b
Reviewed-on: https://webrtc-review.googlesource.com/7615
Reviewed-by: Edward Lemur <ehmaldonado@webrtc.org>
Commit-Queue: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20206}
diff --git a/DEPS b/DEPS
index 851f293..4bf1dda 100644
--- a/DEPS
+++ b/DEPS
@@ -187,19 +187,23 @@
     # official chrome builds or cross compiling.
     'name': 'sysroot',
     'pattern': '.',
+    'condition': 'checkout_linux',
     'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py',
                '--running-as-hook'],
   },
   {
-    # Update the Windows toolchain if necessary.
+    # Update the Windows toolchain if necessary. Must run before 'clang' below.
     'name': 'win_toolchain',
     'pattern': '.',
+    # TODO(thakis): Put some condition here. Not just host_os == 'win', because
+    # we also need this for (mac|linux) -> win cross builds.
     'action': ['python', 'src/build/vs_toolchain.py', 'update'],
   },
   {
     # Update the Mac toolchain if necessary.
     'name': 'mac_toolchain',
     'pattern': '.',
+    'condition': 'checkout_mac',
     'action': ['python', 'src/build/mac_toolchain.py'],
   },
   # Pull binutils for linux, enabled debug fission for faster linking /
@@ -208,17 +212,17 @@
   {
     'name': 'binutils',
     'pattern': 'src/third_party/binutils',
+    'condition': 'host_os == "linux"',
     'action': [
         'python',
         'src/third_party/binutils/download.py',
     ],
   },
   {
-    # Pull clang if needed or requested via GYP_DEFINES.
     # Note: On Win, this should run after win_toolchain, as it may use it.
     'name': 'clang',
     'pattern': '.',
-    'action': ['python', 'src/tools/clang/scripts/update.py', '--if-needed'],
+    'action': ['python', 'src/tools/clang/scripts/update.py'],
   },
   {
     # Update LASTCHANGE.
@@ -231,6 +235,7 @@
   {
     'name': 'gn_win',
     'pattern': '.',
+    'condition': 'host_os == "win"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=win32',
@@ -242,6 +247,7 @@
   {
     'name': 'gn_mac',
     'pattern': '.',
+    'condition': 'host_os == "mac"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=darwin',
@@ -253,6 +259,7 @@
   {
     'name': 'gn_linux64',
     'pattern': '.',
+    'condition': 'host_os == "linux"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=linux*',
@@ -265,6 +272,7 @@
   {
     'name': 'clang_format_win',
     'pattern': '.',
+    'condition': 'host_os == "win"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=win32',
@@ -276,6 +284,7 @@
   {
     'name': 'clang_format_mac',
     'pattern': '.',
+    'condition': 'host_os == "mac"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=darwin',
@@ -287,6 +296,7 @@
   {
     'name': 'clang_format_linux',
     'pattern': '.',
+    'condition': 'host_os == "linux"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=linux*',
@@ -299,6 +309,7 @@
   {
     'name': 'luci-go_win',
     'pattern': '.',
+    'condition': 'host_os == "win"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=win32',
@@ -310,6 +321,7 @@
   {
     'name': 'luci-go_mac',
     'pattern': '.',
+    'condition': 'host_os == "mac"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=darwin',
@@ -321,6 +333,7 @@
   {
     'name': 'luci-go_linux',
     'pattern': '.',
+    'condition': 'host_os == "linux"',
     'action': [ 'download_from_google_storage',
                 '--no_resume',
                 '--platform=linux*',
@@ -333,6 +346,7 @@
   {
     'name': 'syzygy-binaries',
     'pattern': '.',
+    'condition': 'host_os == "win"',
     'action': ['python',
                'src/build/get_syzygy_binaries.py',
                '--output-dir=src/third_party/syzygy/binaries',