Check whether our mirror packages are up to date.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.0 KiB

Contains Arch class
from datetime import datetime, timedelta
import requests
from distro import Distro
from shared import CSC_MIRROR
class Arch(Distro):
"""Arch class"""
def name():
"""Get name of Arch"""
return "Arch"
def check():
"""Check if Arch packages are up-to-date"""
arch_json = requests.get("").json()
last_check_str = arch_json["last_check"]
last_sync_str = [url for url in arch_json["urls"] if url["url"] == \
last_check_dt = datetime.strptime(last_check_str, "%Y-%m-%dT%H:%M:%S.%fZ")
last_sync_dt = datetime.strptime(last_sync_str, "%Y-%m-%dT%H:%M:%SZ")
# According to
# Due to the timing of mirror checks, any value under one hour should be viewed as ideal
return last_check_dt < last_sync_dt + timedelta(hours = 1)