diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-04-08 21:11:45 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-04-08 21:14:07 +0200 |
commit | ed8535368dfb2e92077126eba1e78ee57f89448c (patch) | |
tree | 78c88e568bfdfd51f24fa4f2e3e385b62b22eb06 /lib/kconfig.py | |
parent | 35d1b56e93e192c926c866f2f69123bddccc0826 (diff) |
gentree: make automatic backport filenames unique
Instead of copying drivers/base/hdmi.c to just hdmi.c copy it to
drivers-base-hdmi.c as there can be multiple files with the same
name (e.g. "core.c"). While at it, also fix this mechanism for
modules -- before having more than a single file for a module
would have caused multiple modules which clearly can't work, now
it's needed to give a #module-name and it will be added to the
Makefile correctly.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'lib/kconfig.py')
-rw-r--r-- | lib/kconfig.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/kconfig.py b/lib/kconfig.py index b971c205..406e375b 100644 --- a/lib/kconfig.py +++ b/lib/kconfig.py @@ -9,7 +9,7 @@ tri_line = re.compile(r'^(?P<spc>\s+)tristate') bool_line = re.compile(r'^(?P<spc>\s+)bool') cfg_line = re.compile(r'^(config|menuconfig)\s+(?P<sym>[^\s]*)') sel_line = re.compile(r'^(?P<spc>\s+)select\s+(?P<sym>[^\s]*)\s*$') -ch_line = re.compile(r'^\s+#(?P<ch>[ch])-file\s*(?P<file>.*)') +backport_line = re.compile(r'^\s+#(?P<key>[ch]-file|module-name)\s*(?P<name>.*)') class ConfigTree(object): def __init__(self, rootfile): @@ -118,6 +118,7 @@ def get_backport_info(filename): f = open(filename, 'r') result = {} conf = None + module_name = None # trick to always have an empty line last def append_empty(f): @@ -129,9 +130,10 @@ def get_backport_info(filename): m = cfg_line.match(line) if not line.strip() or m: if conf and conf_type and (c_files or h_files): - result[conf] = (conf_type, c_files, h_files) + result[conf] = (conf_type, module_name, c_files, h_files) conf = None conf_type = None + module_name = None c_files = [] h_files = [] if m: @@ -147,10 +149,12 @@ def get_backport_info(filename): if m: conf_type = 'bool' continue - m = ch_line.match(line) + m = backport_line.match(line) if m: - if m.group('ch') == 'c': - c_files.append(m.group('file')) - elif m.group('ch') == 'h': - h_files.append(m.group('file')) + if m.group('key') == 'c-file': + c_files.append(m.group('name')) + elif m.group('key') == 'h-file': + h_files.append(m.group('name')) + elif m.group('key') == 'module-name': + module_name = m.group('name') return result |