euscan: shuffle mirrors
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
parent
bd034cadf1
commit
d5bf980779
@ -97,13 +97,21 @@ def to_ebuild_uri(cpv, url):
|
|||||||
url = url.replace(src, '${%s}' % dst)
|
url = url.replace(src, '${%s}' % dst)
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def from_mirror(url):
|
def load_mirrors():
|
||||||
if not url.startswith('mirror://'):
|
import random
|
||||||
return url
|
|
||||||
|
|
||||||
global mirrors_
|
global mirrors_
|
||||||
if mirrors_ is None:
|
if mirrors_ is None:
|
||||||
mirrors_ = portage.settings.thirdpartymirrors()
|
mirrors_ = portage.settings.thirdpartymirrors()
|
||||||
|
for mirror_name in mirrors_:
|
||||||
|
random.shuffle(mirrors_[mirror_name])
|
||||||
|
|
||||||
|
def from_mirror(url):
|
||||||
|
if not url.startswith('mirror://'):
|
||||||
|
return url
|
||||||
|
|
||||||
|
if not mirrors_:
|
||||||
|
load_mirrors()
|
||||||
|
|
||||||
for mirror_name in mirrors_:
|
for mirror_name in mirrors_:
|
||||||
prefix = 'mirror://' + mirror_name
|
prefix = 'mirror://' + mirror_name
|
||||||
@ -113,9 +121,8 @@ def from_mirror(url):
|
|||||||
return url
|
return url
|
||||||
|
|
||||||
def to_mirror(url):
|
def to_mirror(url):
|
||||||
global mirrors_
|
if not mirrors_:
|
||||||
if mirrors_ is None:
|
load_mirrors()
|
||||||
mirrors_ = portage.settings.thirdpartymirrors()
|
|
||||||
|
|
||||||
for mirror_name in mirrors_:
|
for mirror_name in mirrors_:
|
||||||
for mirror_url in mirrors[mirror_name]:
|
for mirror_url in mirrors[mirror_name]:
|
||||||
|
Loading…
Reference in New Issue
Block a user