Updated for arguments

This commit is contained in:
Dimitris Zlatanidis 2023-04-23 18:14:26 +03:00
parent f4d5c63b33
commit d46721b43e

View file

@ -77,100 +77,99 @@ class CheckUpdates(Configs):
return self.compare
def slack_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.slack_repo_mirror[0]}{self.repos.slack_repo_changelog}'
self.compare[self.repos.slack_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.slack_repo_path, self.repos.slack_repo_changelog)
repo_chg_txt: str = f'{self.repos.slack_repo_mirror[0]}{self.repos.slack_repo_changelog}'
self.compare[self.repos.slack_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def slack_extra_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.slack_extra_repo_mirror[0]}{self.repos.slack_extra_repo_changelog}'
self.compare[self.repos.slack_extra_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.slack_extra_repo_path, self.repos.slack_extra_repo_changelog)
repo_chg_txt: str = f'{self.repos.slack_extra_repo_mirror[0]}{self.repos.slack_extra_repo_changelog}'
self.compare[self.repos.slack_extra_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def slack_patches_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.slack_patches_repo_mirror[0]}{self.repos.slack_patches_repo_changelog}'
self.compare[self.repos.slack_patches_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.slack_patches_repo_path, self.repos.slack_patches_repo_changelog)
repo_chg_txt: str = f'{self.repos.slack_patches_repo_mirror[0]}{self.repos.slack_patches_repo_changelog}'
self.compare[self.repos.slack_patches_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def alien_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.alien_repo_mirror[0]}{self.repos.alien_repo_changelog}'
self.compare[self.repos.alien_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.alien_repo_path, self.repos.alien_repo_changelog)
repo_chg_txt: str = f'{self.repos.alien_repo_mirror[0]}{self.repos.alien_repo_changelog}'
self.compare[self.repos.alien_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def multilib_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.multilib_repo_mirror[0]}{self.repos.multilib_repo_changelog}'
self.compare[self.repos.multilib_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.multilib_repo_path, self.repos.multilib_repo_changelog)
repo_chg_txt: str = f'{self.repos.multilib_repo_mirror[0]}{self.repos.multilib_repo_changelog}'
self.compare[self.repos.multilib_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def restricted_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.restricted_repo_mirror[0]}{self.repos.restricted_repo_changelog}'
self.compare[self.repos.restricted_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.restricted_repo_path, self.repos.restricted_repo_changelog)
repo_chg_txt: str = f'{self.repos.restricted_repo_mirror[0]}{self.repos.restricted_repo_changelog}'
self.compare[self.repos.restricted_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def gnome_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.gnome_repo_mirror[0]}{self.repos.gnome_repo_changelog}'
self.compare[self.repos.gnome_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_changelog)
repo_chg_txt: str = f'{self.repos.gnome_repo_mirror[0]}{self.repos.gnome_repo_changelog}'
self.compare[self.repos.gnome_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def msb_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.msb_repo_mirror[0]}{self.repos.msb_repo_changelog}'
self.compare[self.repos.msb_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.msb_repo_path, self.repos.msb_repo_changelog)
repo_chg_txt: str = f'{self.repos.msb_repo_mirror[0]}{self.repos.msb_repo_changelog}'
self.compare[self.repos.msb_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def csb_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.csb_repo_mirror[0]}{self.repos.csb_repo_changelog}'
self.compare[self.repos.csb_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.csb_repo_path, self.repos.csb_repo_changelog)
repo_chg_txt: str = f'{self.repos.csb_repo_mirror[0]}{self.repos.csb_repo_changelog}'
self.compare[self.repos.csb_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def conraid_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.conraid_repo_mirror[0]}{self.repos.conraid_repo_changelog}'
self.compare[self.repos.conraid_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.conraid_repo_path, self.repos.conraid_repo_changelog)
repo_chg_txt: str = f'{self.repos.conraid_repo_mirror[0]}{self.repos.conraid_repo_changelog}'
self.compare[self.repos.conraid_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def slackonly_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_changelog}'
self.compare[self.repos.slackonly_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.slackonly_repo_path, self.repos.slackonly_repo_changelog)
repo_chg_txt: str = f'{self.repos.slackonly_repo_mirror[0]}{self.repos.slackonly_repo_changelog}'
self.compare[self.repos.slackonly_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def salixos_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.salixos_repo_mirror[0]}{self.repos.salixos_repo_changelog}'
self.compare[self.repos.salixos_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.salixos_repo_path, self.repos.salixos_repo_changelog)
repo_chg_txt: str = f'{self.repos.salixos_repo_mirror[0]}{self.repos.salixos_repo_changelog}'
self.compare[self.repos.salixos_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def salixos_extra_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.salixos_extra_repo_path, self.repos.salixos_extra_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.salixos_extra_repo_mirror[0]}{self.repos.salixos_extra_repo_changelog}'
self.compare[self.repos.salixos_extra_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.salixos_extra_repo_path, self.repos.salixos_extra_repo_changelog)
repo_chg_txt: str = f'{self.repos.salixos_extra_repo_mirror[0]}{self.repos.salixos_extra_repo_changelog}'
self.compare[self.repos.salixos_extra_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def salixos_patches_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.salixos_patches_repo_path, self.repos.salixos_patches_repo_changelog)
self.repo_chg_txt: str = (f'{self.repos.salixos_patches_repo_mirror[0]}'
f'{self.repos.salixos_patches_repo_changelog}')
self.compare[self.repos.salixos_patches_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.salixos_patches_repo_path, self.repos.salixos_patches_repo_changelog)
repo_chg_txt: str = f'{self.repos.salixos_patches_repo_mirror[0]}{self.repos.salixos_patches_repo_changelog}'
self.compare[self.repos.salixos_patches_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def slackel_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.slackel_repo_mirror[0]}{self.repos.slackel_repo_changelog}'
self.compare[self.repos.slackel_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.slackel_repo_path, self.repos.slackel_repo_changelog)
repo_chg_txt: str = f'{self.repos.slackel_repo_mirror[0]}{self.repos.slackel_repo_changelog}'
self.compare[self.repos.slackel_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def slint_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.slint_repo_mirror[0]}{self.repos.slint_repo_changelog}'
self.compare[self.repos.slint_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.slint_repo_path, self.repos.slint_repo_changelog)
repo_chg_txt: str = f'{self.repos.slint_repo_mirror[0]}{self.repos.slint_repo_changelog}'
self.compare[self.repos.slint_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def sbo_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.sbo_repo_mirror[0]}{self.repos.sbo_repo_changelog}'
self.compare[self.repos.sbo_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
repo_chg_txt: str = f'{self.repos.sbo_repo_mirror[0]}{self.repos.sbo_repo_changelog}'
self.compare[self.repos.sbo_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def ponce_repository(self) -> None:
self.local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
self.repo_chg_txt: str = f'{self.repos.ponce_repo_mirror[0]}{self.repos.ponce_repo_changelog}'
self.compare[self.repos.ponce_repo_name] = self.compare_dates()
local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
repo_chg_txt: str = f'{self.repos.ponce_repo_mirror[0]}{self.repos.ponce_repo_changelog}'
self.compare[self.repos.ponce_repo_name] = self.compare_dates(local_chg_txt, repo_chg_txt)
def compare_dates(self) -> bool:
def compare_dates(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
local_size: int = 0
if self.repo_chg_txt.startswith('file'):
if repo_chg_txt.startswith('file'):
return False
try:
@ -189,16 +188,16 @@ class CheckUpdates(Configs):
http = SOCKSProxyManager(f'{self.proxy_address}', headers=proxy_default_headers)
repo = http.request('GET', self.repo_chg_txt)
repo = http.request('GET', repo_chg_txt)
except KeyboardInterrupt:
raise SystemExit(1)
if self.local_chg_txt.is_file():
local_size: int = int(os.stat(self.local_chg_txt).st_size)
if local_chg_txt.is_file():
local_size: int = int(os.stat(local_chg_txt).st_size)
repo_size: int = int(repo.headers['Content-Length'])
return repo_size != local_size
return local_size != repo_size
def view_message(self) -> None:
self.check()