mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-29 10:26:12 +01:00
Updated for check updates
This commit is contained in:
parent
70917b6a9d
commit
f0b87f9f2d
2 changed files with 14 additions and 14 deletions
|
@ -38,9 +38,8 @@ class CheckUpdates(Configs):
|
|||
encoding=LoggingConfig.encoding,
|
||||
level=LoggingConfig.level)
|
||||
|
||||
def check(self) -> dict:
|
||||
def check_the_repositories(self) -> dict:
|
||||
if self.option_for_repository:
|
||||
|
||||
sbo_repository: dict = {
|
||||
self.repos.sbo_repo_name: self.sbo_repository,
|
||||
self.repos.ponce_repo_name: self.ponce_repository
|
||||
|
@ -59,28 +58,27 @@ class CheckUpdates(Configs):
|
|||
self.ponce_repository()
|
||||
|
||||
for repo in list(self.repos.repositories.keys())[2:]:
|
||||
|
||||
if self.repos.repositories[repo][0]:
|
||||
self.binary_repository(repo)
|
||||
|
||||
return self.compare
|
||||
|
||||
def binary_repository(self, repo) -> None:
|
||||
def binary_repository(self, repo: str) -> None:
|
||||
local_chg_txt: Path = Path(self.repos.repositories[repo][1], self.repos.repositories[repo][5])
|
||||
repo_chg_txt: str = f'{self.repos.repositories[repo][2][0]}{self.repos.repositories[repo][5]}'
|
||||
self.compare[repo] = self.compare_dates(local_chg_txt, repo_chg_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_dates(local_chg_txt, repo_chg_txt)
|
||||
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_dates(local_chg_txt, repo_chg_txt)
|
||||
self.compare[self.repos.ponce_repo_name] = self.compare_the_changelogs(local_chg_txt, repo_chg_txt)
|
||||
|
||||
def compare_dates(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
|
||||
def compare_the_changelogs(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
|
||||
local_size: int = 0
|
||||
|
||||
try:
|
||||
|
@ -97,7 +95,7 @@ class CheckUpdates(Configs):
|
|||
except (ModuleNotFoundError, ImportError):
|
||||
logger = logging.getLogger(LoggingConfig.date)
|
||||
logger.exception(f'{self.__class__.__name__}: '
|
||||
f'{self.__class__.compare_dates.__name__}')
|
||||
f'{self.__class__.compare_the_changelogs.__name__}')
|
||||
raise SystemExit()
|
||||
|
||||
http = SOCKSProxyManager(f'{self.proxy_address}', headers=proxy_default_headers)
|
||||
|
@ -113,16 +111,18 @@ class CheckUpdates(Configs):
|
|||
|
||||
logger = logging.getLogger(LoggingConfig.date)
|
||||
logger.info(f'{self.__class__.__name__}: '
|
||||
f'{self.__class__.compare_dates.__name__}: '
|
||||
f'{self.__class__.compare_the_changelogs.__name__}: '
|
||||
f'{local_chg_txt=}, {local_size=}, '
|
||||
f'{repo_chg_txt=}, {repo_size=}, '
|
||||
f'{local_size != repo_size}')
|
||||
|
||||
return local_size != repo_size
|
||||
|
||||
def view_message(self) -> None:
|
||||
self.check()
|
||||
def check_for_updates(self) -> None:
|
||||
self.check_the_repositories()
|
||||
self.print_the_messages()
|
||||
|
||||
def print_the_messages(self) -> None:
|
||||
print()
|
||||
for repo, comp in self.compare.items():
|
||||
if comp:
|
||||
|
@ -136,7 +136,7 @@ class CheckUpdates(Configs):
|
|||
message: str = 'Checking for news, please wait...'
|
||||
|
||||
# Starting multiprocessing
|
||||
p1 = Process(target=self.view_message)
|
||||
p1 = Process(target=self.check_for_updates)
|
||||
p2 = Process(target=self.progress.bar, args=(message, ''))
|
||||
|
||||
p1.start()
|
||||
|
|
|
@ -711,7 +711,7 @@ class UpdateRepository(Configs):
|
|||
return info[begin:end]
|
||||
|
||||
def check(self, queue) -> None:
|
||||
compare: dict = self.check_updates.check()
|
||||
compare: dict = self.check_updates.check_the_repositories()
|
||||
|
||||
print()
|
||||
for repo, comp in compare.items():
|
||||
|
|
Loading…
Reference in a new issue