Created GNU mirror status checker

dev
Laura Nguyen 1 year ago
parent bae3d74f00
commit 4b3f85374e
  1. 21
      gnu.py
  2. 3
      main.py

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

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

Loading…
Cancel
Save