cbuildbot: Freeze options object before running builder target.

This leverages the recent support for freezing options values, doing so
in cbuildbot just before running the code specific to a builder target.
By that point in the flow it is done overriding options values, so
freezing it should have no effect.  This draws a line in the proverbial
sand forbidding further munging of the options values later in the flow.

BUG=chromium:302054
TEST=Run the following cbuildbot --remote targets to see if any of them
violate the options freeze in any way:
chromiumos-sdk
--buildbot --debug x86-generic-paladin
--buildbot --debug daisy-paladin
arm-generic-full
link-full
x86-mario-full
lumpy-pre-cq

Change-Id: I5c5bbdecf8e999d50580cd41b776c8882f5d55fb
Reviewed-on: https://chromium-review.googlesource.com/181165
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Matt Tennant <mtennant@chromium.org>
Tested-by: Matt Tennant <mtennant@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 7b0b35e..1731b51 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -793,6 +793,13 @@
   elif options.rietveld_patches:
     cros_build_lib.Die('This builder does not support Rietveld patches.')
 
+  # We are done munging options values, so freeze options object now to avoid
+  # further abuse of it.
+  # TODO(mtennant): one by one identify each options value override and see if
+  # it can be handled another way.  Try to push this freeze closer and closer
+  # to the start of the script (e.g. in or after _PostParseCheck).
+  options.Freeze()
+
   builder_run = cbuildbot_run.BuilderRun(options, build_config)
   builder_cls = DistributedBuilder if IsDistributedBuilder() else SimpleBuilder
   builder = builder_cls(builder_run)