cros_setup_toolchains: process all the sysroot wrappers

Process all the sysroot wrappers, not just the first one found.

BUG=chromium:455798
TEST=cbuildbot --remote -g 246920 chromiumos-sdk && log into builder and inspect sysroot_wrapper files

Change-Id: Icccad9671b5cb248217379c1ce8579220a472f11
Reviewed-on: https://chromium-review.googlesource.com/246920
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Frank Henigman <fjhenigman@chromium.org>
Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index 944d3fd..e38cb8c 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -885,20 +885,20 @@
   return srcpath
 
 
-def _ProcessSysrootWrapper(_target, output_dir, srcpath):
-  """Remove chroot-specific things from our sysroot wrapper"""
+def _ProcessSysrootWrappers(_target, output_dir, srcpath):
+  """Remove chroot-specific things from our sysroot wrappers"""
   # Disable ccache since we know it won't work outside of chroot.
-  sysroot_wrapper = glob.glob(os.path.join(
-      output_dir + srcpath, 'sysroot_wrapper*'))[0]
-  contents = osutils.ReadFile(sysroot_wrapper).splitlines()
-  for num in xrange(len(contents)):
-    if '@CCACHE_DEFAULT@' in contents[num]:
-      contents[num] = 'use_ccache = False'
-      break
-  # Can't update the wrapper in place since it's a hardlink to a file in /.
-  os.unlink(sysroot_wrapper)
-  osutils.WriteFile(sysroot_wrapper, '\n'.join(contents))
-  os.chmod(sysroot_wrapper, 0o755)
+  for sysroot_wrapper in glob.glob(os.path.join(
+      output_dir + srcpath, 'sysroot_wrapper*')):
+    contents = osutils.ReadFile(sysroot_wrapper).splitlines()
+    for num in xrange(len(contents)):
+      if '@CCACHE_DEFAULT@' in contents[num]:
+        contents[num] = 'use_ccache = False'
+        break
+    # Can't update the wrapper in place since it's a hardlink to a file in /.
+    os.unlink(sysroot_wrapper)
+    osutils.WriteFile(sysroot_wrapper, '\n'.join(contents))
+    os.chmod(sysroot_wrapper, 0o755)
 
 
 def _ProcessDistroCleanups(target, output_dir):
@@ -910,7 +910,7 @@
   """
   _ProcessBinutilsConfig(target, output_dir)
   gcc_path = _ProcessGccConfig(target, output_dir)
-  _ProcessSysrootWrapper(target, output_dir, gcc_path)
+  _ProcessSysrootWrappers(target, output_dir, gcc_path)
 
   osutils.RmDir(os.path.join(output_dir, 'etc'))