mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Moved imported gpg key
This commit is contained in:
parent
c03cb5f6ea
commit
d40ca44ebc
2 changed files with 25 additions and 21 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
import re
|
||||
import json
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
@ -26,24 +25,6 @@ class InstallData(Configs):
|
|||
self.ascii = AsciiBox()
|
||||
self.multi_process = MultiProcess()
|
||||
|
||||
def _import_gpg_key(self, mirror: str) -> None:
|
||||
""" Imports the GPG KEY.
|
||||
|
||||
Args:
|
||||
mirror (str): Repository GPG mirror key.
|
||||
"""
|
||||
if self.gpg_verification:
|
||||
gpg_key: str = f'{mirror}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."""
|
||||
repo_name: str = info['repo_name']
|
||||
|
@ -163,7 +144,6 @@ 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.
|
||||
|
@ -296,4 +276,3 @@ 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)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
@ -49,11 +51,30 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
|
||||
self.run_update()
|
||||
|
||||
def import_gpg_key(self, mirror: str) -> None:
|
||||
""" Imports the GPG KEY.
|
||||
|
||||
Args:
|
||||
mirror (str): Repository GPG mirror key.
|
||||
"""
|
||||
if self.gpg_verification:
|
||||
gpg_key: str = f'{mirror}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}\n')
|
||||
|
||||
def run_update(self) -> None:
|
||||
""" Update the repositories by category.
|
||||
"""
|
||||
for repo, update in self.repos_for_update.items():
|
||||
if update:
|
||||
|
||||
self.view_downloading_message(repo)
|
||||
if repo in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]:
|
||||
self.update_slackbuild_repos(repo)
|
||||
|
@ -93,6 +114,8 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
|
||||
urls[repo] = ((changelog, packages, checksums), self.repos.repositories[repo]['path'])
|
||||
|
||||
self.import_gpg_key(mirror=self.repos.repositories[repo]['mirror_changelog'])
|
||||
|
||||
self.download.download(urls)
|
||||
|
||||
self.data.install_binary_data(repo)
|
||||
|
@ -113,6 +136,8 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
|
|||
f"{self.repos.repositories[repo]['mirror_packages']} "
|
||||
f"{self.repos.repositories[repo]['path']}")
|
||||
|
||||
self.import_gpg_key(mirror='https://www.slackbuilds.org/')
|
||||
|
||||
self.multi_process.process(lftp_command)
|
||||
|
||||
# It checks if there is a SLACKBUILDS.TXT file, otherwise it's going to create one.
|
||||
|
|
Loading…
Reference in a new issue