Cleaned up a build_chromeos.py a little (as per gpylint).
 Moved the make_chroot code out as a function and build_tc.py now uses that function.

PRESUBMIT=passed
R=raymes,bjanakiraman
DELTA=55  (23 added, 13 deleted, 19 changed)
OCL=45276-p2
RCL=45278-p2
RDATE=2010/11/17 14:26:44


P4 change: 42606263
diff --git a/v14/build_tc.py b/v14/build_tc.py
index ea05156..d100947 100755
--- a/v14/build_tc.py
+++ b/v14/build_tc.py
@@ -13,6 +13,7 @@
 import optparse
 import sys
 import tc_enter_chroot
+import build_chromeos
 from utils import utils
 
 # Common initializations
@@ -50,6 +51,8 @@
     parser.print_help()
     sys.exit()
 
+  build_chromeos.MakeChroot(options.chromeos_root)
+
   portage_flags = ""
   if options.binary == True:
     # FIXME(asharif): This should be using --usepkg but that was not working.
@@ -127,8 +130,9 @@
   libc_version = "2.10.1-r1"
   kernel_version = "2.6.30-r1"
 
-  sys.argv = ["--chromeos_root=" + chromeos_root,
-              "--toolchain_root=" + toolchain_root]
+  argv = [rootdir + "tc_enter_chroot.py",
+          "--chromeos_root=" + chromeos_root,
+          "--toolchain_root=" + toolchain_root]
 
   env += " "
 
@@ -141,8 +145,8 @@
 
   if uninstall == True:
     command += " crossdev " + tflag + target
-    sys.argv.append(command)
-    retval = tc_enter_chroot.Main()
+    argv.append(command)
+    retval = tc_enter_chroot.Main(argv)
     return retval
 
   if incremental_component == "binutils":
@@ -163,8 +167,8 @@
                 " --kernel " + kernel_version +
                 crossdev_flags)
 
-  sys.argv.append(command)
-  retval = tc_enter_chroot.Main()
+  argv.append(command)
+  retval = tc_enter_chroot.Main(argv)
   return retval
 
 if __name__ == "__main__":