ChromeOS validation scripts

PRESUBMIT=passed
R=raymes,asharif
DELTA=336  (336 added, 0 deleted, 0 changed)
OCL=44912-p2
RCL=44939-p2
RDATE=2010/11/01 09:44:34


P4 change: 42605469
diff --git a/v14/build_tc.py b/v14/build_tc.py
new file mode 100755
index 0000000..169165e
--- /dev/null
+++ b/v14/build_tc.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python2.6
+#
+# Copyright 2010 Google Inc. All Rights Reserved.
+
+"""Script to build the ChromeOS toolchain.
+
+This script sets up the toolchain if you give it the gcctools directory.
+"""
+
+__author__ = "asharif@google.com (Ahmad Sharif)"
+
+import optparse
+import sys
+from utils import utils
+
+# Common initializations
+(rootdir, basename) = utils.GetRoot(sys.argv[0])
+utils.InitLogger(rootdir, basename)
+
+parser = optparse.OptionParser()
+parser.add_option("-c", "--chromeos_root", dest="chromeos_root",
+                  help="ChromeOS root checkout directory.")
+parser.add_option("-t", "--toolchain_root", dest="toolchain_root",
+                  help="Toolchain root directory.")
+parser.add_option("-b", "--board", dest="board",
+                  help="board is the argument to the setup_board command.")
+
+(options, args) = parser.parse_args()
+
+if options.toolchain_root is None or options.board is None:
+  parser.print_help()
+  sys.exit()
+
+command = (rootdir + "/tc-enter-chroot.sh")
+if options.chromeos_root is not None:
+  command += " --chromeos_root=" + options.chromeos_root
+if options.toolchain_root is not None:
+  command += " --toolchain_root=" + options.toolchain_root
+command += (" -- ./setup_board --nousepkg --board=" + options.board +
+            " --gcc_version=9999")
+
+retval = utils.RunCommand(command)
+assert retval == 0, "Retval should have been 0!"