From b495110ce9cfc3ba53ac7576892547614d75dd73 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Tue, 3 Jan 2023 10:10:57 +0100 Subject: [PATCH] annotations: remove configs that are undefined across all arches/flavours Sometimes certain config options are removed in new kernels, so when annotations is updated these options result to be undefined across all architectures and flavours, in this case it's much more clean to simply drop them from annotations (considering that the kernel doesn't support them anymore). Signed-off-by: Andrea Righi --- kconfig/annotations.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kconfig/annotations.py b/kconfig/annotations.py index e7eb423..20e7451 100644 --- a/kconfig/annotations.py +++ b/kconfig/annotations.py @@ -213,6 +213,10 @@ class Annotation(Config): for flavour in self.config[conf]['policy'].copy(): if flavour not in list(set(self.arch + self.flavour)): del self.config[conf]['policy'][flavour] + # Remove configs that are all undefined across all arches/flavours + if 'policy' in self.config[conf]: + if list(set(self.config[conf]['policy'].values())) == ['-']: + self.config[conf]['policy'] = {} # Drop empty rules if not self.config[conf]['policy']: del self.config[conf] -- 2.31.1