mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 05:14:16 +02:00
[arch] fix -> AUR: importing PGP keys
This commit is contained in:
@@ -10,6 +10,7 @@ PACKAGE_CACHE_DIR = '{}/pkg_cache'.format(BUILD_DIR)
|
||||
ARCH_CACHE_PATH = CACHE_PATH + '/arch'
|
||||
CATEGORIES_FILE_PATH = ARCH_CACHE_PATH + '/categories.txt'
|
||||
URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/categories.txt'
|
||||
URL_GPG_SERVERS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/arch/gpgservers.txt'
|
||||
CONFIG_DIR = '{}/.config/bauh/arch'.format(str(Path.home()))
|
||||
CUSTOM_MAKEPKG_FILE = '{}/makepkg.conf'.format(CONFIG_DIR)
|
||||
AUR_INDEX_FILE = '{}/arch.txt'.format(BUILD_DIR)
|
||||
|
||||
@@ -33,7 +33,7 @@ from bauh.commons.view_utils import new_select
|
||||
from bauh.gems.arch import BUILD_DIR, aur, pacman, makepkg, message, confirmation, disk, git, \
|
||||
gpg, URL_CATEGORIES_FILE, CATEGORIES_FILE_PATH, CUSTOM_MAKEPKG_FILE, SUGGESTIONS_FILE, \
|
||||
CONFIG_FILE, get_icon_path, database, mirrors, sorting, cpu_manager, ARCH_CACHE_PATH, UPDATES_IGNORED_FILE, \
|
||||
CONFIG_DIR, EDITABLE_PKGBUILDS_FILE
|
||||
CONFIG_DIR, EDITABLE_PKGBUILDS_FILE, URL_GPG_SERVERS
|
||||
from bauh.gems.arch.aur import AURClient
|
||||
from bauh.gems.arch.config import read_config
|
||||
from bauh.gems.arch.dependencies import DependenciesAnalyser
|
||||
@@ -1789,7 +1789,11 @@ class ArchManager(SoftwareManager):
|
||||
body=self.i18n['arch.install.aur.unknown_key.body'].format(bold(context.name), bold(check_res['gpg_key']))):
|
||||
context.watcher.change_substatus(self.i18n['arch.aur.install.unknown_key.status'].format(bold(check_res['gpg_key'])))
|
||||
self.logger.info("Importing GPG key {}".format(check_res['gpg_key']))
|
||||
if not context.handler.handle(gpg.receive_key(check_res['gpg_key'])):
|
||||
|
||||
gpg_res = self.context.http_client.get(URL_GPG_SERVERS)
|
||||
gpg_server = gpg_res.text.split('\n')[0] if gpg_res else None
|
||||
|
||||
if not context.handler.handle(gpg.receive_key(check_res['gpg_key'], gpg_server)):
|
||||
self.logger.error("An error occurred while importing the GPG key {}".format(check_res['gpg_key']))
|
||||
context.watcher.show_message(title=self.i18n['error'].capitalize(),
|
||||
body=self.i18n['arch.aur.install.unknown_key.receive_error'].format(bold(check_res['gpg_key'])))
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
from typing import Optional
|
||||
|
||||
from bauh.commons.system import SystemProcess, new_subprocess
|
||||
|
||||
|
||||
def receive_key(key: str) -> SystemProcess:
|
||||
return SystemProcess(new_subprocess(['gpg', '--recv-key', key]), check_error_output=False)
|
||||
def receive_key(key: str, server: Optional[str] = None) -> SystemProcess:
|
||||
cmd = ['gpg']
|
||||
|
||||
if server:
|
||||
cmd.extend(['--keyserver', server])
|
||||
|
||||
cmd.extend(['--recv-key', key])
|
||||
|
||||
return SystemProcess(new_subprocess(cmd), check_error_output=False)
|
||||
|
||||
Reference in New Issue
Block a user