Added option --mount_only to build_tc.py that only mounts the tool
directory without doing the actual build.

PRESUBMIT=passed
R=cmtice,bjanakiraman
DELTA=19  (16 added, 0 deleted, 3 changed)
OCL=57881-p2
RCL=57884-p2
RDATE=2012/01/13 13:42:08


P4 change: 42664510
diff --git a/v14/build_tc.py b/v14/build_tc.py
index ffc793a..92e018c 100755
--- a/v14/build_tc.py
+++ b/v14/build_tc.py
@@ -182,6 +182,13 @@
                     default=False,
                     action="store_true",
                     help="Build a compiler with -g3 -O0.")
+  parser.add_option("-m",
+                    "--mount_only",
+                    dest="mount_only",
+                    default=False,
+                    action="store_true",
+                    help="Just mount the tool directories.")
+
 
   options, _ = parser.parse_args(argv)
 
@@ -193,11 +200,20 @@
     build_env["CFLAGS"] = debug_flags
     build_env["CXXFLAGS"] = debug_flags
 
-  try:
-    for board in options.board.split(","):
+  # Create toolchain parts
+  toolchain_parts = []
+  for board in options.board.split(","):
+    if options.gcc_dir:
       tp = ToolchainPart("gcc", gcc_dir, chromeos_root, board,
                          not options.noincremental, build_env)
-      return tp.Build()
+      toolchain_parts.append(tp)
+
+  try:
+    for tp in toolchain_parts:
+      if options.mount_only:
+        tp.MountSources()
+      else:
+        tp.Build()
   finally:
     print "Exiting..."
   return 0