Deprecate serve_only for archive_dir.

Also change when the devserver will attempt to generate a payload, and
when it will attempt to generate a payload from the latest local build.

Previously, generation was attempted when no --image or --payload was
specified, and if archive_dir's serve_only mode was off.

Since serve_only is gone, we now just check that we're within chroot
before attempting to generate a payload.

Before attempting to generate a payload from the most recent local
build, we check that the directory specified by the label (if provided)
doesn't contain an update file.

BUG=chromium:261775
TEST=unittests updated
cbuildbot --remote mario-paladin

Change-Id: If094db197005836d9fcad5fb63ffcb8470be3706
Reviewed-on: https://gerrit.chromium.org/gerrit/63363
Reviewed-by: Chris Sosa <[email protected]>
Reviewed-by: Joy Chen <[email protected]>
Tested-by: Joy Chen <[email protected]>
Commit-Queue: Joy Chen <[email protected]>
diff --git a/devserver.py b/devserver.py
index ebe41c5..6a35cfc 100755
--- a/devserver.py
+++ b/devserver.py
@@ -1015,7 +1015,6 @@
     # pylint: enable=E1101
 
   root_dir = os.path.realpath('%s/../..' % devserver_dir)
-  serve_only = False
 
   # TODO(sosa): Remove after deprecation.
   if options.vm:
@@ -1028,7 +1027,6 @@
     if not os.path.isabs(archive_dir):
       archive_dir = os.path.join(devserver_dir, archive_dir)
     options.static_dir = os.path.realpath(archive_dir)
-    serve_only = True
   else:
     options.static_dir = os.path.realpath(options.static_dir)
 
@@ -1036,12 +1034,7 @@
   # If our devserver is only supposed to serve payloads, we shouldn't be
   # mucking with the cache at all. If the devserver hadn't previously
   # generated a cache and is expected, the caller is using it wrong.
-  if serve_only:
-    # Extra check to make sure we're not being called incorrectly.
-    if (options.clear_cache or options.exit or options.pregenerate_update or
-        options.board or options.image):
-      parser.error('Incompatible flags detected for serve_only mode.')
-  elif os.path.exists(cache_dir):
+  if os.path.exists(cache_dir):
     _CleanCache(cache_dir, options.clear_cache)
   else:
     os.makedirs(cache_dir)
@@ -1056,7 +1049,6 @@
   updater = autoupdate.Autoupdate(
       root_dir=root_dir,
       static_dir=options.static_dir,
-      serve_only=serve_only,
       urlbase=options.urlbase,
       test_image=options.test_image,
       forced_image=options.image,