Add manifest patching support to trybots.

Manifest patches are identified up-front, and patched to a temporary
manifest repository during the bootstrap step.  Cbuildbot is
re-executed, and the patched manifest repository is passed in using the
--manifest-repo-url option.

Design doc is at http://goo.gl/MVilO.

BUG=chromium-os:23277
TEST=remote trybots

Change-Id: I4dd9c01d73741d14a92d0d8b07e029c5fac43745
Reviewed-on: https://gerrit.chromium.org/gerrit/30749
Commit-Ready: Ryan Cui <rcui@chromium.org>
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 83c6325..ebdc0fa 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -145,8 +145,7 @@
   Vars:
     build_config:  The configuration dictionary from cbuildbot_config.
     options:  The options provided from optparse in main().
-    archive_url:  Where our artifacts for this builder will be archived.
-    tracking_branch: The tracking branch for this build.
+    archive_urls:  Where our artifacts for this builder will be archived.
     release_tag:  The associated "chrome os version" of this build.
   """
 
@@ -290,11 +289,12 @@
     """
     stage = None
     chromite_pool = self.patch_pool.Filter(project=constants.CHROMITE_PROJECT)
+    manifest_pool = self.patch_pool.FilterManifest()
     chromite_branch = cros_build_lib.GetChromiteTrackingBranch()
-    if (chromite_pool or self.options.test_bootstrap
+    if (chromite_pool or manifest_pool or self.options.test_bootstrap
         or chromite_branch != self.options.branch):
       stage = stages.BootstrapStage(self.options, self.build_config,
-                                    chromite_pool)
+                                    chromite_pool, manifest_pool)
     return stage
 
   def Run(self):
@@ -567,6 +567,7 @@
 
     os.rename(log_file, log_file + '.' + str(last + 1))
 
+
 def _RunBuildStagesWrapper(options, build_config):
   """Helper function that wraps RunBuildStages()."""
   def IsDistributedBuilder():