From 603db9e55be8c40494e790c4997c84211498de04 Mon Sep 17 00:00:00 2001 From: Maxime Chretien Date: Fri, 12 Jun 2020 15:44:12 +0200 Subject: [PATCH 1/3] Index CONFIG_ references in makefiles Signed-off-by: Maxime Chretien --- lib.py | 5 ++++- update.py | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib.py b/lib.py index 61dabf7..7b218b3 100755 --- a/lib.py +++ b/lib.py @@ -207,6 +207,8 @@ def getFileFamily(filename): # Some files are named like Kconfig-nommu so we only check the first 7 letters # We also exclude documentation files that can be named kconfig return 'K' # Kconfig files + elif name.lower()[:8] in ['makefile'] and not ext.lower() in ['.rst']: + return 'M' # Makefiles else : return None @@ -215,7 +217,8 @@ def getFileFamily(filename): compatibility_list = { 'C' : ['C', 'K'], 'K' : ['K'], - 'D' : ['D', 'CM'] + 'D' : ['D', 'CM'], + 'M' : ['K'] } # Check if families are compatible diff --git a/update.py b/update.py index 08bc759..4169b29 100755 --- a/update.py +++ b/update.py @@ -231,7 +231,7 @@ class UpdateDefs(Thread): filename = db.file.get(idx) family = lib.getFileFamily(filename); - if family == None: continue + if family in [None, 'M']: continue lines = scriptLines('parse-defs', hash, filename, family) @@ -312,7 +312,9 @@ class UpdateRefs(Thread): if even: tok = prefix + tok - if db.defs.exists(tok): + if (db.defs.exists(tok) and + (family != 'M' or tok.startswith(b'CONFIG_'))): + # We only index CONFIG_??? in makefiles if tok in idents: idents[tok] += ',' + str(line_num) else: @@ -374,7 +376,7 @@ class UpdateDocs(Thread): filename = db.file.get(idx) family = lib.getFileFamily(filename) - if family == None: continue + if family in [None, 'M']: continue lines = scriptLines('parse-docs', hash, filename) with docs_lock: @@ -435,7 +437,7 @@ class UpdateComps(Thread): filename = db.file.get(idx) family = lib.getFileFamily(filename) - if family in [None, 'K']: continue + if family in [None, 'K', 'M']: continue lines = compatibles_parser.run(scriptLines('get-blob', hash), family) comps = {} From d7b4fc53f181d6d216f585f3771a3ad4d493ca28 Mon Sep 17 00:00:00 2001 From: Maxime Chretien Date: Fri, 12 Jun 2020 16:08:15 +0200 Subject: [PATCH 2/3] filters/makefileo.py : Reject macro named with a .o Signed-off-by: Maxime Chretien --- http/filters/makefileo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http/filters/makefileo.py b/http/filters/makefileo.py index 24cc39d..b3ce1a9 100644 --- a/http/filters/makefileo.py +++ b/http/filters/makefileo.py @@ -11,7 +11,7 @@ def replace_makefileo(m): w = makefileo[decode_number(m.group(1)) - 1] dir_name = os.path.dirname(path) - + if dir_name != '/': dir_name += '/' @@ -20,7 +20,7 @@ def replace_makefileo(m): makefileo_filters = { 'case': 'filename', 'match': {'Makefile'}, - 'prerex': '(?<=\s)([-\w/]+)\.o(?!\w)', + 'prerex': '(?<=\s)([-\w/]+)\.o(?!\w)(?! :?=)', 'prefunc': keep_makefileo, 'postrex': '__KEEPMAKEFILEO__([A-J]+)\.o', 'postfunc': replace_makefileo From bf31d7171f4b346b15559240686a8807aeeebd61 Mon Sep 17 00:00:00 2001 From: Maxime Chretien Date: Fri, 12 Jun 2020 21:17:57 +0200 Subject: [PATCH 3/3] filters: Remove makefilekconfig filter Signed-off-by: Maxime Chretien --- http/filters/commonkconfig.py | 1 - http/filters/makefilekconfig.py | 22 ---------------------- 2 files changed, 23 deletions(-) delete mode 100644 http/filters/makefilekconfig.py diff --git a/http/filters/commonkconfig.py b/http/filters/commonkconfig.py index 18378c8..778e058 100644 --- a/http/filters/commonkconfig.py +++ b/http/filters/commonkconfig.py @@ -2,4 +2,3 @@ exec(open('kconfig.py').read()) exec(open('kconfigidents.py').read()) -exec(open('makefilekconfig.py').read()) diff --git a/http/filters/makefilekconfig.py b/http/filters/makefilekconfig.py deleted file mode 100644 index 0ec4da6..0000000 --- a/http/filters/makefilekconfig.py +++ /dev/null @@ -1,22 +0,0 @@ -# Filters for Kconfig used in Makefiles - -makefilekconfig = [] - -def keep_makefilekconfig(m): - makefilekconfig.append(m.group(1)) - return '$(__KEEPMAKEFILEKCONFIG__' + encode_number(len(makefilekconfig)) + ')' - -def replace_makefilekconfig(m): - i = makefilekconfig[decode_number(m.group(1)) - 1] - return ''+i+'' - -makefilekconfig_filters = { - 'case': 'filename', - 'match': {'Makefile'}, - 'prerex': '\$\((CONFIG_\w+)\)', - 'prefunc': keep_makefilekconfig, - 'postrex': '__KEEPMAKEFILEKCONFIG__([A-J]+)', - 'postfunc': replace_makefilekconfig - } - -filters.append(makefilekconfig_filters)