mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
filter out every foreign arch in config
This commit is contained in:
parent
5d79fcca22
commit
e034327501
@ -171,12 +171,18 @@ class Configuration(configparser.RawConfigParser):
|
||||
:param architecture: repository architecture
|
||||
"""
|
||||
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):
|
||||
self.add_section(section) # add section if not exists
|
||||
# get overrides
|
||||
specific = self.section_name(section, architecture)
|
||||
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)
|
||||
self.remove_section(specific) # remove overrides
|
||||
# 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)
|
||||
|
Loading…
Reference in New Issue
Block a user