Commit 4b18761e authored by shadMod's avatar shadMod 💬

populate_archs_releases() populate 'latest' key and if it's not a LTS get up latest LTS version

mv populate_archs_releases() before get_releases()
parent d5a1f850
...@@ -189,9 +189,26 @@ class CompileVersion: ...@@ -189,9 +189,26 @@ class CompileVersion:
with open(self.path_out, "w") as out: with open(self.path_out, "w") as out:
toml.dump(data, out) toml.dump(data, out)
def get_releases(self, data: list, distro: str, arch: str, typology: str) -> dict: def populate_archs_releases(self, distro: str, arch: str) -> dict:
"""
:param distro: name of the distro
:param arch: name of the architecture
""" """
:param typology: latest or lts
rels = {}
res, typology = self.get_releases(self.list_version, distro, arch)
rels['latest'] = res
if typology == 'interim':
res, _ = self.get_releases(self.ver_lts_list, distro, arch)
rels['lts'] = res
if not rels:
raise Exception("No archs releases")
return rels
def get_releases(self, data: list, distro: str, arch: str) -> (dict, str):
""" """
version, codename, host = None, None, None version, codename, host = None, None, None
for version, codename, name in sorted(data, key=lambda x: x[0], reverse=True): for version, codename, name in sorted(data, key=lambda x: x[0], reverse=True):
...@@ -221,12 +238,3 @@ class CompileVersion: ...@@ -221,12 +238,3 @@ class CompileVersion:
if host is None: if host is None:
raise Exception("No correct host") raise Exception("No correct host")
def populate_archs_releases(self, distro: str, arch: str) -> dict:
rels = {}
for key, data in self.list_version.items():
rels[key] = self.get_releases(data, distro, arch, key)
if not rels:
raise Exception("Empty dict archs releases")
return rels
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment