Remove some devserver flags.

Remove archive_dir flag for real.
Deprecate archive_dir flag in image_to_live.
Support no_patch_kernel flag in image_to_live to migrate vm tests over

BUG=chromium:261775
TEST=unittests

Change-Id: I6c922cd5e195a81c6973ee63e208e39c980c7e38
Reviewed-on: https://gerrit.chromium.org/gerrit/65241
Reviewed-by: Don Garrett <[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 852a001..d1a609a 100755
--- a/devserver.py
+++ b/devserver.py
@@ -26,8 +26,7 @@
 discover if a more recent build of the board has been built by the developer
 and generate a payload that the requested system can autoupdate to. In addition,
 it accepts gmerge requests from devices that will stage the newest version of
-a particular package from a developer's chroot onto a requesting device. Note
-if archive_dir is specified, this mode is disabled.
+a particular package from a developer's chroot onto a requesting device.
 
 For example:
 gmerge gmerge -d <devserver_url>
@@ -966,9 +965,6 @@
   group = optparse.OptionGroup(
       parser, 'Advanced Server Options', 'These options can be used to changed '
       'for advanced server behavior.')
-  group.add_option('--archive_dir',
-                   metavar='PATH',
-                   help='To be deprecated.')
   group.add_option('--clear_cache',
                    action='store_true', default=False,
                    help='At startup, removes all cached entries from the'
@@ -1002,10 +998,10 @@
 
   # get directory that the devserver is run from
   devserver_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
-  default_archive_dir = '%s/static' % devserver_dir
+  default_static_dir = '%s/static' % devserver_dir
   parser.add_option('--static_dir',
                     metavar='PATH',
-                    default=default_archive_dir,
+                    default=default_static_dir,
                     help='writable static directory')
   parser.add_option('--port',
                     default=8080, type='int',
@@ -1049,14 +1045,7 @@
     options.patch_kernel = False
 
   # set static_dir, from which everything will be served
-  if options.archive_dir:
-    # TODO(joyc) To be deprecated
-    archive_dir = options.archive_dir
-    if not os.path.isabs(archive_dir):
-      archive_dir = os.path.join(devserver_dir, archive_dir)
-    options.static_dir = os.path.realpath(archive_dir)
-  else:
-    options.static_dir = os.path.realpath(options.static_dir)
+  options.static_dir = os.path.realpath(options.static_dir)
 
   cache_dir = os.path.join(options.static_dir, 'cache')
   # If our devserver is only supposed to serve payloads, we shouldn't be
diff --git a/host/image_to_live.sh b/host/image_to_live.sh
index 38d9c44..7bb5f78 100755
--- a/host/image_to_live.sh
+++ b/host/image_to_live.sh
@@ -36,11 +36,14 @@
 
 # Flags for devserver.
 DEFINE_string archive_dir "" \
-  "Update using the test image in the image.zip in this directory." a
+  "Deprecated."
 DEFINE_string board "" "Override the board reported by the target"
 DEFINE_integer devserver_port 8080 \
   "Port to use for devserver."
-DEFINE_boolean for_vm ${FLAGS_FALSE} "Image is for a vm."
+DEFINE_boolean no_patch_kernel ${FLAGS_FALSE} \
+  "Don't patch the kernel with verification blob from stateful. aka 'for_vm'"
+DEFINE_boolean for_vm ${FLAGS_FALSE} \
+  "DEPRECATED. See no_patch_kernel"
 DEFINE_string image "" \
   "Update with this image path that is in this source checkout." i
 DEFINE_string payload "" \
@@ -126,9 +129,8 @@
         --image $(reinterpret_path_for_chroot ${FLAGS_image})"
     IMAGE_PATH="${FLAGS_image}"
   elif [ -n "${FLAGS_archive_dir}" ]; then
-    devserver_flags="${devserver_flags} \
-        --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t"
-    IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin"
+    echo "archive_dir flag is deprecated. Use --image."
+    exit 1
   else
     # IMAGE_PATH should be the newest image and learn the board from
     # the target.
@@ -149,8 +151,11 @@
         --proxy_port ${FLAGS_proxy_port}"
   fi
 
-  [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \
-      devserver_flags="${devserver_flags} --for_vm"
+  if [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ]; then
+      devserver_flags="${devserver_flags} --no_patch_kernel"
+  elif [ ${FLAGS_no_patch_kernel} -eq ${FLAGS_TRUE} ]; then
+      devserver_flags="${devserver_flags} --no_patch_kernel"
+  fi
 
   devserver_flags="${devserver_flags} \
       --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\""