summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrent s <bts@square-r00t.net>2020-06-18 04:14:18 -0400
committerbrent s <bts@square-r00t.net>2020-06-18 04:14:18 -0400
commit1a5068d77d73810938a34e23fadf3e3794c422fc (patch)
tree84ac995b2fe1f311f36243e38390099a8b4509b4
parent3ece313a6fd7535d5cd6b74f51e870cdb008f55f (diff)
downloadRepoMirror-1a5068d77d73810938a34e23fadf3e3794c422fc.tar.xz
fucking fedora.
-rwxr-xr-xrepomirror/utils/find_fastest_upstream/centos_epel.py87
1 files changed, 47 insertions, 40 deletions
diff --git a/repomirror/utils/find_fastest_upstream/centos_epel.py b/repomirror/utils/find_fastest_upstream/centos_epel.py
index e2ed9fa..5560b79 100755
--- a/repomirror/utils/find_fastest_upstream/centos_epel.py
+++ b/repomirror/utils/find_fastest_upstream/centos_epel.py
@@ -25,47 +25,54 @@ class Ranker(classes.Ranker):
if preferred_proto not in ('rsync', 'ftp'):
raise ValueError('Invalid preferred_proto; must be one of rsync or ftp')
non_preferred = ('rsync' if preferred_proto == 'ftp' else 'ftp')
- mirror_section = self.bs.find('h2', string = 'Public active mirrors')
- mirror_table = mirror_section.find_next('table')
- if mirror_table is None:
- return(None)
- # https://stackoverflow.com/a/56835562/733214
- headers = [h.text for h in mirror_table.find_all('th')]
- rows = [m for m in mirror_table.find_all('tr')][1:]
- for row in rows:
- mirror = {}
- do_skip = False
- for idx, cell in enumerate(row.find_all('td')):
- k = headers[idx]
- v = cell.text.strip()
- if k == 'Country' and v != self.my_info['country']:
- do_skip = True
- continue
- if k == 'Categories' and not do_skip:
- if 'EPEL' not in v:
- do_skip = True
- continue
- pref_proto = cell.find('a', attrs = {
- 'href': re.compile(r'^{0}://'.format(preferred_proto), re.IGNORECASE)})
- non_pref = cell.find('a', attrs = {
- 'href': re.compile(r'^{0}://'.format(non_preferred), re.IGNORECASE)})
- if pref_proto is not None:
- v = pref_proto['href']
- elif non_pref is not None:
- v = non_pref['href']
- else:
- v = None
- mirror['url'] = v
- # Fedora team can't spell.
- elif k in ('Bandwidth', 'Bandwith'):
- mirror['bw'] = int(v)
- if do_skip:
- continue
- if not mirror['url']:
- continue
- self.raw_mirrors.append(mirror)
- self.mirror_candidates.append(mirror['url'])
+ print(('Fedora (who maintains EPEL) do their mirroring in an extremely weird way.\n'
+ 'See https://fedoraproject.org/wiki/Infrastructure/Mirroring and '
+ 'https://fedoraproject.org/wiki/Infrastructure/Mirroring/Tiering#Tier_1_Mirrors for which mirrors and '
+ 'how to sync.'))
return(None)
+ # mirror_section = self.bs.find('h2', string = 'Public active mirrors')
+ # mirror_table = mirror_section.find_next('table')
+ # if mirror_table is None:
+ # return(None)
+ # # https://stackoverflow.com/a/56835562/733214
+ # headers = [h.text for h in mirror_table.find_all('th')]
+ # rows = [m for m in mirror_table.find_all('tr')][1:]
+ # for row in rows:
+ # mirror = {}
+ # do_skip = False
+ # for idx, cell in enumerate(row.find_all('td')):
+ # k = headers[idx]
+ # v = cell.text.strip()
+ # if k == 'Country' and v != self.my_info['country']:
+ # do_skip = True
+ # continue
+ # if k == 'Categories' and not do_skip:
+ # # TODO: DO THIS BETTER! Their mirrorlist sucks and is not easily parsed at all.
+ # # I need to check and try to grab the specific URL that contains "epel".
+ # if 'EPEL' not in v:
+ # do_skip = True
+ # continue
+ # pref_proto = cell.find('a', attrs = {
+ # 'href': re.compile(r'^{0}://'.format(preferred_proto), re.IGNORECASE)})
+ # non_pref = cell.find('a', attrs = {
+ # 'href': re.compile(r'^{0}://'.format(non_preferred), re.IGNORECASE)})
+ # if pref_proto is not None:
+ # v = pref_proto['href']
+ # elif non_pref is not None:
+ # v = non_pref['href']
+ # else:
+ # v = None
+ # mirror['url'] = v
+ # # Fedora team can't spell.
+ # elif k in ('Bandwidth', 'Bandwith'):
+ # mirror['bw'] = int(v)
+ # if do_skip:
+ # continue
+ # if not mirror['url']:
+ # continue
+ # self.raw_mirrors.append(mirror)
+ # self.mirror_candidates.append(mirror['url'])
+ # return(None)
def parseArgs():