Skip to content
Snippets Groups Projects
Commit 116dd661 authored by Frede H's avatar Frede H :speech_balloon:
Browse files

selected commits merged

parent 91b5bae7
No related branches found
No related tags found
No related merge requests found
......@@ -17,31 +17,27 @@ Package that provides all mirrors for Manjaro Linux.
- A GUI for selecting the mirrors to used to generate a custom list.
### How does fasttrack work
First of all, a working internet connection is mandatory. pacman-mirrors always checks if network is online. It is doing so by pinging google with 3 packets.
First of all, a working internet connection is mandatory. Pacman-Mirrors always checks if network is online. It is doing so by pinging google with 3 packets.
The following arguments `-c -i -m --geoip` will not work in conjunction with `-f`.
The following arguments `-c -i -m --geoip` will not work in conjunction with `-f`.
#### Question:
So, `pacman-mirrors -f 2` takes the same time to create `/etc/pacman.d/mirrorlist` as `pacman-mirrors -f 20`?
##### Answer:
No. `pacman-mirors -f 2` will be faster than `pacman-mirrors -f 20` since only 2 mirrors are probed vs 20 mirrors but since most mirrors respond within the first second it is barely noticeable.
#### Question:
`pacman-mirrors -f n` always ranks ALL mirrors by response time (the same as `pacman-mirrors -g` does) and additionally takes up-to-date mirrors and writes only **n** mirrors to `/etc/pacman.d/mirrorlist`?
##### Answer:
No. `pacman-mirrors -f n` ranks on a sorted list with known up-to-date mirrors. Thus it is only the first **n** mirrors from this list which are actually probed. If you have a list of 30 mirrors which are up-to-date and use `-f 5` only the top 5 mirrors are probed and then sorted after response time.
The switch does not guarantee you get **the n** fastest mirrors only that they are responsive and up-to-date. Mirrors which have network errors or times out are not considered at all.
##### Answer:
No. `pacman-mirrors -f n` ranks on a sorted list with known up-to-date mirrors. Thus it is only the first **n** mirrors from this list which are actually probed. If you have a list of 30 mirrors which are uptodate and use `-f 5` only the top 5 mirrors are probed and then sorted after response time.
The switch does not guarantee you get **the n** fastest mirrors only that they are responsive and uptodate. Mirrors which have network errors or times out are not considered at all.
#### Beware
The smaller number you choose to write to the mirrorlist will increase the possibility of not getting a responsive mirror since only the first **n** in the list are tested not all of them.
A reasonable number is between 5 and 10.
The force of this approach is that we know forehand if the mirror is up-to-date and thus only have to rank **n** mirrors from the mirrors known to be up-to-date.
The force of this approach is that we know forehand if the mirror is uptodate and thus only have to rank **n** mirrors from the mirrors known to be uptodate.
If you need a complete ranking then `pacman-mirrors -g` is the way to go.
## Technologies
pacman-mirrors uses open-source projects to work properly:
* [Python 3](https://www.python.org)
* [GTK+ 3](https://www.gtk.org)
* [npyscreen](https://github.com/npcole/npyscreen)
pacman-mirrors is build with Python and Gtk3.
......@@ -25,6 +25,7 @@ import json
def list_to_tuple(list_data, named_tuple):
"""
Comvert list to a list with named tuples
:param list_data: the list to convert
:param named_tuple: tuple list item converts to
:return data: list of named tuples
......@@ -37,6 +38,7 @@ def list_to_tuple(list_data, named_tuple):
def rows_from_tuple(servers, joiner=" | "):
"""
Generates equal formatted lines
:param servers: named tuples
:param joiner: string used to join tuple items
:return lines: list of nicely formatted lines
......
......@@ -81,6 +81,7 @@ class ConsoleUI(npyscreen.NPSAppManaged):
def done(self, selection):
"""
After editing
:param selection:
"""
if selection:
......
......@@ -161,10 +161,9 @@ def update_mirrors(config):
:rtype: tuple
"""
result = None
connected = is_connected("http://repo.manjaro.org")
if connected:
print(".: {} {} {}".format(txt.INF_CLR, txt.DOWNLOADING_MIRROR_FILE,
txt.REPO_SERVER))
mjro_online = is_connected("http://repo.manjaro.org")
if mjro_online:
print(".: {} {} {}".format(txt.INF_CLR, txt.DOWNLOADING_MIRROR_FILE, txt.REPO_SERVER))
result = download_mirrors(config)
else:
if not filefn.check_file(config["mirror_file"]):
......
......@@ -34,6 +34,7 @@ def read_json_file(filename, dictionary=True):
else:
with open(filename, "r") as infile:
result = json.load(infile)
except OSError:
pass
return result
......
......@@ -32,14 +32,19 @@ def build_country_list(selectedcountries, countrylist, geoip=False):
:rtype: list
"""
result = []
if selectedcountries == ["all"]:
result = countrylist
elif validfn.country_list_is_valid(selectedcountries, countrylist):
result = selectedcountries
if not result and geoip:
country = get_geoip_country(countrylist)
if country: # valid geoip
result = country
if selectedcountries:
if selectedcountries == ["all"]:
result = countrylist
else:
if validfn.country_list_is_valid(selectedcountries, countrylist):
result = selectedcountries
if not result:
if geoip:
country = get_geoip_country(countrylist)
if country: # valid geoip
result = country
else:
result = countrylist
else:
result = countrylist
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment