Created GentooPortage mirror status checker
This commit is contained in:
parent
78dc376e83
commit
f448ceddc9
|
@ -114,6 +114,14 @@
|
|||
"upstream": "http://gentoo.mirrors.tera-byte.com/",
|
||||
"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": {
|
||||
"out_of_date_since": null,
|
||||
"out_of_date_interval": 86400,
|
||||
|
|
26
main.py
26
main.py
|
@ -5,6 +5,7 @@ This mirror status checker determines whether CSC mirror is up-to-date with upst
|
|||
"""
|
||||
|
||||
import time
|
||||
import os
|
||||
import requests
|
||||
from arch import Arch
|
||||
from ceph import Ceph
|
||||
|
@ -48,6 +49,27 @@ def checker(directory_URL, file_name):
|
|||
else:
|
||||
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):
|
||||
"""GNOME checker"""
|
||||
csc_url = CSC_MIRROR + data_json[distro_name]["file"]
|
||||
|
@ -98,7 +120,9 @@ if __name__ == "__main__":
|
|||
print(f"Success: {distro} up-to-date")
|
||||
break
|
||||
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
|
||||
line_count = len(gnome_text.split('\n'))
|
||||
# Latest version is currently 41, which has line count of 49
|
||||
|
|
Loading…
Reference in New Issue