Add kconfiglib-based menu plugin

This uses the kconfiglib python module to implement simple interactive
configuration for complex layers with many kas options and even variable
input. See the menu.py documentation header for details on the Kconfig
format and its translation to kas.

Rather than using the limited menuconfig implementation of kconfiglib,
this comes with an own, python-newt based version. The permits smooth
integration in the workflow, e.g. to offer an option that directly
triggers a build after completing a configuration. And it comes with a
nicer layout.

Unfortunately, python-newt can't be fulfilled via pip. But it is
available as proper package via common distros. So warn if the package
is missing.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka
2021-07-10 11:25:13 +02:00
parent 4c975a04f9
commit 4f23045ce8
6 changed files with 538 additions and 0 deletions

View File

@@ -103,3 +103,9 @@ Changed behavior
- String item ``includes`` are now using repo-relative paths. File-relative is
still supported by issues a deprecation warning.
Added
~~~~~
- ``menu_configuration`` key stores the selections done via ``kas menu`` in a
configuration file. It is only evaluated by that plugin.

View File

@@ -10,6 +10,8 @@ This project depends on
- distro Python 3 package
- jsonschema Python 3 package
- PyYAML Python 3 package (optional, for yaml file support)
- kconfiglib Python 3 package (optional, for menu plugin)
- NEWT Python 3 distro package (optional, for menu plugin)
To install kas into your python site-package repository, run::
@@ -64,6 +66,12 @@ Use Cases
$ git pull
$ kas build kas-project.yml
3. Interactive configuration::
$ cd $PROJECT_DIR/meta-project
$ kas menu
$ kas build # optional, if not triggered via kas menu
Plugins
-------
@@ -86,6 +94,11 @@ typically provides a single command.
.. automodule:: kas.plugins.for_all_repos
``menu`` plugin
~~~~~~~~~~~~~~~~
.. automodule:: kas.plugins.menu
``shell`` plugin
~~~~~~~~~~~~~~~~
@@ -420,3 +433,9 @@ Configuration reference
* ``<local-conf-id>``: string [optional]
A string that is added to the ``local.conf``. It operates in the same way
as the ``bblayers_conf_header`` entry.
* ``menu_configuration``:: dict [optional]
This contains user choices for a Kconfig menu of a project. Each variable
corresponds to a Kconfig configuration variable and can be of the types
string, boolean or integer. The content of this key is typically
maintained by the ``kas menu`` plugin in a ``.config.yaml`` file.