Allow enforcing release channels at finalize step
The allowed release channels are dev/beta/stable because they support
image auto-updates. However, most projects will use 'stable' channel in
PVT phase. Adding an option to enforce release channels at finalize
step.
BUG=chrome-os-partner:45012
TEST=1. ./py/gooftool/gooftool_unittest.py
2. gooftool verify_release_channel --enforced_release_channels stable
3. gooftool verify_release_channel --enforced_release_channels beta dev
4. Manually run finalize test
Change-Id: Ie22b67586126fc9a9c2235fec2791f06a03a0ccf
Reviewed-on: https://chromium-review.googlesource.com/298745
Commit-Ready: Shun-Hsing Ou <shunhsingou@chromium.org>
Tested-by: Bowgo Tsai <bowgotsai@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Shun-Hsing Ou <shunhsingou@chromium.org>
diff --git a/py/gooftool/gooftool.py b/py/gooftool/gooftool.py
index d69c559..e87cd7f 100755
--- a/py/gooftool/gooftool.py
+++ b/py/gooftool/gooftool.py
@@ -134,6 +134,10 @@
'-i', '--hwid-version', default=3, choices=(2, 3), type=int,
help='Version of HWID to operate on. (default: %(default)s)')
+_enforced_release_channels_cmd_arg = CmdArg(
+ '--enforced_release_channels', nargs='*', default=None,
+ help='Enforced release image channels.')
+
@Command('best_match_hwids',
_hwdb_path_cmd_arg,
@@ -577,7 +581,8 @@
return GetGooftool(options).VerifyBranding()
-@Command('verify_release_channel')
+@Command('verify_release_channel',
+ _enforced_release_channels_cmd_arg)
def VerifyReleaseChannel(options): # pylint: disable=W0613
"""Verify that release image channel is correct.
@@ -585,7 +590,8 @@
The last three channels support image auto-updates, checks
that release image channel is one of them.
"""
- return GetGooftool(options).VerifyReleaseChannel()
+ return GetGooftool(options).VerifyReleaseChannel(
+ options.enforced_release_channels)
@Command('write_protect')
@@ -692,7 +698,8 @@
_probe_results_cmd_arg,
_hwid_cmd_arg,
_rma_mode_cmd_arg,
- _cros_core_cmd_arg)
+ _cros_core_cmd_arg,
+ _enforced_release_channels_cmd_arg)
def Verify(options):
"""Verifies if whole factory process is ready for finalization.
@@ -871,7 +878,8 @@
_probe_results_cmd_arg,
_hwid_cmd_arg,
_rma_mode_cmd_arg,
- _cros_core_cmd_arg)
+ _cros_core_cmd_arg,
+ _enforced_release_channels_cmd_arg)
def Finalize(options):
"""Verify system readiness and trigger transition into release state.