summaryrefslogtreecommitdiff
path: root/examples/allnoconfig.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-10-25 13:35:31 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2017-10-25 13:39:41 +0200
commit463cebd7f8bf26673732bf5afcd113ee5e2268b7 (patch)
treef29b3a987a49cf4135d0968c971fb259bd1594e8 /examples/allnoconfig.py
parentdd0e227216e247d2040cdd40bf7397702880cdc4 (diff)
Backup
Diffstat (limited to 'examples/allnoconfig.py')
-rw-r--r--examples/allnoconfig.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py
index edc473d..8d41912 100644
--- a/examples/allnoconfig.py
+++ b/examples/allnoconfig.py
@@ -12,7 +12,7 @@ from kconfiglib import Config, Symbol, tri_less
import sys
def do_allnoconfig(node):
- global no_changes
+ global changed
# Walk the tree of menu nodes. You can imagine this as going down/into menu
# entries in the menuconfig interface, setting each to 'n' (or the lowest
@@ -22,14 +22,16 @@ def do_allnoconfig(node):
if isinstance(node.item, Symbol):
sym = node.item
- # Is the symbol a non-choice symbol that can be set to a lower
- # value than its current value?
- if sym.choice is None and sym.assignable and \
- tri_less(sym.assignable[0], sym.value):
+ # Is the symbol a non-choice, non-allnoconfig_y symbol that can be
+ # set to a lower value than its current value?
+ if (sym.choice is None and
+ not sym.is_allnoconfig_y and
+ sym.assignable and
+ tri_less(sym.assignable[0], sym.value)):
# Yup, lower it
sym.set_value(sym.assignable[0])
- no_changes = False
+ changed = True
# Recursively lower children
if node.list is not None:
@@ -39,19 +41,22 @@ def do_allnoconfig(node):
conf = Config(sys.argv[1])
+# Do an initial pass to set 'option allnoconfig_y' symbols to 'y'
+for sym in conf.defined_syms:
+ if sym.is_allnoconfig_y:
+ sym.set_value("y")
+
while 1:
- # For tricky dependencies involving '!', setting later symbols to 'n' might
- # actually raise the value of earlier symbols. To be super safe, we do
- # additional passes until a pass no longer changes the value of any symbol.
- #
- # This isn't actually needed for any ARCH in the kernel as of 4.14. A
- # single pass gives the correct result.
- no_changes = True
+ # Changing later symbols in the configuration can sometimes allow earlier
+ # symbols to be lowered, e.g. if a later symbol 'select's an earlier
+ # symbol. To handle such situations, we do additional passes over the tree
+ # until we're no longer able to change the value of any symbol in a pass.
+ changed = False
- do_allnoconfig(conf.top_menu)
+ do_allnoconfig(conf.top_node)
# Did the pass change any symbols?
- if no_changes:
+ if not changed:
break
conf.write_config(".config")