Updated for gpg imported

This commit is contained in:
Dimitris Zlatanidis 2024-05-01 16:57:28 +03:00
parent b0110980e9
commit c03cb5f6ea
2 changed files with 14 additions and 8 deletions

View file

@ -8,6 +8,7 @@
- Updated:
* Improved code quality
* Updated for check gpg key imported
- Added:
* Total file size with find command

View file

@ -4,6 +4,7 @@
import re
import json
import subprocess
from pathlib import Path
from slpkg.configs import Configs
@ -29,13 +30,19 @@ class InstallData(Configs):
""" Imports the GPG KEY.
Args:
mirror (str): Repository mirror.
mirror (str): Repository GPG mirror key.
"""
if self.gpg_verification:
print(f'Getting key from:{mirror}')
gpg_command: str = 'gpg --quiet --fetch-key'
gpg_key: str = f'{mirror}GPG-KEY'
self.multi_process.process(f'{gpg_command} {gpg_key}')
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)
output: str = re.split(r"/|\s", process.stdout)
if 'imported:' in output:
print(f'Getting GPG key from: {gpg_key}')
def write_repo_info(self, changelog_file: Path, info: dict) -> None:
""" Reads the first date of the changelog file."""
@ -77,8 +84,6 @@ class InstallData(Configs):
print(f"Updating the database for '{self.cyan}{repo}{self.endc}'... ",
end='', flush=True)
self._import_gpg_key(mirror='https://www.slackbuilds.org/')
data: dict = {}
cache: list = []
names: list = []
@ -158,6 +163,7 @@ class InstallData(Configs):
data_file.write_text(json.dumps(data, indent=4), encoding='utf-8')
self.view_done_message()
self._import_gpg_key(mirror='https://www.slackbuilds.org/')
def install_binary_data(self, repo: str) -> None: # pylint: disable=[R0912,R0914,R0915]
""" Installs the data for binary repositories.
@ -173,8 +179,6 @@ class InstallData(Configs):
if repo in slack_repos:
mirror: str = self.repos.repositories[repo]['mirror_changelog']
self._import_gpg_key(mirror=mirror)
checksums_dict: dict = {}
data: dict = {}
build: str = ''
@ -292,3 +296,4 @@ class InstallData(Configs):
data_file.write_text(json.dumps(data, indent=4), encoding='utf-8')
self.view_done_message()
self._import_gpg_key(mirror=mirror)