filter out every foreign arch in config

This commit is contained in:
Evgenii Alekseev 2021-03-31 01:55:39 +03:00
parent 5d79fcca22
commit e034327501

View File

@ -171,12 +171,18 @@ class Configuration(configparser.RawConfigParser):
:param architecture: repository architecture :param architecture: repository architecture
""" """
for section in self.ARCHITECTURE_SPECIFIC_SECTIONS: for section in self.ARCHITECTURE_SPECIFIC_SECTIONS:
# get overrides
specific = self.section_name(section, architecture)
if not self.has_section(specific):
continue # no overrides
if not self.has_section(section): if not self.has_section(section):
self.add_section(section) # add section if not exists self.add_section(section) # add section if not exists
for key, value in self[specific].items(): # get overrides
self.set(section, key, value) specific = self.section_name(section, architecture)
self.remove_section(specific) # remove overrides if self.has_section(specific):
# if there is no such section it means that there is no overrides for this arch
# but we anyway will have to delete sections for others archs
for key, value in self[specific].items():
self.set(section, key, value)
# remove any arch specific section
for foreign in self.sections():
# we would like to use lambda filter here, but pylint is too dumb
if not foreign.startswith(f"{section}_"):
continue
self.remove_section(foreign)