global_platform: make --install-parameters-* independently optional

gen_install_parameters() had contradictory logic: the outer guard
required all three arguments to be non-None/non-empty (making them
mutually inclusive), while the inner checks then treated each one
as optional.

Make each parameter independently optional (defaulting to None) and
remove the all-or-nothing guard from both the function and its caller.
Simplify the function body to a straightforward single-pass
construction of system_specific_params.

Change-Id: I8756fb38016cdf0527fe2e21edb44381d1dc557f
This commit is contained in:
Vadim Yanitskiy
2026-03-15 15:57:12 +07:00
parent 27031e78d9
commit 9aeac8f5df
3 changed files with 17 additions and 21 deletions

View File

@@ -864,7 +864,7 @@ class ADF_SD(CardADF):
help='JAVA-CARD CAP file to install')
# Ideally, the parser should enforce that:
# * either the `--install-parameters` is given alone,
# * or all `--install-parameters-*` are given together.
# * or distinct `--install-parameters-*` are given instead.
# We tried to achieve this using mutually exclusive groups (add_mutually_exclusive_group).
# However, group nesting was never supported, often failed to work correctly, and was unintentionally
# exposed through inheritance. It has been deprecated since version 3.11, removed in version 3.14.
@@ -898,11 +898,7 @@ class ADF_SD(CardADF):
if opts.install_parameters is not None:
install_parameters = opts.install_parameters;
else:
# `--install-parameters-*` are mutually inclusive
if opts.install_parameters_non_volatile_memory_quota is None or \
opts.install_parameters_volatile_memory_quota is None or \
opts.install_parameters_stk is None:
raise ValueError("Either --install-parameters alone, or all --install-parameters-* must be specified")
# `--install-parameters-*` are all optional
install_parameters = gen_install_parameters(opts.install_parameters_non_volatile_memory_quota,
opts.install_parameters_volatile_memory_quota,
opts.install_parameters_stk)