diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-12-01 17:15:49 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-12-01 17:29:29 +0100 |
| commit | a4751b5d94e713b2206889a4aab54388df1ca33f (patch) | |
| tree | a18ee7af60ee4b4f7a660786f1ee445971f78add /kconfiglib.py | |
| parent | 6d34d9b11cc9587f123e7b5fe3d8de2cad3fa2b1 (diff) | |
Flag removed symbols as changed in sync_deps()
If a symbol is removed from a Kconfig file, it makes sense to flag it as
changed, so that things that still (probably accidentally) depend on it
get rebuilt.
Saw a patch for the C tools with the same effect floating around, so
might as well add it already. The C tools had other brokeness as well
though...
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index bec48ab..b268808 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1435,15 +1435,7 @@ class Kconfig(object): continue # 'sym' has a new value. Flag it. - - sym_path = sym.name.lower().replace("_", os.sep) + ".h" - sym_path_dir = os.path.dirname(sym_path) - if sym_path_dir and not os.path.exists(sym_path_dir): - os.makedirs(sym_path_dir, 0o755) - - # A kind of truncating touch, mirroring the C tools - os.close(os.open( - sym_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o644)) + _touch_dep_file(sym.name) # Remember the current values as the "new old" values. # @@ -1501,6 +1493,10 @@ class Kconfig(object): val = unescape(match.group(1)) self.syms[name]._old_val = val + else: + # Flag that the symbol no longer exists, in + # case something still depends on it + _touch_dep_file(name) def node_iter(self, unique_syms=False): """ @@ -5786,6 +5782,19 @@ def _sym_to_num(sym): return sym.tri_value if sym.orig_type in _BOOL_TRISTATE else \ int(sym.str_value, _TYPE_TO_BASE[sym.orig_type]) +def _touch_dep_file(sym_name): + # If sym_name is MY_SYM_NAME, touches my/sym/name.h. See the sync_deps() + # docstring. + + sym_path = sym_name.lower().replace("_", os.sep) + ".h" + sym_path_dir = os.path.dirname(sym_path) + if sym_path_dir and not os.path.exists(sym_path_dir): + os.makedirs(sym_path_dir, 0o755) + + # A kind of truncating touch, mirroring the C tools + os.close(os.open( + sym_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o644)) + def _internal_error(msg): raise InternalError( msg + |
