From 50c99c469a997fe95e0f32a4151752c9d8c0ee10 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 16 Mar 2024 16:47:24 +0200 Subject: [PATCH] Update for check repos --- slpkg/check_updates.py | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index e6769aa3..65b78371 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -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