Skip to content

Commit

Permalink
kconfig: add support for KAS_LOCAL_ to allow to enable custom local.c…
Browse files Browse the repository at this point in the history
…onf lines by choice
  • Loading branch information
asac committed Apr 22, 2024
1 parent ad5e2f7 commit 4296e79
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
15 changes: 12 additions & 3 deletions kas/plugins/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def save_config(self, filename, top_repo_dir):
kas_targets = []
kas_build_system = None
kas_vars = {}
kas_local = []
menu_configuration = {}

for symname in self.kconf.syms:
Expand Down Expand Up @@ -201,6 +202,10 @@ def save_config(self, filename, top_repo_dir):
check_sym_is_string(sym)
if symvalue != '':
kas_includes.append(symvalue)
elif symname.startswith('KAS_LOCAL_'):
check_sym_is_string(sym)
if symvalue != '':
kas_local.append(symvalue)
elif symname.startswith('KAS_TARGET_'):
check_sym_is_string(sym)
if symvalue != '':
Expand Down Expand Up @@ -228,13 +233,17 @@ def save_config(self, filename, top_repo_dir):
config['build_system'] = kas_build_system
if len(kas_targets) > 0:
config['target'] = kas_targets
if len(kas_vars) > 0:
if len(kas_vars) > 0 or len(kas_local) > 0:
config['local_conf_header'] = {
'__menu_config_vars': '\n'.join([
f'{key} = "{value}"'
for key, value in kas_vars.items()
])
}
]),
'__menu_config_locals': '\n'.join(
f'{local}'
for local in kas_local
)
}

logging.debug('Menu configuration:\n%s', pprint.pformat(config))

Expand Down
13 changes: 13 additions & 0 deletions tests/test_menu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,16 @@ config KAS_TARGET_CHOICE
string
default "target1" if CHOICE1
default "target2" if CHOICE2

config PKG_NGINX
bool "nginx"
config KAS_LOCAL_PKG_NGINX
string
default "IMAGE_INSTALL += \"nginx\"" if PKG_NGINX

config PKG_MYSQL
bool "mysql"
config KAS_LOCAL_PKG_MYSQL
string
default "IMAGE_INSTALL += \"mysql\"" if PKG_MYSQL

0 comments on commit 4296e79

Please sign in to comment.