Skip to content

WIP: Add US postmarketos binary repository mirror

Daniele Debernardi requested to merge feature/us-mirror into master

I've used the mirror for the last month and it works perfectly.

The repository is stored in a virtual machine in azure and performs an rsync every 5 minutes.

I'm thinking about a way to select the best mirror according to the user location, but for now my rudimentary solution is to download the page and measure the time, something like:

mirrors_pmos_default = list()
for mirror in pmb.config.defaults["mirrors_postmarketos"]:
    mirrors_pmos_default.append((mirror, pmb.helpers.http.latency(args, mirror)))
args.mirrors_postmarketos = []
for mirror, latency in sorted(mirrors_pmos_default, key=lambda m: m[1]):
    args.mirrors_postmarketos.append(mirror)
...
def latency(args, url):
    start_timer = time.time()
    nf = urllib.request.urlopen(url)
    nf.read()
    return time.time() - start_timer

if someone has a better idea let me know

Edited by Oliver Smith

Merge request reports