forked from public/mirror-checker
commit
82cf54f456
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains AlmaLinux class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class AlmaLinux(Distro): |
||||
"""AlmaLinux class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains Alpine class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class Alpine(Distro): |
||||
"""Alpine class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains Apache class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class Apache(Distro): |
||||
"""Apache class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains CentOS class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class CentOS(Distro): |
||||
"""CentOS class""" |
@ -0,0 +1,17 @@ |
||||
""" |
||||
Contains CPAN class |
||||
""" |
||||
|
||||
import requests |
||||
from distro import Distro |
||||
from shared import CSC_MIRROR |
||||
|
||||
class CPAN(Distro): |
||||
"""CPAN class""" |
||||
@staticmethod |
||||
def check(data, distro, current_time): |
||||
res_json = requests.get("http://mirrors.cpan.org/cpan-json.txt").json() |
||||
for mirror in res_json: |
||||
if mirror["url"] == f"{CSC_MIRROR}CPAN/": |
||||
return current_time - int(mirror["age"]) <= data[distro]["out_of_sync_interval"] |
||||
return False |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains Cygwin class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class Cygwin(Distro): |
||||
"""Cygwin class""" |
@ -0,0 +1,181 @@ |
||||
{ |
||||
"AlmaLinux": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://repo.almalinux.org/", |
||||
"file": "almalinux/TIME" |
||||
}, |
||||
"Alpine": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://uk.alpinelinux.org/", |
||||
"file": "alpine/last-updated" |
||||
}, |
||||
"Apache": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "apache/", |
||||
"upstream": "https://downloads.apache.org/", |
||||
"file": "zzz/time.txt" |
||||
}, |
||||
"Arch": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "archlinux/", |
||||
"upstream": "http://arch.mirror.constant.com/", |
||||
"file": "lastupdate" |
||||
}, |
||||
"CentOS": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://mirrors.edge.kernel.org/", |
||||
"file": "centos/TIME" |
||||
}, |
||||
"Ceph": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "ceph/", |
||||
"upstream": "https://download.ceph.com/", |
||||
"file": "timestamp" |
||||
}, |
||||
"CPAN": { |
||||
"out_of_sync_interval": 172800 |
||||
}, |
||||
"Cygwin": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "cygwin/", |
||||
"upstream": "https://cygwin.mirror.globo.tech/", |
||||
"file": "x86/sha512.sum" |
||||
}, |
||||
"Debian": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://ftp-master.debian.org/", |
||||
"file": "debian/project/trace/master" |
||||
}, |
||||
"DebianCD": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "http://debian.mirror.estruxture.net/", |
||||
"file": "debian-cd/project/trace/cdimage.debian.org" |
||||
}, |
||||
"DebianMultimedia": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "debian-multimedia/", |
||||
"upstream": "http://debian-mirrors.sdinet.de/deb-multimedia/", |
||||
"file": "project/trace/deb-multimedia.org" |
||||
}, |
||||
"DebianPorts": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://deb.debian.org/", |
||||
"file": "debian-ports/project/trace/porta.debian.org" |
||||
}, |
||||
"DebianSecurity": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "http://debian.mirror.iweb.ca/", |
||||
"file": "debian-security/project/trace/master" |
||||
}, |
||||
"Eclipse": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 172800, |
||||
"csc": "eclipse/", |
||||
"upstream": "http://download.eclipse.org/", |
||||
"file": "TIME" |
||||
}, |
||||
"Fedora": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "fedora/", |
||||
"upstream": "http://fedora.mirror.iweb.com/", |
||||
"file": "linux/development/rawhide/COMPOSE_ID" |
||||
}, |
||||
"FreeBSD": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "http://ftp4.freebsd.org/pub/", |
||||
"file": "FreeBSD/TIMESTAMP" |
||||
}, |
||||
"GentooDistfiles": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "gentoo-distfiles", |
||||
"upstream": "http://gentoo.mirrors.tera-byte.com/", |
||||
"file": "distfiles/timestamp.dev-local" |
||||
}, |
||||
"GentooPortage": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "rsync://rsync4.ca.gentoo.org/", |
||||
"upstream1": "rsync://rsync1.de.gentoo.org/", |
||||
"upstream2": "rsync://rsync8.de.gentoo.org/", |
||||
"file": "gentoo-portage/Manifest" |
||||
}, |
||||
"GNOME": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "gnome/", |
||||
"upstream1": "https://download.gnome.org/", |
||||
"upstream2": "https://mirrors.dotsrc.org/gnome/", |
||||
"upstream3": "https://muug.ca/mirror/gnome/", |
||||
"file1": "core/", |
||||
"file2": "cache.json" |
||||
}, |
||||
"GNU": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://mirrors.kernel.org/", |
||||
"file": "gnu/mirror-updated-timestamp.txt" |
||||
}, |
||||
"Gutenberg": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 172800, |
||||
"csc": "gutenberg/", |
||||
"upstream": "https://gutenberg.pglaf.org/", |
||||
"file": "gutenberg.dcs" |
||||
}, |
||||
"IPFire": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 172800 |
||||
}, |
||||
"KDE": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "kde/", |
||||
"upstream": "https://kde.c3sl.ufpr.br/", |
||||
"file": "ls-lR" |
||||
}, |
||||
"KDEApplicationData": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "kde-applicationdata/", |
||||
"upstream": "https://cdn.files.kde.org/", |
||||
"file": "last-updated" |
||||
}, |
||||
"Kernel": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "kernel.org/", |
||||
"upstream": "https://mirrors.edge.kernel.org/pub/", |
||||
"file": "linux/kernel/next/sha256sums.asc" |
||||
}, |
||||
"OpenBSD": { |
||||
"out_of_sync_since": null, |
||||
"out_of_sync_interval": 86400, |
||||
"csc": "", |
||||
"upstream": "https://ftp.openbsd.org/pub/", |
||||
"file": "OpenBSD/timestamp" |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains DebianCD class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class DebianCD(Distro): |
||||
"""DebianCD class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains DebianMultimedia class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class DebianMultimedia(Distro): |
||||
"""DebianMultimedia class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains DebianPorts class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class DebianPorts(Distro): |
||||
"""DebianPorts class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains DebianSecurity class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class DebianSecurity(Distro): |
||||
"""DebianSecurity class""" |
@ -0,0 +1,26 @@ |
||||
AlmaLinux |
||||
Alpine |
||||
Apache |
||||
Arch |
||||
CentOS |
||||
Ceph |
||||
CPAN |
||||
Cygwin |
||||
Debian |
||||
DebianCD |
||||
DebianMultimedia |
||||
DebianPorts |
||||
DebianSecurity |
||||
Eclipse |
||||
Fedora |
||||
FreeBSD |
||||
GentooDistfiles |
||||
GentooPortage |
||||
GNOME |
||||
GNU |
||||
Gutenberg |
||||
IPFire |
||||
KDE |
||||
KDEApplicationData |
||||
Kernel |
||||
OpenBSD |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains Fedora class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class Fedora(Distro): |
||||
"""Fedora class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains FreeBSD class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class FreeBSD(Distro): |
||||
"""FreeBSD class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains GentooDistfiles class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class GentooDistfiles(Distro): |
||||
"""GentooDistfiles class""" |
@ -0,0 +1,29 @@ |
||||
""" |
||||
Contains GentooPortage class |
||||
""" |
||||
|
||||
import os |
||||
from distro import Distro |
||||
|
||||
class GentooPortage(Distro): |
||||
"""GentooPortage class""" |
||||
@staticmethod |
||||
def check(data, distro): |
||||
rsync_command = "rsync -q {}{} {}" |
||||
os.system(rsync_command.format(data[distro]["csc"], |
||||
data[distro]["file"], |
||||
"csc_manifest")) |
||||
os.system(rsync_command.format(data[distro]["upstream1"], |
||||
data[distro]["file"], |
||||
"upstream_manifest1")) |
||||
os.system(rsync_command.format(data[distro]["upstream2"], |
||||
data[distro]["file"], |
||||
"upstream_manifest2")) |
||||
stream1 = os.popen("diff csc_manifest upstream_manifest1") |
||||
output1 = stream1.read() |
||||
stream2 = os.popen("diff csc_manifest upstream_manifest2") |
||||
output2 = stream2.read() |
||||
os.system("rm csc_manifest") |
||||
os.system("rm upstream_manifest1") |
||||
os.system("rm upstream_manifest2") |
||||
return 0 in [len(output1), len(output2)] |
@ -0,0 +1,40 @@ |
||||
""" |
||||
Contains GNOME class |
||||
""" |
||||
|
||||
import re |
||||
import requests |
||||
from distro import Distro |
||||
from shared import CSC_MIRROR |
||||
|
||||
class GNOME(Distro): |
||||
"""GNOME class""" |
||||
@staticmethod |
||||
def check(data, distro): |
||||
file = data[distro]["file1"] |
||||
csc_versions = requests.get(CSC_MIRROR + data[distro]["csc"] + file).text |
||||
upstream_versions = requests.get(data[distro]["upstream1"] + file).text |
||||
csc_latest = re.findall(r"\"\d+\.?\d*", csc_versions)[-1].lstrip('"') |
||||
upstream_latest = re.findall(r"\"\d+\.?\d*", upstream_versions)[-1].lstrip('"') |
||||
if csc_latest != upstream_latest: |
||||
return False |
||||
file += csc_latest + "/" |
||||
csc_versions = requests.get(CSC_MIRROR + data[distro]["csc"] + file).text |
||||
upstream_versions = requests.get(data[distro]["upstream1"] + file).text |
||||
csc_latest = re.findall(r"\"\d+\.?\w*\.?\w*", csc_versions)[-1].lstrip('"') |
||||
upstream_latest = re.findall(r"\"\d+\.?\w*\.?\w*", upstream_versions)[-1].lstrip('"') |
||||
if csc_latest != upstream_latest: |
||||
return False |
||||
file += csc_latest + "/" |
||||
csc_text = requests.get(CSC_MIRROR + data[distro]["csc"] + file |
||||
+ data[distro]["file2"]).text |
||||
try: |
||||
ret = csc_text == requests.get(data[distro]["upstream2"] + file |
||||
+ data[distro]["file2"]).text |
||||
except requests.exceptions.RequestException: |
||||
ret = False |
||||
try: |
||||
return ret or csc_text == requests.get(data[distro]["upstream3"] + file |
||||
+ data[distro]["file2"]).text |
||||
except requests.exceptions.RequestException: |
||||
return False |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains Gutenberg class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class Gutenberg(Distro): |
||||
"""Gutenberg class""" |
@ -0,0 +1,14 @@ |
||||
""" |
||||
Contains IPFire class |
||||
""" |
||||
|
||||
import requests |
||||
from distro import Distro |
||||
|
||||
class IPFire(Distro): |
||||
"""IPFire class""" |
||||
@staticmethod |
||||
def check(data, distro): |
||||
ipfire_url = "https://mirrors.ipfire.org/mirrors/mirror.csclub.uwaterloo.ca" |
||||
ipfire_text = requests.get(ipfire_url).text |
||||
return ipfire_text.find("The mirror is up") != -1 |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains KDE class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class KDE(Distro): |
||||
"""KDE class""" |
@ -0,0 +1,8 @@ |
||||
""" |
||||
Contains KDEApplicationData class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
|
||||
class KDEApplicationData(Distro): |
||||
"""KDEApplicationData class""" |
Loading…
Reference in new issue