Updated for gpg imported

This commit is contained in:
Dimitris Zlatanidis 2024-05-01 18:42:26 +03:00
parent d40ca44ebc
commit a8b68904ff

View file

@ -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.