Updated for ponce

This commit is contained in:
Dimitris Zlatanidis 2023-03-05 09:30:23 +02:00
parent b53f8227c0
commit 20691bf0a0
2 changed files with 20 additions and 15 deletions

View file

@ -21,23 +21,22 @@ class CheckUpdates(Configs):
self.green: str = self.color['green']
self.yellow: str = self.color['yellow']
self.endc: str = self.color['endc']
self.local_chg_txt = Path(self.sbo_repo_path, self.sbo_chglog_txt)
self.repo_chg_txt: str = f'{self.sbo_repo_url}{self.sbo_chglog_txt}'
def check(self) -> bool:
""" Checks the ChangeLogs and returns True or False. """
local_date: int = 0
local_chg_txt = Path(self.sbo_repo_path, self.sbo_chglog_txt)
repo_chg_txt: str = f'{self.sbo_repo_url}{self.sbo_chglog_txt}'
if self.ponce_repo:
local_chg_txt = Path(self.ponce_repo_path, self.ponce_chglog_txt)
repo_chg_txt: str = f'{self.ponce_repo_url}{self.ponce_chglog_txt}'
self.local_chg_txt = Path(self.ponce_repo_path, self.ponce_chglog_txt)
self.repo_chg_txt: str = f'{self.ponce_repo_url}{self.ponce_chglog_txt}'
http = urllib3.PoolManager()
repo = http.request('GET', repo_chg_txt)
repo = http.request('GET', self.repo_chg_txt)
if local_chg_txt.is_file():
local_date = int(os.stat(local_chg_txt).st_size)
if self.local_chg_txt.is_file():
local_date = int(os.stat(self.local_chg_txt).st_size)
repo_date: int = int(repo.headers['Content-Length'])
@ -51,7 +50,7 @@ class CheckUpdates(Configs):
def updates(self) -> None:
""" Starting multiprocessing download process. """
message: str = f'Checking for news in the {self.sbo_chglog_txt} file...'
message: str = f'Checking for news in the {self.repo_chg_txt} file...'
# Starting multiprocessing
p1 = Process(target=self.view_message)

View file

@ -21,6 +21,12 @@ class ViewPackage(Configs, Utilities):
self.session = Session
self.flag_pkg_version: list = ['-p', '--pkg-version']
self.repo_url: str = self.sbo_repo_url
self.repo_tar_suffix: str = self.sbo_tar_suffix
if self.ponce_repo:
self.repo_url: str = self.ponce_repo_url
self.repo_tar_suffix: str = ''
def package(self, packages: list) -> None:
""" View the packages from the repository. """
color = self.colour()
@ -46,9 +52,9 @@ class ViewPackage(Configs, Utilities):
SBoTable.location # type: ignore
).filter(SBoTable.name == package).first()
readme = self.http_request(f'{self.sbo_repo_url}{info[9]}/{info[0]}/README')
readme = self.http_request(f'{self.repo_url}{info[9]}/{info[0]}/README')
info_file = self.http_request(f'{self.sbo_repo_url}{info[9]}/{info[0]}/{info[0]}.info')
info_file = self.http_request(f'{self.repo_url}{info[9]}/{info[0]}/{info[0]}.info')
maintainer, email, homepage = '', '', ''
for line in info_file.data.decode().splitlines(): # type: ignore
@ -69,17 +75,17 @@ class ViewPackage(Configs, Utilities):
f'Version: {green}{info[1]}{endc}\n'
f'Requires: {green}{deps}{endc}\n'
f'Homepage: {blue}{homepage}{endc}\n'
f'Download SlackBuild: {blue}{self.sbo_repo_url}{info[9]}/{info[0]}'
f'{self.sbo_tar_suffix}{endc}\n'
f'Download SlackBuild: {blue}{self.repo_url}{info[9]}/{info[0]}'
f'{self.repo_tar_suffix}{endc}\n'
f'Download sources: {blue}{info[3]}{endc}\n'
f'Download_x86_64 sources: {blue}{info[4]}{endc}\n'
f'Md5sum: {yellow}{info[5]}{endc}\n'
f'Md5sum_x86_64: {yellow}{info[6]}{endc}\n'
f'Files: {green}{info[7]}{endc}\n'
f'Description: {green}{info[8]}{endc}\n'
f'Slackware: {cyan}{self.sbo_repo_url.split("/")[-1]}{endc}\n'
f'Slackware: {cyan}{self.repo_url.split("/")[-1]}{endc}\n'
f'Category: {red}{info[9]}{endc}\n'
f'SBo url: {blue}{self.sbo_repo_url}{info[9]}/{info[0]}{endc}\n'
f'SBo url: {blue}{self.repo_url}{info[9]}/{info[0]}{endc}\n'
f'Maintainer: {yellow}{maintainer}{endc}\n'
f'Email: {yellow}{email}{endc}\n'
f'\nREADME: {cyan}{readme.data.decode()}{endc}') # type: ignore