In build_tc.py detect and avoid the duplicate toolchain building.
Test
./build_tc.py -b daisy,lumpy,stumpy -c ~/ssd/cros1/ -g ~/google46/
and watch the output, ensure there are only two buildings of gcc.
PRESUBMIT=passed
R=asharif,cmtice,shenhan,llozano,yunlian
CC=c-compiler-chrome
APPROVED=yunlian
DELTA=12 (5 added, 2 deleted, 5 changed)
OCL=65433-p2
RCL=65556-p2
RDATE=2013/01/30 17:21:57
P4 change: 42806508
diff --git a/v14/build_tc.py b/v14/build_tc.py
index 7084b99..cad53e4 100755
--- a/v14/build_tc.py
+++ b/v14/build_tc.py
@@ -30,6 +30,7 @@
self._board = board
self._ctarget = misc.GetCtargetFromBoard(self._board,
self._chromeos_root)
+ self.tag = "%s-%s" % (name, self._ctarget)
self._ce = command_executer.GetCommandExecuter()
self._mask_file = os.path.join(
self._chromeos_root,
@@ -52,8 +53,6 @@
self._ce.ChrootRunCommand(self._chromeos_root, command)
def Build(self):
- self.RunSetupBoardIfNecessary()
-
rv = 1
try:
self.UninstallTool()
@@ -252,24 +251,28 @@
build_env["CXXFLAGS"] = debug_flags
# Create toolchain parts
- 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)
- toolchain_parts.append(tp)
+ toolchain_parts[tp.tag] = tp
+ tp.RunSetupBoardIfNecessary()
if options.binutils_dir:
tp = ToolchainPart("binutils", binutils_dir, chromeos_root, board,
not options.noincremental, build_env)
- toolchain_parts.append(tp)
+ toolchain_parts[tp.tag] = tp
+ tp.RunSetupBoardIfNecessary()
if options.gdb_dir:
tp = ToolchainPart("gdb", gdb_dir, chromeos_root, board,
not options.noincremental, build_env)
- toolchain_parts.append(tp)
+ toolchain_parts[tp.tag] = tp
+ tp.RunSetupBoardIfNecessary()
rv = 0
try:
- for tp in toolchain_parts:
+ for tag in toolchain_parts:
+ tp = toolchain_parts[tag]
if options.mount_only or options.unmount_only:
tp.MountSources(options.unmount_only)
else: