Move 'CheckPrerequisites' into osutils.py so that it can be reused.

BUG=none
TEST=All unit tests. cros_sdk and cbuildbot sample runs. Example runs
     where binaries are missing.

Change-Id: Id954050c399b0d38de307e2a9db1ba2c91fd0693
Reviewed-on: https://gerrit.chromium.org/gerrit/36731
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index c97032d..9c9e0dd 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -37,29 +37,6 @@
 NEEDED_TOOLS = ('curl', 'xz')
 
 
-def CheckPrerequisites(needed_tools):
-  """Verifies that the required tools are present on the system.
-
-  This is especially important as this script is intended to run
-  outside the chroot.
-
-  Arguments:
-    needed_tools: an array of string specified binaries to look for.
-
-  Returns:
-    True if all needed tools were found.
-  """
-  missing = []
-  for tool in needed_tools:
-    cmd = ['which', tool]
-    try:
-      cros_build_lib.RunCommand(cmd, print_cmd=False, redirect_stdout=True,
-                                combine_stdout_stderr=True)
-    except cros_build_lib.RunCommandError:
-      missing.append(tool)
-  return missing
-
-
 def GetSdkConfig():
   """Extracts latest version from chromiumos-overlay."""
   d = {}
@@ -292,7 +269,7 @@
         "cros_sdk is currently only supported on x86_64; you're running"
         " %s.  Please find a x86_64 machine." % (host,))
 
-  missing = CheckPrerequisites(NEEDED_TOOLS)
+  missing = osutils.FindMissingBinaries(NEEDED_TOOLS)
   if missing:
     parser.error((
         'The tool(s) %s were not found.'