|
|
|
@ -20,6 +20,8 @@ import json # import json to read distro info stored in json file |
|
|
|
|
|
|
|
|
|
import datefinder # another date finding library |
|
|
|
|
|
|
|
|
|
CSC_MIRROR = "http://mirror.csclub.uwaterloo.ca/" |
|
|
|
|
|
|
|
|
|
def checker(directory_URL, file_name): |
|
|
|
|
page = requests.get(directory_URL).text |
|
|
|
|
indexOfFile = page.find(file_name) |
|
|
|
@ -53,8 +55,7 @@ def ipfire_checker(): |
|
|
|
|
|
|
|
|
|
def general_checker(data_json, distro_name): |
|
|
|
|
"""General distro checker""" |
|
|
|
|
csc_url = "http://mirror.csclub.uwaterloo.ca/" + data_json[distro_name]["csc"] \ |
|
|
|
|
+ data_json[distro_name]["file"] |
|
|
|
|
csc_url = CSC_MIRROR + data_json[distro_name]["csc"] + data_json[distro_name]["file"] |
|
|
|
|
upstream_url = data_json[distro_name]["upstream"] + data_json[distro_name]["file"] |
|
|
|
|
return requests.get(csc_url).text == requests.get(upstream_url).text |
|
|
|
|
|
|
|
|
@ -78,6 +79,17 @@ if __name__ == "__main__": |
|
|
|
|
current_time = int(time.time()) |
|
|
|
|
for distro in data: |
|
|
|
|
try: |
|
|
|
|
if distro == "CPAN": |
|
|
|
|
res_json = requests.get("http://mirrors.cpan.org/cpan-json.txt").json() |
|
|
|
|
for mirror in res_json: |
|
|
|
|
if mirror["url"] == f"{CSC_MIRROR}CPAN/": |
|
|
|
|
if current_time - int(mirror["age"]) \ |
|
|
|
|
> data[distro]["out_of_date_interval"]: |
|
|
|
|
print(f"Failure: {distro} out-of-sync") |
|
|
|
|
else: |
|
|
|
|
print(f"Success: {distro} up-to-date") |
|
|
|
|
break |
|
|
|
|
continue |
|
|
|
|
if distro == "IPFire": |
|
|
|
|
checker_result = ipfire_checker() |
|
|
|
|
else: |
|
|
|
|