mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Updated for gpg verify
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
b66a32afba
commit
90f3cea360
1 changed files with 15 additions and 14 deletions
|
@ -11,7 +11,7 @@ from slpkg.views.views import View
|
||||||
|
|
||||||
class GPGVerify(Configs): # pylint: disable=[R0903]
|
class GPGVerify(Configs): # pylint: disable=[R0903]
|
||||||
|
|
||||||
""" GPG verify key.
|
""" GPG verify files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -26,25 +26,26 @@ class GPGVerify(Configs): # pylint: disable=[R0903]
|
||||||
asc_files (list): List of files.
|
asc_files (list): List of files.
|
||||||
"""
|
"""
|
||||||
if self.gpg_verification:
|
if self.gpg_verification:
|
||||||
verify_message: str = '\rVerify files with GPG... '
|
output: dict = {}
|
||||||
gpg_command: str = 'gpg --verify'
|
gpg_command: str = 'gpg --verify'
|
||||||
print(verify_message, end='')
|
print('\rVerify files with GPG... ', end='')
|
||||||
|
|
||||||
exit_code: int = 0
|
# exit_code: int = 0
|
||||||
for i, file in enumerate(asc_files):
|
for file in asc_files:
|
||||||
|
|
||||||
with subprocess.Popen(f'{gpg_command} {file}', shell=True, stdout=subprocess.PIPE,
|
with subprocess.Popen(f'{gpg_command} {file}', shell=True, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT, text=True) as process:
|
stderr=subprocess.STDOUT, text=True) as process:
|
||||||
|
|
||||||
process.wait()
|
process.wait()
|
||||||
|
|
||||||
if process.returncode != 0:
|
output[file.name] = process.returncode
|
||||||
exit_code: int = process.returncode
|
|
||||||
if i == 0:
|
|
||||||
print(f'{self.bred}{self.ascii.failed}{self.endc}')
|
|
||||||
print(f"{'':>2}Error {process.returncode}: {file.name}")
|
|
||||||
|
|
||||||
if exit_code == 0:
|
all_zero = all(value == 0 for value in output.values())
|
||||||
print(f'{self.bgreen}{self.ascii.done}{self.endc}')
|
if all_zero:
|
||||||
elif exit_code != 0 and self.dialog:
|
print(f'{self.bgreen}{self.ascii.done}{self.endc}')
|
||||||
self.view.question()
|
else:
|
||||||
|
print(f'{self.bred}{self.ascii.failed}{self.endc}')
|
||||||
|
for file, code in output.items():
|
||||||
|
if code != 0:
|
||||||
|
print(f"{'':>2}Error {code}: {file}")
|
||||||
|
self.view.question()
|
||||||
|
|
Loading…
Reference in a new issue