mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Added question
This commit is contained in:
parent
a8b68904ff
commit
134035fbdb
1 changed files with 10 additions and 4 deletions
|
@ -38,6 +38,9 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
|
||||
self.repos_for_update: dict = {}
|
||||
|
||||
self.option_for_yes: bool = self.utils.is_option(
|
||||
('-y', '--yes'), flags)
|
||||
|
||||
def repositories(self) -> None:
|
||||
""" Checks and call the repositories for update.
|
||||
"""
|
||||
|
@ -58,15 +61,18 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
mirror (str): Repository GPG mirror key.
|
||||
"""
|
||||
if self.gpg_verification:
|
||||
gpg_key: str = f'{mirror}GPG-KEYa'
|
||||
gpg_key: str = f'{mirror}GPG-KEY'
|
||||
gpg_command: str = 'gpg --fetch-key'
|
||||
process: str = ''
|
||||
|
||||
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
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue