annotations: remove configs that are undefined across all arches/flavours
authorAndrea Righi <andrea.righi@canonical.com>
Tue, 3 Jan 2023 09:10:57 +0000 (10:10 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 30 Jan 2023 08:12:28 +0000 (09:12 +0100)
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 <andrea.righi@canonical.com>
kconfig/annotations.py

index e7eb42324666f058a16e1993116334e57f987cd9..20e7451a0ae17b7c353a85d27dfdc3a2d7077b21 100644 (file)
@@ -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]