From 30ca5c7a88f0e220ec0acce83ac20581c4514164 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Fri, 26 Apr 2019 12:50:20 +0200 Subject: [PATCH] Confgen: Fix prefix removal to work for exact match only --- tools/kconfig_new/confgen.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/kconfig_new/confgen.py b/tools/kconfig_new/confgen.py index 5d49c85392..68c453a868 100755 --- a/tools/kconfig_new/confgen.py +++ b/tools/kconfig_new/confgen.py @@ -58,6 +58,12 @@ class DeprecatedOptions(object): rep_dic = {} rev_rep_dic = {} + def remove_config_prefix(string): + if string.startswith(self.config_prefix): + return string[len(self.config_prefix):] + raise RuntimeError('Error in {} (line {}): Config {} is not prefixed with {}' + ''.format(rep_path, line_number, string, self.config_prefix)) + for root, dirnames, filenames in os.walk(repl_dir): for filename in fnmatch.filter(filenames, self._REN_FILE): rep_path = os.path.join(root, filename) @@ -75,7 +81,8 @@ class DeprecatedOptions(object): 'replacement {} is defined'.format(rep_path, line_number, rep_dic[sp_line[0]], sp_line[0], sp_line[1])) - (dep_opt, new_opt) = (x.lstrip(self.config_prefix) for x in sp_line) + + (dep_opt, new_opt) = (remove_config_prefix(x) for x in sp_line) rep_dic[dep_opt] = new_opt rev_rep_dic[new_opt] = dep_opt return rep_dic, rev_rep_dic