diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-01 03:52:32 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-01 04:17:13 +0200 |
| commit | 3b692df8996f5ce55037f5340a6e92db8ad4df67 (patch) | |
| tree | f88f7e570e0f96f758170f5f0c1ac4f74e06ba66 | |
| parent | 6aab113523a52c2767832a3df35c6c82d3197c60 (diff) | |
olddefconfig: Add script
Works like 'make olddefconfig', updating a configuration by filling in
default values for all new symbols.
This could also be accomplished by entering the 'menuconfig' interface
and saving the configuration, but it's more awkward and less obvious.
Piggyback two oldconfig changes:
- Mention KCONFIG_CONFIG
- Check if the .config file exists before parsing the Kconfig files,
instead of after
| -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", |
