Skip to content
Browse files

kconfiglib: Unclutter symbol strings, avoid redundant writes, misc.

Update kconfiglib, menuconfig, and guiconfig to upstream revision
5c904f4549 to get various improvements and fixes in:

 - Marc Herbert found an issue involving symlinks, absolute paths,
   and rsource that could lead to files not being found. The root cause
   was relpath() assuming that symlink/../bar is the same as bar/, which
   isn't guaranteed.

   Fix it by handling paths in a simpler, more textual way.

 - Propagated dependencies from 'depends on' are now stripped from
   properties when symbols are printed (e.g. in information dialogs and
   generated documentation).

   The printed representation now also uses shorthands.


     config A
             prompt "foo" if C && D
             default A if B && C && D
             depends on C && D


     config A
             bool "foo"
             default A if B
             depends on C && D

 - Before writing a configuration file or header, Kconfiglib now
   compares the previous contents of the file against the new contents,
   and skips the write if there's no change. This avoids updating the
   modification time, and can save work.

   A message like "No change to '.config'" is shown when there's no

 - .config now has '# end of <menu>' comments to make it easier to see
   where a menu ends. This was taken from a change to the C tools.

 - load_config() and write_(min_)config() now return a message that can
   be printed with print(kconf.load_config()). This allows messages to
   be reused in e.g. the configuration interfaces (nice now that there's
   also a "No change to..." string).

Signed-off-by: Ulf Magnusson <>
  • Loading branch information...
ulfalizer authored and carlescufi committed Jun 3, 2019
1 parent 960041b commit cc14c40a2dd88d48eff1ec82a4dd12688604bfde
Showing with 675 additions and 367 deletions.
  1. +15 −13 scripts/kconfig/
  2. +638 −339 scripts/kconfig/
  3. +22 −15 scripts/kconfig/
@@ -175,12 +175,12 @@ def menuconfig(kconf):


# Load existing configuration and check if it's outdated

# Filename to save configuration to
_conf_filename = standard_config_filename()

# Load existing configuration and check if it's outdated

# Filename to save minimal configuration to
_minconf_filename = "defconfig"

@@ -238,7 +238,8 @@ def _load_config():
# Returns True if .config is missing or outdated. We always prompt for
# saving the configuration in that case.

if not _kconf.load_config():
if not os.path.exists(_conf_filename):
# No .config
return True

@@ -639,7 +640,8 @@ def _set_conf_changed(changed):
global _conf_changed

_conf_changed = changed
_set_status("Modified" if changed else "")
if changed:

def _update_tree():
@@ -1341,7 +1343,6 @@ def _save(_=None):

if _try_save(_kconf.write_config, _conf_filename, "configuration"):
_set_status("Configuration saved to " + _conf_filename)


@@ -1363,7 +1364,6 @@ def _save_as():

if _try_save(_kconf.write_config, filename, "configuration"):
_set_status("Configuration saved to " + filename)
_conf_filename = filename

@@ -1433,7 +1433,6 @@ def _open(_=None):


_set_status("Configuration loaded from " + filename)

@@ -1694,8 +1693,10 @@ def _try_save(save_fn, filename, description):
# String describing the thing being saved

print("{} saved to '{}'".format(description, filename))
# save_fn() returns a message to print
msg = save_fn(filename)
return True
except (OSError, IOError) as e:
@@ -1714,8 +1715,9 @@ def _try_load(filename):
# Configuration file to load

print("configuration loaded from " + filename)
msg = _kconf.load_config(filename)
return True
except (OSError, IOError) as e:
@@ -2222,7 +2224,7 @@ def _kconfig_def_info(item):

nodes = [item] if isinstance(item, MenuNode) else item.nodes

s = "Kconfig definition{}, with propagated dependencies\n" \
s = "Kconfig definition{}, with parent deps. propagated to 'depends on'\n" \
.format("s" if len(nodes) > 1 else "")
s += (len(s) - 1)*"="

0 comments on commit cc14c40

Please sign in to comment.
You can’t perform that action at this time.