From a8b68904ff5628455d021add451f4f01ab803193 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 1 May 2024 18:42:26 +0300 Subject: [PATCH] Updated for gpg imported --- slpkg/update_repositories.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/slpkg/update_repositories.py b/slpkg/update_repositories.py index aed3d063..33fdea4a 100644 --- a/slpkg/update_repositories.py +++ b/slpkg/update_repositories.py @@ -58,16 +58,19 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902] mirror (str): Repository GPG mirror key. """ if self.gpg_verification: - gpg_key: str = f'{mirror}GPG-KEY' + gpg_key: str = f'{mirror}GPG-KEYa' gpg_command: str = 'gpg --fetch-key' - process = subprocess.run(f'{gpg_command} {gpg_key}', shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, encoding='utf-8', text=True, check=True) + 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 as e: + print(f'Getting GPG key: {self.bred}Failed{self.endc}\n') + raise SystemExit(2) from e output: str = re.split(r"/|\s", process.stdout) - - if 'imported:' in output: - print(f'Getting GPG key from: {gpg_key}\n') + if process.returncode == 0 and 'imported:' in output: + print(f'Getting GPG key from: {mirror}\n') def run_update(self) -> None: """ Update the repositories by category.