added tdf, ubuntu, vlc

This commit is contained in:
Tom 2021-10-03 15:26:43 -07:00
parent 89c8b81ec6
commit 6f9a9a0952
6 changed files with 96 additions and 24 deletions

View File

@ -27,11 +27,14 @@ mxlinux: https://sourceforge.net/projects/mx-linux/ (scrap the last day?)
linuxmint-packages pool: http://rsync-packages.linuxmint.com/pool/
scientific: https://scientificlinux.org/downloads/sl-mirrors/ (CSC not listed)
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-releases: https://cdimage.ubuntu.com/releases/
ubuntu-releases: https://releases.ubuntu.com/
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/
x.org: https://www.x.org/releases/
trisquel: https://trisquel.info/mirmon/index.html out of date website

View File

@ -1,6 +1,6 @@
{
"AlmaLinux": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "",
"upstream": "https://repo.almalinux.org/",
@ -14,28 +14,28 @@
"file": "alpine/last-updated"
},
"Apache": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"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_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "archlinux/",
"upstream": "http://arch.mirror.constant.com/",
"file": "lastupdate"
},
"CentOS": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "",
"upstream": "https://mirrors.edge.kernel.org/",
"file": "centos/TIME"
},
"Ceph": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "ceph/",
"upstream": "https://download.ceph.com/",
@ -52,7 +52,7 @@
"file": "x86/sha512.sum"
},
"Debian": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "",
"upstream": "https://ftp-master.debian.org/",
@ -73,7 +73,7 @@
"file": "project/trace/deb-multimedia.org"
},
"DebianPorts": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "",
"upstream": "https://deb.debian.org/",
@ -87,28 +87,28 @@
"file": "debian-security/project/trace/master"
},
"Eclipse": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 172800,
"csc": "eclipse/",
"upstream": "http://download.eclipse.org/",
"file": "TIME"
},
"Fedora": {
"out_of_sync_since": null,
"out_of_sync_since": 1633298732,
"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_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "",
"upstream": "http://ftp4.freebsd.org/pub/",
"file": "FreeBSD/TIMESTAMP"
},
"GentooDistfiles": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "gentoo-distfiles",
"upstream": "http://gentoo.mirrors.tera-byte.com/",
@ -133,14 +133,14 @@
"file2": "cache.json"
},
"GNU": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"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_since": 1633294718,
"out_of_sync_interval": 172800,
"csc": "gutenberg/",
"upstream": "https://gutenberg.pglaf.org/",
@ -158,7 +158,7 @@
"file": "ls-lR"
},
"KDEApplicationData": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "kde-applicationdata/",
"upstream": "https://cdn.files.kde.org/",
@ -172,10 +172,31 @@
"file": "linux/kernel/next/sha256sums.asc"
},
"OpenBSD": {
"out_of_sync_since": null,
"out_of_sync_since": 1633294718,
"out_of_sync_interval": 86400,
"csc": "",
"upstream": "https://ftp.openbsd.org/pub/",
"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
View File

@ -33,6 +33,9 @@ from kde import KDE
from kdeapplicationdata import KDEApplicationData
from kernel import Kernel
from openbsd import OpenBSD
from tdf import tdf
from ubuntu import ubuntu
from vlc import vlc
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
# 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")
continue
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)
if checker_result:
print(f"Success: {distro} up-to-date")
@ -99,11 +102,11 @@ if __name__ == "__main__":
continue
checker_result = distro_class.check(data, distro)
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:
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"] \
> 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")
continue
print(f"Success: {distro} up-to-date")

8
tdf.py Normal file
View File

@ -0,0 +1,8 @@
"""
Contains tdf class
"""
from distro import Distro
class tdf(Distro):
"""tdf class"""

29
ubuntu.py Normal file
View File

@ -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

8
vlc.py Normal file
View File

@ -0,0 +1,8 @@
"""
Contains vlc class
"""
from distro import Distro
class vlc(Distro):
"""vlc class"""