cbuildbot: Setup handling to load site specific configs.

This CL doesn't start fetching site specific config git repositories,
but it sets us up to be able to load then, and creates a place in the
startup work flow to do the fetching.

Also, move configuration file locations from config_lib to
constants.py since the values are now more complicated.

BUG=chromium:497284
TEST=Unittests.

Change-Id: I54bb29df130d8937c4c0c5d99152c9ba63b61508
Reviewed-on: https://chromium-review.googlesource.com/282787
Trybot-Ready: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Matthew Sartori <msartori@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index bee84f0..b2392b2 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -420,6 +420,9 @@
   parser.add_remote_option('--profile', default=None, type='string',
                            action='store', dest='profile',
                            help='Name of profile to sub-specify board variant.')
+  parser.add_option('-c', '--config_repo',
+                    help=('Cloneable path to the git repository containing '
+                          'the site configuration to use.'))
 
   #
   # Patch selection options.
@@ -1021,13 +1024,29 @@
     graphite.StatsFactory.SetupMock()
 
 
+def _SetupSiteConfig(options):
+  """Setup our SiteConfig is specified or preset already.
+
+  Args:
+    options: Parsed command line options.
+
+  Returns:
+    SiteConfig instance to use for this build.
+  """
+  if options.config_repo:
+    raise NotImplementedError('Can\'t yet fetch a site configuration.')
+
+  # Use the site specific config, if we specified a site config, or if it
+  # is already present because we are in a repo checkout that specifies one.
+  if options.config_repo or os.path.exists(constants.SITE_CONFIG_FILE):
+    return config_lib.LoadConfigFromFile(constants.SITE_CONFIG_FILE)
+
+  # Fall back to default Chrome OS configuration.
+  return config_lib.LoadConfigFromFile(constants.CHROMEOS_CONFIG_FILE)
+
+
 # TODO(build): This function is too damn long.
 def main(argv):
-
-  # The location of the SiteConfig is still hardcoded in a Chrome OS specific
-  # way... for now.
-  site_config = config_lib.LoadConfigFromFile()
-
   # Turn on strict sudo checks.
   cros_build_lib.STRICT_SUDO = True
 
@@ -1037,6 +1056,9 @@
   parser = _CreateParser()
   options, args = _ParseCommandLine(parser, argv)
 
+  # Fetch our site_config now, because we need it to do anything else.
+  site_config = _SetupSiteConfig(options)
+
   if options.list:
     _PrintValidConfigs(site_config, options.print_all)
     sys.exit(0)