Suppress tee for the inner cbuildbot invocation.

This is a relanding of I2341667b5bc3b8df527e1808221c331794dfcedc
which was pulled due to it exposing issues in cbuildbot's buffering
(those issues are addressed via I972e6556).

There's no reason to have two Tee instances running, additionally
if the outer cbuildbot triggers a sigterm sweep/kill, it can take
out the inner's Tee process (thus suppressing the output).

Beyond that, this duplication has overwriten the logs of the
external, so we've never had the sync data.  Fix that, and allow
preservation of select paths during a full trybot repo rebuild
(so that the logs survive across; primarily useful for builders).

BUG=chromium-os:30790
TEST=manual; run cbuildbot against a preexisting trybot, verify that
     the logs include the outer sync step (not a skip version of it).
TEST=manual; same as above, just wipe the trybot root first (that is
     the edgecase that makes this more complex than just doing a
     --notee on --resume).

Change-Id: I97642866d56e16aa00915fc54c056b8d5d5764ba
Reviewed-on: https://gerrit.chromium.org/gerrit/22550
Tested-by: Brian Harring <ferringb@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 17e35c1..6a9ee91 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -274,7 +274,7 @@
     # Re-write paths to use absolute paths.
     # Suppress any timeout options given from the commandline in the
     # invoked cbuildbot; our timeout will enforce it instead.
-    args_to_append = ['--resume', '--timeout', '0', '--buildroot',
+    args_to_append = ['--resume', '--timeout', '0', '--notee', '--buildroot',
                       os.path.abspath(self.options.buildroot)]
 
     if self.options.chrome_root:
@@ -576,6 +576,7 @@
     with cros_lib.AllowDisabling(options.tee, tee.Tee, log_file):
       cros_lib.Info("cbuildbot executed with args %s"
                     % ' '.join(map(repr, sys.argv)))
+      options.preserve_paths = set([_DEFAULT_LOG_DIR])
       if IsDistributedBuilder():
         buildbot = DistributedBuilder(options, build_config)
       else: