gooftool: Fix broken Verify, Finalize command.

The positional arguments for gooftool sub commands may cause chained
commands to fail. For example, in the command chain

 finalize => verify => verify_keys,

If a parameter is defined only in verify_keys, when we invoke finalize
command then the arg in options would be missing (because the real one
gets parsed is "finalize").

The only solution is to not use positional arguments. Changed the
positional argument for verify_rootfs, verify_system_time to
'release_rootfs', and the argument for firmware in verify_keys to be
'firmware_path'.

New format:
 gooftool verify_rootfs --release_rootfs /dev/mmcblk0p3
 gooftool verify_systsem_time --release_rootfs /dev/sda3
 gooftool verify_keys --release_rootfs /dev/sda3 --firmware_path image.bin

The shell script shortcuts are also removed to prevent confusion.

BUG=chromium:573933
TEST=make test; gooftool verify_keys; gooftool verify

Change-Id: I33af20faf1ab8ba7b1fa70e9aabaad0a5c393bc7
Reviewed-on: https://chromium-review.googlesource.com/339160
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 48b59bc..dc17490 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -139,6 +139,11 @@
     '--enforced_release_channels', nargs='*', default=None,
     help='Enforced release image channels.')
 
+_release_rootfs_cmd_arg = CmdArg(
+    '--release_rootfs', help='Location of release image rootfs partition.')
+
+_firmware_path_cmd_arg = CmdArg(
+    '--firmware_path', help='Location of firmware image partition.')
 
 @Command('best_match_hwids',
          _hwdb_path_cmd_arg,
@@ -509,12 +514,12 @@
 
 
 @Command('verify_keys',
-         CmdArg('kernel_device', nargs='?', help='Kernel device to verify.'),
-         CmdArg('main_firmware', nargs='?', help='Main firmware image file.'))
+         _release_rootfs_cmd_arg,
+         _firmware_path_cmd_arg)
 def VerifyKeys(options):  # pylint: disable=W0613
   """Verify keys in firmware and SSD match."""
   return GetGooftool(options).VerifyKeys(
-      options.kernel_device, options.main_firmware)
+      options.release_rootfs, options.firmware_path)
 
 
 @Command('set_fw_bitmap_locale')
@@ -527,15 +532,15 @@
 
 
 @Command('verify_system_time',
-         CmdArg('root_dev', nargs='?', help='Root device to check.'))
+         _release_rootfs_cmd_arg)
 def VerifySystemTime(options):  # pylint: disable=W0613
   """Verify system time is later than release filesystem creation time."""
 
-  return GetGooftool(options).VerifySystemTime(options.root_dev)
+  return GetGooftool(options).VerifySystemTime(options.release_rootfs)
 
 
 @Command('verify_rootfs',
-         CmdArg('release_rootfs', nargs='?', help='Release root file system.'))
+         _release_rootfs_cmd_arg)
 def VerifyRootFs(options):  # pylint: disable=W0613
   """Verify rootfs on SSD is valid by checking hash."""
 
@@ -724,6 +729,8 @@
          _hwid_cmd_arg,
          _rma_mode_cmd_arg,
          _cros_core_cmd_arg,
+         _release_rootfs_cmd_arg,
+         _firmware_path_cmd_arg,
          _enforced_release_channels_cmd_arg)
 def Verify(options):
   """Verifies if whole factory process is ready for finalization.
@@ -906,6 +913,8 @@
          _hwid_cmd_arg,
          _rma_mode_cmd_arg,
          _cros_core_cmd_arg,
+         _release_rootfs_cmd_arg,
+         _firmware_path_cmd_arg,
          _enforced_release_channels_cmd_arg)
 def Finalize(options):
   """Verify system readiness and trigger transition into release state.