Created GentooPortage mirror status checker

This commit is contained in:
Laura Nguyen 2021-09-03 14:28:37 -04:00
parent 78dc376e83
commit f448ceddc9
2 changed files with 33 additions and 1 deletions

View File

@ -114,6 +114,14 @@
"upstream": "http://gentoo.mirrors.tera-byte.com/", "upstream": "http://gentoo.mirrors.tera-byte.com/",
"file": "distfiles/timestamp.dev-local" "file": "distfiles/timestamp.dev-local"
}, },
"GentooPortage": {
"out_of_date_since": null,
"out_of_date_interval": 86400,
"csc": "rsync://rsync4.ca.gentoo.org/",
"upstream1": "rsync://rsync1.de.gentoo.org/",
"upstream2": "rsync://rsync8.de.gentoo.org/",
"file": "gentoo-portage/Manifest"
},
"GNOME": { "GNOME": {
"out_of_date_since": null, "out_of_date_since": null,
"out_of_date_interval": 86400, "out_of_date_interval": 86400,

26
main.py
View File

@ -5,6 +5,7 @@ This mirror status checker determines whether CSC mirror is up-to-date with upst
""" """
import time import time
import os
import requests import requests
from arch import Arch from arch import Arch
from ceph import Ceph from ceph import Ceph
@ -48,6 +49,27 @@ def checker(directory_URL, file_name):
else: else:
return('No dates found') return('No dates found')
def gentoo_portage_checker(data_json, distro_name):
"""GentooPortage checker"""
rsync_command = "rsync -q {}{} {}"
os.system(rsync_command.format(data_json[distro_name]["csc"],
data_json[distro_name]["file"],
"csc_manifest"))
os.system(rsync_command.format(data_json[distro_name]["upstream1"],
data_json[distro_name]["file"],
"upstream_manifest1"))
os.system(rsync_command.format(data_json[distro_name]["upstream2"],
data_json[distro_name]["file"],
"upstream_manifest2"))
stream1 = os.popen("diff csc_manifest upstream_manifest1")
output1 = stream1.read()
stream2 = os.popen("diff csc_manifest upstream_manifest2")
output2 = stream2.read()
os.system("rm csc_manifest")
os.system("rm upstream_manifest1")
os.system("rm upstream_manifest2")
return 0 in [len(output1), len(output2)]
def gnome_checker(data_json, distro_name): def gnome_checker(data_json, distro_name):
"""GNOME checker""" """GNOME checker"""
csc_url = CSC_MIRROR + data_json[distro_name]["file"] csc_url = CSC_MIRROR + data_json[distro_name]["file"]
@ -98,7 +120,9 @@ if __name__ == "__main__":
print(f"Success: {distro} up-to-date") print(f"Success: {distro} up-to-date")
break break
continue continue
if distro == "GNOME": if distro == "GentooPortage":
checker_result = gentoo_portage_checker(data, distro)
elif distro == "GNOME":
gnome_text = requests.get("https://download.gnome.org/core/").text gnome_text = requests.get("https://download.gnome.org/core/").text
line_count = len(gnome_text.split('\n')) line_count = len(gnome_text.split('\n'))
# Latest version is currently 41, which has line count of 49 # Latest version is currently 41, which has line count of 49