Update for check repos

This commit is contained in:
Dimitris Zlatanidis 2024-03-16 16:47:24 +02:00
parent 7ca08f18e3
commit 50c99c469a

View file

@ -38,51 +38,24 @@ class CheckUpdates(Configs):
def check_the_repositories(self) -> dict:
if self.option_for_repository:
self.check_updates_for_repository()
self.repositories(self.repository)
else:
self.check_updates_for_repositories()
return self.compare
def check_updates_for_repository(self) -> None:
sbo_repository: dict = {
self.repos.sbo_repo_name: self.sbo_repository,
self.repos.ponce_repo_name: self.ponce_repository
}
if self.repository not in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]:
self.binary_repository(self.repository)
else:
sbo_repository[self.repository]()
def check_updates_for_repositories(self) -> None:
if self.repos.sbo_repo:
self.sbo_repository()
if self.repos.ponce_repo:
self.ponce_repository()
for repo in list(self.repos.repositories.keys())[2:]:
for repo in list(self.repos.repositories.keys()):
if self.repos.repositories[repo]['enable']:
self.binary_repository(repo)
self.repositories(repo)
def binary_repository(self, repo: str) -> None:
def repositories(self, repo: str) -> None:
local_chg_txt: Path = Path(self.repos.repositories[repo]['path'],
self.repos.repositories[repo]['changelog_txt'])
repo_chg_txt: str = (f"{self.repos.repositories[repo]['mirror'][0]}"
f"{self.repos.repositories[repo]['changelog_txt']}")
self.compare[repo] = self.compare_the_changelogs(local_chg_txt, repo_chg_txt)
def sbo_repository(self) -> None:
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_the_changelogs(local_chg_txt, repo_chg_txt)
def ponce_repository(self) -> None:
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_the_changelogs(local_chg_txt, repo_chg_txt)
def compare_the_changelogs(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
local_size: int = 0
repo_size: int = 0