forked from public/mirror-checker
added tdf, ubuntu, vlc
This commit is contained in:
parent
89c8b81ec6
commit
6f9a9a0952
11
README.md
11
README.md
|
@ -27,11 +27,14 @@ mxlinux: https://sourceforge.net/projects/mx-linux/ (scrap the last day?)
|
||||||
linuxmint-packages pool: http://rsync-packages.linuxmint.com/pool/
|
linuxmint-packages pool: http://rsync-packages.linuxmint.com/pool/
|
||||||
scientific: https://scientificlinux.org/downloads/sl-mirrors/ (CSC not listed)
|
scientific: https://scientificlinux.org/downloads/sl-mirrors/ (CSC not listed)
|
||||||
slackware: https://mirrors.slackware.com/mirrorlist/ https://mirrors.slackware.com/slackware/
|
slackware: https://mirrors.slackware.com/mirrorlist/ https://mirrors.slackware.com/slackware/
|
||||||
tdf: https://download.documentfoundation.org/
|
|
||||||
trisquel: https://trisquel.info/mirmon/index.html
|
|
||||||
ubuntu: https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-archive
|
|
||||||
ubuntu-ports: http://ports.ubuntu.com/ubuntu-ports/
|
ubuntu-ports: http://ports.ubuntu.com/ubuntu-ports/
|
||||||
ubuntu-ports-releases: https://cdimage.ubuntu.com/releases/
|
ubuntu-ports-releases: https://cdimage.ubuntu.com/releases/
|
||||||
ubuntu-releases: https://releases.ubuntu.com/
|
ubuntu-releases: https://releases.ubuntu.com/
|
||||||
vlc: http://download.videolan.org/pub/videolan/
|
|
||||||
x.org: https://www.x.org/releases/
|
x.org: https://www.x.org/releases/
|
||||||
|
|
||||||
|
done:
|
||||||
|
tdf: https://download.documentfoundation.org/
|
||||||
|
ubuntu: https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-archive
|
||||||
|
vlc: http://download.videolan.org/pub/videolan/
|
||||||
|
|
||||||
|
trisquel: https://trisquel.info/mirmon/index.html out of date website
|
51
data.json
51
data.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"AlmaLinux": {
|
"AlmaLinux": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://repo.almalinux.org/",
|
"upstream": "https://repo.almalinux.org/",
|
||||||
|
@ -14,28 +14,28 @@
|
||||||
"file": "alpine/last-updated"
|
"file": "alpine/last-updated"
|
||||||
},
|
},
|
||||||
"Apache": {
|
"Apache": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "apache/",
|
"csc": "apache/",
|
||||||
"upstream": "https://downloads.apache.org/",
|
"upstream": "https://downloads.apache.org/",
|
||||||
"file": "zzz/time.txt"
|
"file": "zzz/time.txt"
|
||||||
},
|
},
|
||||||
"Arch": {
|
"Arch": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "archlinux/",
|
"csc": "archlinux/",
|
||||||
"upstream": "http://arch.mirror.constant.com/",
|
"upstream": "http://arch.mirror.constant.com/",
|
||||||
"file": "lastupdate"
|
"file": "lastupdate"
|
||||||
},
|
},
|
||||||
"CentOS": {
|
"CentOS": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://mirrors.edge.kernel.org/",
|
"upstream": "https://mirrors.edge.kernel.org/",
|
||||||
"file": "centos/TIME"
|
"file": "centos/TIME"
|
||||||
},
|
},
|
||||||
"Ceph": {
|
"Ceph": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "ceph/",
|
"csc": "ceph/",
|
||||||
"upstream": "https://download.ceph.com/",
|
"upstream": "https://download.ceph.com/",
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
"file": "x86/sha512.sum"
|
"file": "x86/sha512.sum"
|
||||||
},
|
},
|
||||||
"Debian": {
|
"Debian": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://ftp-master.debian.org/",
|
"upstream": "https://ftp-master.debian.org/",
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
"file": "project/trace/deb-multimedia.org"
|
"file": "project/trace/deb-multimedia.org"
|
||||||
},
|
},
|
||||||
"DebianPorts": {
|
"DebianPorts": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://deb.debian.org/",
|
"upstream": "https://deb.debian.org/",
|
||||||
|
@ -87,28 +87,28 @@
|
||||||
"file": "debian-security/project/trace/master"
|
"file": "debian-security/project/trace/master"
|
||||||
},
|
},
|
||||||
"Eclipse": {
|
"Eclipse": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 172800,
|
"out_of_sync_interval": 172800,
|
||||||
"csc": "eclipse/",
|
"csc": "eclipse/",
|
||||||
"upstream": "http://download.eclipse.org/",
|
"upstream": "http://download.eclipse.org/",
|
||||||
"file": "TIME"
|
"file": "TIME"
|
||||||
},
|
},
|
||||||
"Fedora": {
|
"Fedora": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633298732,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "fedora/",
|
"csc": "fedora/",
|
||||||
"upstream": "http://fedora.mirror.iweb.com/",
|
"upstream": "http://fedora.mirror.iweb.com/",
|
||||||
"file": "linux/development/rawhide/COMPOSE_ID"
|
"file": "linux/development/rawhide/COMPOSE_ID"
|
||||||
},
|
},
|
||||||
"FreeBSD": {
|
"FreeBSD": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "http://ftp4.freebsd.org/pub/",
|
"upstream": "http://ftp4.freebsd.org/pub/",
|
||||||
"file": "FreeBSD/TIMESTAMP"
|
"file": "FreeBSD/TIMESTAMP"
|
||||||
},
|
},
|
||||||
"GentooDistfiles": {
|
"GentooDistfiles": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "gentoo-distfiles",
|
"csc": "gentoo-distfiles",
|
||||||
"upstream": "http://gentoo.mirrors.tera-byte.com/",
|
"upstream": "http://gentoo.mirrors.tera-byte.com/",
|
||||||
|
@ -133,14 +133,14 @@
|
||||||
"file2": "cache.json"
|
"file2": "cache.json"
|
||||||
},
|
},
|
||||||
"GNU": {
|
"GNU": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://mirrors.kernel.org/",
|
"upstream": "https://mirrors.kernel.org/",
|
||||||
"file": "gnu/mirror-updated-timestamp.txt"
|
"file": "gnu/mirror-updated-timestamp.txt"
|
||||||
},
|
},
|
||||||
"Gutenberg": {
|
"Gutenberg": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 172800,
|
"out_of_sync_interval": 172800,
|
||||||
"csc": "gutenberg/",
|
"csc": "gutenberg/",
|
||||||
"upstream": "https://gutenberg.pglaf.org/",
|
"upstream": "https://gutenberg.pglaf.org/",
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
"file": "ls-lR"
|
"file": "ls-lR"
|
||||||
},
|
},
|
||||||
"KDEApplicationData": {
|
"KDEApplicationData": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "kde-applicationdata/",
|
"csc": "kde-applicationdata/",
|
||||||
"upstream": "https://cdn.files.kde.org/",
|
"upstream": "https://cdn.files.kde.org/",
|
||||||
|
@ -172,10 +172,31 @@
|
||||||
"file": "linux/kernel/next/sha256sums.asc"
|
"file": "linux/kernel/next/sha256sums.asc"
|
||||||
},
|
},
|
||||||
"OpenBSD": {
|
"OpenBSD": {
|
||||||
"out_of_sync_since": null,
|
"out_of_sync_since": 1633294718,
|
||||||
"out_of_sync_interval": 86400,
|
"out_of_sync_interval": 86400,
|
||||||
"csc": "",
|
"csc": "",
|
||||||
"upstream": "https://ftp.openbsd.org/pub/",
|
"upstream": "https://ftp.openbsd.org/pub/",
|
||||||
"file": "OpenBSD/timestamp"
|
"file": "OpenBSD/timestamp"
|
||||||
|
},
|
||||||
|
"tdf": {
|
||||||
|
"out_of_sync_since": 1633294718,
|
||||||
|
"out_of_sync_interval": 86400,
|
||||||
|
"csc": "",
|
||||||
|
"upstream": "https://download.documentfoundation.org/TIMESTAMP",
|
||||||
|
"file": "tdf/TIMESTAMP"
|
||||||
|
},
|
||||||
|
"ubuntu": {
|
||||||
|
"out_of_sync_since": null,
|
||||||
|
"out_of_sync_interval": 86400,
|
||||||
|
"csc": "",
|
||||||
|
"upstream": "https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-archive",
|
||||||
|
"file": ""
|
||||||
|
},
|
||||||
|
"vlc": {
|
||||||
|
"out_of_sync_since": 1633298732,
|
||||||
|
"out_of_sync_interval": 86400,
|
||||||
|
"csc": "vlc/",
|
||||||
|
"upstream": "http://download.videolan.org/pub/videolan/",
|
||||||
|
"file": "trace"
|
||||||
}
|
}
|
||||||
}
|
}
|
11
main.py
11
main.py
|
@ -33,6 +33,9 @@ from kde import KDE
|
||||||
from kdeapplicationdata import KDEApplicationData
|
from kdeapplicationdata import KDEApplicationData
|
||||||
from kernel import Kernel
|
from kernel import Kernel
|
||||||
from openbsd import OpenBSD
|
from openbsd import OpenBSD
|
||||||
|
from tdf import tdf
|
||||||
|
from ubuntu import ubuntu
|
||||||
|
from vlc import vlc
|
||||||
from shared import CSC_MIRROR
|
from shared import CSC_MIRROR
|
||||||
from dateparser.search import search_dates # this library seems to be super slow but the other library: dateutil.parser gets some errors
|
from dateparser.search import search_dates # this library seems to be super slow but the other library: dateutil.parser gets some errors
|
||||||
# http://theautomatic.net/2018/12/18/2-packages-for-extracting-dates-from-a-string-of-text-in-python/
|
# http://theautomatic.net/2018/12/18/2-packages-for-extracting-dates-from-a-string-of-text-in-python/
|
||||||
|
@ -90,7 +93,7 @@ if __name__ == "__main__":
|
||||||
print(f"Failure: {distro} does not exist")
|
print(f"Failure: {distro} does not exist")
|
||||||
continue
|
continue
|
||||||
distro_class = getattr(sys.modules[__name__], distro)
|
distro_class = getattr(sys.modules[__name__], distro)
|
||||||
if distro == "CPAN":
|
if distro == "CPAN" or distro == "ubuntu":
|
||||||
checker_result = distro_class.check(data, distro, current_time)
|
checker_result = distro_class.check(data, distro, current_time)
|
||||||
if checker_result:
|
if checker_result:
|
||||||
print(f"Success: {distro} up-to-date")
|
print(f"Success: {distro} up-to-date")
|
||||||
|
@ -99,11 +102,11 @@ if __name__ == "__main__":
|
||||||
continue
|
continue
|
||||||
checker_result = distro_class.check(data, distro)
|
checker_result = distro_class.check(data, distro)
|
||||||
if checker_result:
|
if checker_result:
|
||||||
data[distro]["out_of_sync_since"] = None
|
data[distro]["out_of_sync_since"] = None # out of sync since is just the last time we checked and returned true
|
||||||
elif data[distro]["out_of_sync_since"] is None:
|
elif data[distro]["out_of_sync_since"] is None:
|
||||||
data[distro]["out_of_sync_since"] = current_time
|
data[distro]["out_of_sync_since"] = current_time # starts counting out of date
|
||||||
elif current_time - data[distro]["out_of_sync_since"] \
|
elif current_time - data[distro]["out_of_sync_since"] \
|
||||||
> data[distro]["out_of_sync_interval"]:
|
> data[distro]["out_of_sync_interval"]: # last time checked out of date, now still out of date, raise alert when it reaches this threshold
|
||||||
print(f"Failure: {distro} out-of-sync")
|
print(f"Failure: {distro} out-of-sync")
|
||||||
continue
|
continue
|
||||||
print(f"Success: {distro} up-to-date")
|
print(f"Success: {distro} up-to-date")
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
"""
|
||||||
|
Contains tdf class
|
||||||
|
"""
|
||||||
|
|
||||||
|
from distro import Distro
|
||||||
|
|
||||||
|
class tdf(Distro):
|
||||||
|
"""tdf class"""
|
|
@ -0,0 +1,29 @@
|
||||||
|
"""
|
||||||
|
Contains Trisquel class
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from distro import Distro
|
||||||
|
from shared import CSC_MIRROR
|
||||||
|
import requests
|
||||||
|
import datefinder # another date finding library
|
||||||
|
|
||||||
|
class ubuntu(Distro):
|
||||||
|
"""ubuntu class"""
|
||||||
|
@staticmethod
|
||||||
|
def check(data, distro, current_time):
|
||||||
|
page = requests.get(data[distro]["upstream"]).text
|
||||||
|
indexOfFile = page.find("last verified on")
|
||||||
|
# segment_clean = re.sub(r'\s\d+\s', ' ', page[indexOfFile:]) # removes numbers for size
|
||||||
|
# segment_clean = re.sub(r'\s\d+\w*\s', ' ', page[indexOfFile:]) # removes numbers + size unit. e.x. 50kb
|
||||||
|
|
||||||
|
matches = list(datefinder.find_dates(page[indexOfFile:]))
|
||||||
|
# print(matches)
|
||||||
|
|
||||||
|
if len(matches) > 0:
|
||||||
|
date = matches[0] # date is of type datetime.datetime
|
||||||
|
return(current_time - date.strftime("%Y/%m/%d, %H:%M:%S"))
|
||||||
|
else:
|
||||||
|
return(False)
|
||||||
|
|
||||||
|
# https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-archive
|
Loading…
Reference in New Issue