1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

Simplify primary mirror logic

Assume repo_url/archive_url to be valid URL and mark it as a primary
mirror.
This commit is contained in:
Jochen Sprickerhof 2022-06-03 09:17:28 +02:00
parent dc971b39ee
commit 72e3d07acb

View File

@ -713,14 +713,13 @@ def v2_repo(repodict, repodir, archive):
repo["address"] = repodict["address"]
repo["webBaseUrl"] = "https://f-droid.org/packages/"
if "repo_url" in common.config:
primary_mirror = common.config["repo_url"][:-len("/repo")]
if "mirrors" in repodict and primary_mirror not in repodict["mirrors"]:
repodict["mirrors"].append(primary_mirror)
if "mirrors" in repodict:
repo["mirrors"] = [{"url": mirror} for mirror in repodict["mirrors"]]
# the first entry is traditionally the primary mirror
if repodict['address'] not in repodict["mirrors"]:
repo["mirrors"].insert(0, {"url": repodict['address'], "isPrimary": True})
repo["timestamp"] = repodict["timestamp"]
anti_features = load_locale("antiFeatures", repodir)