added some distros

dev
Tom 1 year ago
parent 8c305397b9
commit debbbde293
  1. 7
      distros.json
  2. 17
      main.py

@ -1,5 +1,10 @@
[
["OpenBSD", "https://mirror.csclub.uwaterloo.ca/OpenBSD/", "https://ftp.openbsd.org/pub/OpenBSD/", "timestamp"],
["kernel", "http://mirror.csclub.uwaterloo.ca/kernel.org/linux/kernel/next/", "https://mirrors.edge.kernel.org/pub/linux/kernel/next/", "sha256sums.asc"],
["debian", "http://mirror.csclub.uwaterloo.ca/debian/project/trace/", "https://ftp-master.debian.org/debian/project/trace/", "master"]
["debian", "http://mirror.csclub.uwaterloo.ca/debian/project/trace/", "https://ftp-master.debian.org/debian/project/trace/", "master"],
["GNU", "http://mirror.csclub.uwaterloo.ca/gnu/", "https://mirrors.kernel.org/gnu/", "mirror-updated-timestamp.txt"],
["almalinux", "https://mirror.csclub.uwaterloo.ca/almalinux/", "https://repo.almalinux.org/almalinux/", "TIME"],
["alpine", "https://mirror.csclub.uwaterloo.ca/alpine/", "https://dl-cdn.alpinelinux.org/alpine/", "last-updated"],
["Apache", "https://mirror.csclub.uwaterloo.ca/apache/zzz/", "https://downloads.apache.org/zzz/", "time.txt"],
["CentOS", "https://mirror.csclub.uwaterloo.ca/centos/", "https://vault.centos.org/", "timestamp.txt"]
]

@ -19,6 +19,7 @@ import json # import json to read distro info stored in json file
import datefinder # another date finding library
# checker: gets the timestamp of the file inside the directory at the specified URL and returns it as a string
def checker(directory_URL, file_name):
page = requests.get(directory_URL).text
indexOfFile = page.find(file_name)
@ -52,10 +53,20 @@ if __name__ == "__main__":
except requests.exceptions.RequestException as err:
print(f"Error: {distro.name()}\n{err}")"""
# the implementation to check timestamps in distro mirror directory:
distros = json.load(open('distros.json',))
print(distros)
# print(distros)
for distro in distros:
print(distro[0] + ":")
print("CSC mirror: " + checker(distro[1], distro[3]))
print("Official distro: " + checker(distro[2], distro[3]))
print("Official distro: " + checker(distro[2], distro[3]))
# for eclipse, i couldn't find a directory from the official website, so i decided to temporarily cheat a little bit and peek at another person's mirror for explipse
# i just realized that my method doesn't just work for scraping html directories but everything returned by a URL (websites, files storing a time)
# i think i'll put checking arch, ceph, ecplipse on hold because it's more proper to check them using as.Date(17383, origin="1970-01-01") where the date is stored in
# a file as a number, but this would require another function and me looping through different functions. i think i'll do this later
# corresponding jsons: ["Eclipse", "https://mirror.csclub.uwaterloo.ca/eclipse/", "http://eclipse.mirror.rafal.ca/", "TIME"],
# ["Ceph", "https://mirror.csclub.uwaterloo.ca/ceph/", "https://download.ceph.com/", "timestamp"],
# i don't know what to do with damnsmalllinux, it seems like an abandoned project. useful link: http://distro.ibiblio.org/damnsmall/
# the other function is probably probing mirror status sites like this: http://mirrors.cpan.org/
# maybe i can make a column in json that specifies the method for checking the particular mirror and that identifier will find a specific function to check the update
Loading…
Cancel
Save