diff options
| -rwxr-xr-x | oldconfig.py | 7 | ||||
| -rwxr-xr-x | olddefconfig.py | 32 | ||||
| -rw-r--r-- | setup.py | 2 |
3 files changed, 38 insertions, 3 deletions
diff --git a/oldconfig.py b/oldconfig.py index 29ca533..956bc07 100755 --- a/oldconfig.py +++ b/oldconfig.py @@ -10,6 +10,9 @@ # aren't already set in the .config # 3. Write new .config # +# The default input/output filename is '.config'. A different filename can be +# passed in the KCONFIG_CONFIG environment variable. +# # Unlike 'make oldconfig', this script doesn't print menu titles and comments, # but gives Kconfig definition locations. Printing menus and comments would be # pretty easy to add: Look at the parents of each item and print all menu @@ -39,13 +42,11 @@ def _main(): # visible symbols. global conf_changed - kconf = standard_kconfig() - config_filename = standard_config_filename() if not os.path.exists(config_filename): sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename)) - + kconf = standard_kconfig() kconf.load_config(config_filename) while True: diff --git a/olddefconfig.py b/olddefconfig.py new file mode 100755 index 0000000..5245735 --- /dev/null +++ b/olddefconfig.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (c) 2018, Ulf Magnusson +# SPDX-License-Identifier: ISC + +# Works like 'make olddefconfig', updating an old .config file by filing in +# default values for all new symbols. This is the same as picking the default +# selection for all symbols in oldconfig, or entering the menuconfig interface +# and immediately saving. +# +# The default output filename is '.config'. A different filename can be passed +# in the KCONFIG_CONFIG environment variable. + +import os +import sys + +import kconfiglib + + +def main(): + config_filename = kconfiglib.standard_config_filename() + if not os.path.exists(config_filename): + sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename)) + + kconf = kconfiglib.standard_kconfig() + kconf.load_config(config_filename) + kconf.write_config(config_filename) + print("Updated configuration written to '{}'".format(config_filename)) + + +if __name__ == "__main__": + main() @@ -28,6 +28,7 @@ setuptools.setup( "menuconfig", "genconfig", "oldconfig", + "olddefconfig", "alldefconfig", "allnoconfig", "allmodconfig", @@ -41,6 +42,7 @@ setuptools.setup( "menuconfig = menuconfig:_main", "genconfig = genconfig:main", "oldconfig = oldconfig:_main", + "olddefconfig = olddefconfig:main", "alldefconfig = alldefconfig:main", "allnoconfig = allnoconfig:main", "allmodconfig = allmodconfig:main", |
