Commit f4ca7251 authored by shadMod's avatar shadMod 💬

added select parameter in populate_archs_releases() to select a given release

by using the 'releases' key in constants.json

Fixes: issue #27
parent 7a169290
......@@ -114,9 +114,6 @@ class Downloads:
for distro, config in self.config["distros"].items():
for release in config["releases"]:
if config["lts-only"]:
continue
for arch in config["archs"].keys():
url = self.url_for(distro, release, arch, use_random=False)
path, file = url.rsplit("/", 1)
......@@ -271,6 +268,7 @@ class Downloads:
torrent = "torrent" in flask.request.form
# release = 'latest' if release == 'interim' else 'lts'
data_rel = self.config["distros"][distro]["archs"][arch][release]
payload = signer.dumps(
{
......
......@@ -155,27 +155,19 @@ class CompileVersion:
for key in data["distros"]:
# get single distro
distro = data["distros"][key]
# set up key lts-only with default False
distro["lts-only"] = False
# set up the support years of the LTS
distro["lts-support-years"] = (
5 if key in self.SUPPORT_5 else 3
)
# define releases and relative ordering
distro["releases"] = (
["latest", "lts"]
if key not in self.INVERT_RELEASES
else ["lts", "latest"]
)
# put default arch: 'amd64'
releases = {
"amd64": self.populate_archs_releases(key, "amd64")
"amd64": self.populate_archs_releases(key, "amd64", distro["releases"])
}
# check and adding any other archs
add_archs = distro.get("add_archs")
if add_archs:
for _arch in add_archs:
releases[_arch] = self.populate_archs_releases(key, _arch)
releases[_arch] = self.populate_archs_releases(key, _arch, distro["releases"])
# put all releases in archs key
distro["archs"] = releases
......@@ -188,20 +180,23 @@ class CompileVersion:
with open(self.path_out, "w") as out:
toml.dump(data, out)
def populate_archs_releases(self, distro: str, arch: str) -> dict:
def populate_archs_releases(self, distro: str, arch: str, select) -> dict:
"""
:param distro: name of the distro
:param arch: name of the architecture
:param select: list of version required
"""
rels = {}
res, typology = self.get_releases(self.list_version, distro, arch)
rels['latest'] = res
if typology == 'interim':
if typology == "interim" and "interim" in select:
rels['interim'] = res
if "lts" in select:
res, _ = self.get_releases(self.ver_lts_list, distro, arch)
rels['lts'] = res
else:
res, _ = self.get_releases(self.ver_lts_list, distro, arch)
rels['lts'] = res
rels['interim'] = res
if not rels:
raise Exception("No archs releases")
......
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