summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-02-08 09:19:33 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2018-02-08 09:22:58 +0100
commit8255d65373f767cb8f636a3400521687ead89f13 (patch)
tree0413c215d169f480a19e2f3caff21b595d252417 /examples
parenta811c1d9e578a44078d81a50408da8d8affb10eb (diff)
Prompt for choices with new visible symbols in oldconfig.py
It makes sense to prompt for a choice during oldconfig if it contains new visible symbols, even if there is already an old visible user selection.
Diffstat (limited to 'examples')
-rw-r--r--examples/oldconfig.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/examples/oldconfig.py b/examples/oldconfig.py
index 737ddae..c05eda1 100644
--- a/examples/oldconfig.py
+++ b/examples/oldconfig.py
@@ -223,9 +223,20 @@ def do_oldconfig_for_node(node):
else:
choice = node.item
- # Skip choices that already have a visible user selection
+ # Skip choices that already have a visible user selection...
if choice.user_selection and choice.user_selection.visibility == 2:
- return
+ # ...unless there are new visible symbols in the choice. (We know
+ # they have y (2) visibility in that case, because m-visible
+ # symbols get demoted to n-visibility in y-mode choices, and the
+ # user-selected symbol had visibility y.)
+ for sym in choice.syms:
+ if sym is not choice.user_selection and sym.visibility and \
+ sym.user_value is None:
+ # New visible symbols in the choice
+ break
+ else:
+ # No new visible symbols in the choice
+ return
# Get a list of available selections. The mode of the choice limits
# the visibility of the choice value symbols, so this will indirectly
@@ -260,7 +271,7 @@ def do_oldconfig_for_node(node):
# Pick the default selection if the string is blank
if not sel_index:
choice.selection.set_value(2)
- return
+ break
try:
sel_index = int(sel_index)
@@ -278,7 +289,19 @@ def do_oldconfig_for_node(node):
conf_changed = True
options[sel_index - 1].set_value(2)
- return
+ break
+
+ # Give all of the non-selected visible choice symbols the user value n.
+ # This makes it so that the choice is no longer considered new once we
+ # do additional passes, if the reason that it was considered new was
+ # that it had new choice symbols.
+ #
+ # Only giving visible choice symbols the user value n means we will prompt
+ # for the choice again if later user selections make more new choice
+ # symbols visible, which is correct.
+ for sym in choice.syms:
+ if sym is not choice.user_selection and sym.visibility:
+ sym.set_value(0)
def do_oldconfig(kconf):
# An earlier symbol in the Kconfig files might depend on a later symbol and