forked from public/mirror-checker
parent
fe7d22e1e5
commit
68e13c327e
@ -1,3 +0,0 @@ |
||||
they use this for DBs in the code: |
||||
|
||||
Psycopg is a PostgreSQL adapter for the Python programming language. This tool allows us to connect the capabilities of the Python language and libraries to obtain, manipulate, input, and update data stored in a PostgreSQL database. |
@ -1,10 +0,0 @@ |
||||
[ |
||||
["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"], |
||||
["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"] |
||||
] |
@ -1,20 +0,0 @@ |
||||
[ |
||||
[ |
||||
"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" |
||||
] |
||||
] |
@ -1,8 +1,39 @@ |
||||
""" |
||||
Contains ubuntu_ports class |
||||
""" |
||||
|
||||
from bs4 import BeautifulSoup |
||||
import requests |
||||
from project import Project |
||||
from shared import CSC_MIRROR |
||||
|
||||
class ubuntu_ports(Project): |
||||
"""ubuntu_ports class""" |
||||
"""ubuntu_ports class""" |
||||
|
||||
@staticmethod |
||||
def scrape(site1, site2): |
||||
# getting the request from url |
||||
r1 = requests.get(site1) |
||||
r2 = requests.get(site2) |
||||
|
||||
# converting the text |
||||
s1 = BeautifulSoup(r1.text,"html.parser") |
||||
s2 = BeautifulSoup(r2.text,"html.parser") |
||||
|
||||
hrefs1 = [i.attrs['href'] for i in s1.find_all("a")] |
||||
hrefs2 = [i.attrs['href'] for i in s2.find_all("a")] |
||||
|
||||
for href in hrefs1: # for a href directories |
||||
if href.endswith("/") and href != "../" and href != "/" and not href.startswith("/"): |
||||
print(href) |
||||
if href not in hrefs2: |
||||
return False |
||||
elif requests.get(site1+href+"Release").text != requests.get(site2+href+"Release").text: |
||||
return False |
||||
return True |
||||
|
||||
@classmethod |
||||
def check(cls, data, project): |
||||
"""Check if project packages are up-to-date""" |
||||
|
||||
csc_url = CSC_MIRROR + data[project]["csc"] + data[project]["file"] |
||||
upstream_url = data[project]["upstream"] + data[project]["file"] |
||||
|
||||
# calling function |
||||
return cls.scrape(upstream_url, csc_url) |
Loading…
Reference in new issue