From f85c1b823c4b15cf3164fa5b7b1bd2a4128c8fdd Mon Sep 17 00:00:00 2001 From: Matthew Thode Date: Mon, 25 Feb 2019 14:14:20 -0600 Subject: [PATCH] enable user settable gpg keyservers Allowing users to define which keyservers they update from allows them to work around buggy keyservers. It is also useful for local mirrors and / or private keyservers. Signed-off-by: Matthew Thode --- lib/portage/repository/config.py | 6 ++++++ lib/portage/sync/syncbase.py | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py index 482711c4b..235371ce5 100644 --- a/lib/portage/repository/config.py +++ b/lib/portage/repository/config.py @@ -109,6 +109,7 @@ class RepoConfig(object): 'sync_allow_hardlinks', 'sync_depth', 'sync_hooks_only_on_change', + 'sync_openpgp_keyserver', 'sync_openpgp_key_path', 'sync_openpgp_key_refresh_retry_count', 'sync_openpgp_key_refresh_retry_delay_exp_base', @@ -224,6 +225,9 @@ class RepoConfig(object): self.sync_allow_hardlinks = repo_opts.get( 'sync-allow-hardlinks', 'true').lower() in ('true', 'yes') + self.sync_openpgp_keyserver = repo_opts.get( + 'sync-openpgp-keyserver', 'hkps.pool.sks-keyservers.net').strip.lower() + self.sync_openpgp_key_path = repo_opts.get( 'sync-openpgp-key-path', None) @@ -601,6 +605,7 @@ class RepoConfigLoader(object): 'sync_allow_hardlinks', 'sync_depth', 'sync_hooks_only_on_change', + 'sync_openpgp_keyserver', 'sync_openpgp_key_path', 'sync_openpgp_key_refresh_retry_count', 'sync_openpgp_key_refresh_retry_delay_exp_base', @@ -1047,6 +1052,7 @@ class RepoConfigLoader(object): "main_repo", "priority", "sync_depth", + "sync_openpgp_keyserver", "sync_openpgp_key_path", "sync_openpgp_key_refresh_retry_count", "sync_openpgp_key_refresh_retry_delay_exp_base", diff --git a/lib/portage/sync/syncbase.py b/lib/portage/sync/syncbase.py index 83b35c667..ae9ec938e 100644 --- a/lib/portage/sync/syncbase.py +++ b/lib/portage/sync/syncbase.py @@ -252,10 +252,10 @@ class SyncBase(object): @type openpgp_env: gemato.openpgp.OpenPGPEnvironment """ out = portage.output.EOutput(quiet=('--quiet' in self.options['emerge_config'].opts)) - out.ebegin('Refreshing keys from keyserver') + out.ebegin('Refreshing keys from keyserver {s}'.format(s=self.repo.sync_openpgp_keyserver)) retry_decorator = self._key_refresh_retry_decorator() if retry_decorator is None: - openpgp_env.refresh_keys() + openpgp_env.refresh_keys(keyserver=self.repo.sync_openpgp_keyserver) else: def noisy_refresh_keys(): """ @@ -263,7 +263,7 @@ class SyncBase(object): errors, display errors as soon as they occur. """ try: - openpgp_env.refresh_keys() + openpgp_env.refresh_keys(keyserver=self.repo.sync_openpgp_keyserver) except Exception as e: writemsg_level("%s\n" % (e,), level=logging.ERROR, noiselevel=-1) -- 2.19.2