Add --extra_use_flags option, which updates the USE flag appropriately.

TEST=Built gcc compiler in chroot, passing the
--extra_use_flags="vtable_verify"; went into the chroot and verified
that the compiler built correctly.

PRESUBMIT=passed
R=llozano,asharif,shenhan,carrot,yunlian,bjanakiraman
APPROVED=llozano
DELTA=12  (11 added, 0 deleted, 1 changed)
OCL=65920-p2
RCL=66011-p2
RDATE=2013/02/21 14:52:10


P4 change: 42926966
diff --git a/v14/build_tc.py b/v14/build_tc.py
index 7138292..31faa44 100755
--- a/v14/build_tc.py
+++ b/v14/build_tc.py
@@ -132,7 +132,11 @@
     if self._incremental:
       env["FEATURES"] += " keepwork"
 
-    env["USE"] = "multislot mounted_%s" % self._name
+    if "USE" in env:
+      env["USE"] += " multislot mounted_%s" % self._name
+    else:
+      env["USE"] = "multislot mounted_%s" % self._name
+
     env["%s_SOURCE_PATH" % self._name.upper()] = (
         os.path.join("/", self._chroot_source_path))
     env["ACCEPT_KEYWORDS"] = "~*"
@@ -225,6 +229,11 @@
                     default=False,
                     action="store_true",
                     help="Just unmount the tool directories.")
+  parser.add_option("--extra_use_flags",
+                    dest="extra_use_flags",
+                    default="",
+                    help="Extra flag for USE, to be passed to the ebuild. "
+                    "('multislot' and 'mounted_<tool>' are always passed.)")
 
 
   options, _ = parser.parse_args(argv)
@@ -261,6 +270,8 @@
       build_env["CXXFLAGS"] += " %s" % (debug_flags)
     else:
       build_env["CXXFLAGS"] = debug_flags
+  if options.extra_use_flags:
+    build_env["USE"] = options.extra_use_flags
 
   # Create toolchain parts
   toolchain_parts = {}