From 5cb03441e93debd40f2391f6d3938cd09ed046a2 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 7 Apr 2020 08:14:33 +0200 Subject: [PATCH] 1821469 - use list of keyservers when trying to download gpg keys --- hplip-keyserver.patch | 59 ++++++++++++++++++++++++++++++++++++++----- hplip.spec | 5 +++- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/hplip-keyserver.patch b/hplip-keyserver.patch index fb69217..92bd018 100644 --- a/hplip-keyserver.patch +++ b/hplip-keyserver.patch @@ -1,12 +1,59 @@ -diff -up hplip-3.18.6/base/validation.py.keyserver hplip-3.18.6/base/validation.py ---- hplip-3.18.6/base/validation.py.keyserver 2018-11-13 17:35:38.085322569 +0100 -+++ hplip-3.18.6/base/validation.py 2018-11-13 17:36:18.026991983 +0100 -@@ -42,7 +42,7 @@ class DigiSign_Verification(object): +diff -up hplip-3.20.3/base/tui.py.keyserver hplip-3.20.3/base/tui.py +--- hplip-3.20.3/base/tui.py.keyserver 2020-04-07 07:31:12.747293360 +0200 ++++ hplip-3.20.3/base/tui.py 2020-04-07 07:31:32.180113572 +0200 +@@ -241,6 +241,7 @@ class ProgressMeter(object): + sys.stdout.write(y) + + sys.stdout.flush() ++ sys.stdout.write('\n') + self.prev_length = len(y) + self.spinner_pos = (self.spinner_pos + 1) % 8 + +diff -up hplip-3.20.3/base/validation.py.keyserver hplip-3.20.3/base/validation.py +--- hplip-3.20.3/base/validation.py.keyserver 2020-03-10 09:01:53.000000000 +0100 ++++ hplip-3.20.3/base/validation.py 2020-04-07 07:34:30.896467229 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + # + # (c) Copyright 2015 HP Development Company, L.P. +@@ -42,8 +42,10 @@ class DigiSign_Verification(object): class GPG_Verification(DigiSign_Verification): - def __init__(self, pgp_site = 'pgp.mit.edu', key = 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9): -+ def __init__(self, pgp_site = 'sks-keyservers.net', key = 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9): - self.__pgp_site = pgp_site +- self.__pgp_site = pgp_site ++ def __init__(self, keyservers = ['pgp.mit.edu', 'sks-keyservers.net', ++ 'pool.sks-keyservers.net'], ++ key = 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9): ++ self.__keyservers = keyservers self.__key = key self.__gpg = utils.which('gpg',True) + +@@ -82,13 +84,18 @@ class GPG_Verification(DigiSign_Verifica + + + def __acquire_gpg_key(self): +- +- cmd = '%s --homedir %s --no-permission-warning --keyserver %s --recv-keys 0x%X' \ +- % (self.__gpg, self.__gpg_dir, self.__pgp_site, self.__key) +- +- log.info("Receiving digital keys: %s" % cmd) +- status, output = utils.run(cmd) +- log.debug(output) ++ for kserver in self.__keyservers: ++ cmd = '%s --homedir %s --no-permission-warning --keyserver %s --recv-keys 0x%X' \ ++ % (self.__gpg, self.__gpg_dir, kserver, self.__key) ++ ++ log.info("Receiving digital keys: %s" % cmd) ++ status, output = utils.run(cmd) ++ log.debug(output) ++ ++ if not status: ++ break ++ log.info("Receiving keys from {} failed, trying the next keyserver." ++ .format(kserver)) + + self.__change_owner(True) + diff --git a/hplip.spec b/hplip.spec index f4884eb..56f656d 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.20.3 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC Url: https://developers.hp.com/hp-linux-imaging-and-printing @@ -699,6 +699,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio %changelog +* Tue Apr 07 2020 Zdenek Dohnal - 3.20.3-3 +- 1821469 - use list of keyservers when trying to download gpg keys + * Wed Mar 25 2020 Tom Stellard - 3.20.3-2 - Fix some -Wreturn-type warnings - clang treates these as errors, so this fixes the build with clang.