UBUNTU: [Packaging] 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 <andrea.righi@canonical.com>
This commit is contained in:
Andrea Righi
2023-01-03 10:12:44 +01:00
committed by Paolo Pisati
parent b680888de6
commit 93592077df
+4
View 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]