Created GNU mirror status checker

This commit is contained in:
Laura Nguyen 2021-08-24 17:34:39 -04:00
parent bae3d74f00
commit 4b3f85374e
2 changed files with 23 additions and 1 deletions

21
gnu.py Normal file
View File

@ -0,0 +1,21 @@
"""
Contains GNU class
"""
from distro import Distro
from shared import CSC_MIRROR, get_sec
class GNU(Distro):
"""GNU class"""
@staticmethod
def name():
"""Get name of GNU"""
return "GNU"
@staticmethod
def check():
"""Check if GNU packages are up-to-date"""
official_sec = get_sec("https://mirrors.kernel.org/gnu/mirror-updated-timestamp.txt")
csc_sec = get_sec(f"{CSC_MIRROR}gnu/mirror-updated-timestamp.txt")
# Out-of-sync by 1 day maximum
return official_sec < csc_sec + 86400

View File

@ -8,11 +8,12 @@ import requests
from arch import Arch
from debian import Debian
from eclipse import Eclipse
from gnu import GNU
from kernel import Kernel
from openbsd import OpenBSD
if __name__ == "__main__":
for distro in [Arch, Debian, Eclipse, Kernel, OpenBSD]:
for distro in [Arch, Debian, Eclipse, GNU, Kernel, OpenBSD]:
try:
distro.print_output(distro.check())
except requests.exceptions.RequestException as err: