mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Updated for gpg failed
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
e18cda64e7
commit
330c3d3427
1 changed files with 17 additions and 7 deletions
|
@ -54,13 +54,14 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
|
||||
self.run_update()
|
||||
|
||||
def import_gpg_key(self, mirror: str) -> None:
|
||||
def import_gpg_key(self, repo: str) -> None:
|
||||
""" Imports the GPG KEY.
|
||||
|
||||
Args:
|
||||
mirror (str): Repository GPG mirror key.
|
||||
"""
|
||||
if self.gpg_verification:
|
||||
mirror: str = self.repos.repositories[repo]['mirror_changelog']
|
||||
gpg_key: str = f'{mirror}GPG-KEY'
|
||||
gpg_command: str = 'gpg --fetch-key'
|
||||
process: str = ''
|
||||
|
@ -69,10 +70,17 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
process = subprocess.run(f'{gpg_command} {gpg_key}', shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, encoding='utf-8', text=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
print(f'Getting GPG key: {self.bred}Failed{self.endc}')
|
||||
if not self.option_for_yes and self.ask_question:
|
||||
self.view.question()
|
||||
return
|
||||
mirror: str = self.repos.repositories[repo]['mirror_packages']
|
||||
gpg_key: str = f'{mirror}GPG-KEY'
|
||||
|
||||
try:
|
||||
process = subprocess.run(f'{gpg_command} {gpg_key}', shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, encoding='utf-8', text=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
print(f'Getting GPG key: {self.bred}Failed{self.endc}')
|
||||
if not self.option_for_yes and self.ask_question:
|
||||
self.view.question()
|
||||
return
|
||||
|
||||
output: str = re.split(r"/|\s", process.stdout)
|
||||
if process.returncode == 0 and 'imported:' in output:
|
||||
|
@ -105,7 +113,8 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
repo (str): Repository name.
|
||||
"""
|
||||
urls: dict = {}
|
||||
self.import_gpg_key(mirror=self.repos.repositories[repo]['mirror_changelog'])
|
||||
|
||||
self.import_gpg_key(repo)
|
||||
|
||||
changelog: str = (f"{self.repos.repositories[repo]['mirror_changelog']}"
|
||||
f"{self.repos.repositories[repo]['changelog_txt']}")
|
||||
|
@ -135,7 +144,8 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
Args:
|
||||
repo (str): Repository name.
|
||||
"""
|
||||
self.import_gpg_key(mirror='https://www.slackbuilds.org/')
|
||||
# self.import_gpg_key(mirror='https://www.slackbuilds.org/')
|
||||
self.import_gpg_key(repo)
|
||||
|
||||
self.utils.remove_file_if_exists(self.repos.repositories[repo]['path'],
|
||||
self.repos.repositories[repo]['slackbuilds_txt'])
|
||||
|
|
Loading…
Reference in a new issue