cros_sdk: Remove unused toolchain overlay support

The --toolchains argument downloads additional tarball(s) and unpacks
them on top of the initial extracted chroot.  The --board argument
preselects toolchains for a particular board and then works the same as
--toolchains.  Both of these are looking for files that were turned off
in March 2016 (see crrev.com/c/332862).  Nobody has complained about the
lack since then, so let's just remove this code.

BUG=chromium:845174
TEST=cros_sdk --create

Change-Id: I78bad27d211521f1e3ffb30bc7a8263d48639ff8
Reviewed-on: https://chromium-review.googlesource.com/1081389
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index 3280308..08384ec 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -97,28 +97,6 @@
           for ext in COMPRESSION_PREFERENCE]
 
 
-def GetToolchainsOverlayUrls(version, toolchains):
-  """Returns the URL(s) for a toolchains SDK overlay.
-
-  Args:
-    version: The SDK version used, e.g. 2015.05.27.145939. We use the year and
-        month components to point to a subdirectory on the SDK bucket where
-        overlays are stored (.../2015/05/ in this case).
-    toolchains: Iterable of toolchain target strings (e.g. 'i686-pc-linux-gnu').
-
-  Returns:
-    List of alternative download URLs for an SDK overlay tarball that contains
-    the given toolchains.
-  """
-  toolchains_desc = '-'.join(sorted(toolchains))
-  suburl_template = os.path.join(
-      *(version.split('.')[:2] +
-        ['cros-sdk-overlay-toolchains-%s-%s.tar.%%s' %
-         (toolchains_desc, version)]))
-  return [toolchain.GetSdkURL(suburl=suburl_template % ext)
-          for ext in COMPRESSION_PREFERENCE]
-
-
 def FetchRemoteTarballs(storage_dir, urls, desc, allow_none=False):
   """Fetches a tarball given by url, and place it in |storage_dir|.
 
@@ -203,15 +181,12 @@
   return tarball_dest
 
 
-def CreateChroot(chroot_path, sdk_tarball, toolchains_overlay_tarball,
-                 cache_dir, nousepkg=False):
+def CreateChroot(chroot_path, sdk_tarball, cache_dir, nousepkg=False):
   """Creates a new chroot from a given SDK.
 
   Args:
     chroot_path: Path where the new chroot will be created.
     sdk_tarball: Path to a downloaded Gentoo Stage3 or Chromium OS SDK tarball.
-    toolchains_overlay_tarball: Optional path to a second tarball that will be
-        unpacked into the chroot on top of the SDK tarball.
     cache_dir: Path to a directory that will be used for caching portage files,
         etc.
     nousepkg: If True, pass --nousepkg to cros_setup_toolchains inside the
@@ -222,9 +197,6 @@
                        '--chroot', chroot_path,
                        '--cache_dir', cache_dir]
 
-  if toolchains_overlay_tarball:
-    cmd.extend(['--toolchains_overlay_path', toolchains_overlay_tarball])
-
   if nousepkg:
     cmd.append('--nousepkg')
 
@@ -767,21 +739,6 @@
 
   parser.add_argument('commands', nargs=argparse.REMAINDER)
 
-  # SDK overlay tarball options (mutually exclusive).
-  group = parser.add_mutually_exclusive_group()
-  group.add_argument('--toolchains',
-                     help=('Comma-separated list of toolchains we expect to be '
-                           'using on the chroot. Used for downloading a '
-                           'corresponding SDK toolchains group (if one is '
-                           'found), which may speed up chroot initialization '
-                           'when building for the first time. Otherwise this '
-                           'has no effect and will not restrict the chroot in '
-                           'any way. Ignored if using --bootstrap.'))
-  group.add_argument('--board',
-                     help=('The board we intend to be building in the chroot. '
-                           'Used for deriving the list of required toolchains '
-                           '(see --toolchains).'))
-
   # Commands.
   group = parser.add_argument_group('Commands')
   group.add_argument(
@@ -1103,23 +1060,8 @@
     else:
       urls = GetArchStageTarballs(sdk_version)
 
-  # Get URLs for the toolchains overlay, if one is to be used.
-  toolchains_overlay_urls = None
-  if not options.bootstrap:
-    toolchains = None
-    if options.toolchains:
-      toolchains = options.toolchains.split(',')
-    elif options.board:
-      toolchains = toolchain.GetToolchainsForBoard(options.board).keys()
-
-    if toolchains:
-      toolchains_overlay_urls = GetToolchainsOverlayUrls(sdk_version,
-                                                         toolchains)
-
   with cgroups.SimpleContainChildren('cros_sdk', pid=first_pid):
     with locking.FileLock(lock_path, 'chroot lock') as lock:
-      toolchains_overlay_tarball = None
-
       if options.proxy_sim:
         _ProxySimSetup(options)
 
@@ -1162,15 +1104,10 @@
         lock.write_lock()
         sdk_tarball = FetchRemoteTarballs(
             sdk_cache, urls, 'stage3' if options.bootstrap else 'SDK')
-        if toolchains_overlay_urls:
-          toolchains_overlay_tarball = FetchRemoteTarballs(
-              sdk_cache, toolchains_overlay_urls, 'SDK toolchains overlay',
-              allow_none=True)
 
       if options.create:
         lock.write_lock()
-        CreateChroot(options.chroot, sdk_tarball, toolchains_overlay_tarball,
-                     options.cache_dir,
+        CreateChroot(options.chroot, sdk_tarball, options.cache_dir,
                      nousepkg=(options.bootstrap or options.nousepkg))
 
       if options.enter: