Added command to uninstall gcc before building & installing it.

Before this change the user had to unmerge an existing gcc-4.6.0 before
calling build_tc.py. This change incorporates that step in the script.

PRESUBMIT=passed
R=cmtice,shenhan,bjanakiraman
DELTA=5  (5 added, 0 deleted, 0 changed)
RCL=57542-p2
RDATE=2011/12/20 20:08:16


P4 change: 42662644
diff --git a/v14/build_tc.py b/v14/build_tc.py
index 9f96c63..0493790 100755
--- a/v14/build_tc.py
+++ b/v14/build_tc.py
@@ -52,6 +52,7 @@
     self.RunSetupBoardIfNecessary()
 
     try:
+      self.UninstallTool()
       self.MoveMaskFile()
       self.SwitchToBFD()
       self.MountSources()
@@ -110,6 +111,10 @@
       unmount_statuses = [mp.UnMount() == 0 for mp in mounted]
       assert all(unmount_statuses), "Could not unmount all mount points!"
 
+  def UninstallTool(self):
+    command = "sudo CLEAN_DELAY=0 emerge -C cross-%s/%s" % (self._ctarget, self._name)
+    utils.ExecuteCommandInChroot(self._chromeos_root, command)
+
   def BuildTool(self):
     env = self._build_env
     features = "nostrip userpriv userfetch -sandbox noclean"