[Pkg-privacy-commits] [parcimonie] 01/02: Support the case when using GnuPG 2.x and the keyserver is configured in gpg.conf, and not in dirmngr.conf (Closes: #827311).

Intrigeri intrigeri at moszumanska.debian.org
Thu Jun 23 07:52:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch upstream-master
in repository parcimonie.

commit e80291129daf9934449a525274b6d38e73302924
Author: intrigeri <intrigeri at boum.org>
Date:   Thu Jun 23 07:38:48 2016 +0000

    Support the case when using GnuPG 2.x and the keyserver is configured in gpg.conf, and not in dirmngr.conf (Closes: #827311).
---
 lib/App/Parcimonie.pm | 46 +++++++++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/lib/App/Parcimonie.pm b/lib/App/Parcimonie.pm
index ca8239e..71d373f 100644
--- a/lib/App/Parcimonie.pm
+++ b/lib/App/Parcimonie.pm
@@ -162,6 +162,9 @@ sub gpgRecvKeys {
 
 Throws an exception if no keyserver is defined in GnuPG configuration.
 
+When using GnuPG 2.x, a keyserver can be defined either in dirmngr's
+configuration or in good old gpg.conf, so we check both.
+
 =cut
 
 sub checkGpgHasDefinedKeyserver {
@@ -174,32 +177,33 @@ sub checkGpgHasDefinedKeyserver {
         my @output = capturex(qw{gpg-connect-agent --dirmngr keyserver /bye});
         my $res = pop @output;
         $res eq "OK\n" || croak "Agent replied: $res";
-        @output        || croak "No keyserver is configured.";
-        my $last_keyserver = pop @output;
-        $last_keyserver =~ m{\A [S] \s+ KEYSERVER \s+}xms
-            || croak "No keyserver is configured."
+        if (@output) {
+            my $last_keyserver = pop @output;
+            if ($last_keyserver =~ m{\A [S] \s+ KEYSERVER \s+}xms) {
+                return;
+            }
+        }
+    }
+
+    my $gpgconf;
+    if (defined $gnupg_homedir) {
+        $gpgconf = path($gnupg_homedir, 'gpg.conf');
     }
     else {
-        my $gpgconf;
-        if (defined $gnupg_homedir) {
-            $gpgconf = path($gnupg_homedir, 'gpg.conf');
-        }
-        else {
-            $gpgconf = path(File::HomeDir->my_home, '.gnupg', 'gpg.conf');
-        }
+        $gpgconf = path(File::HomeDir->my_home, '.gnupg', 'gpg.conf');
+    }
 
-        -f $gpgconf
-            or croak "No GnuPG configuration file was found in '$gpgconf'";
-        -r $gpgconf
-            or croak "The GnuPG configuration file ($gpgconf) is not readable";
+    -f $gpgconf
+        or croak "No GnuPG configuration file was found in '$gpgconf'";
+    -r $gpgconf
+        or croak "The GnuPG configuration file ($gpgconf) is not readable";
 
-        my %gpgconf = ParseConfig($gpgconf);
+    my %gpgconf = ParseConfig($gpgconf);
 
-        defined $gpgconf{keyserver} && length $gpgconf{keyserver}
-            or croak
-                "No keyserver is defined in GnuPG configuration ($gpgconf).\n" .
-                "See 'man parcimonie' to learn how to correct that.";
-    }
+    defined $gpgconf{keyserver} && length $gpgconf{keyserver}
+        or croak
+            "No keyserver is defined in GnuPG configuration ($gpgconf).\n" .
+            "See 'man parcimonie' to learn how to correct that.";
 
     return;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/parcimonie.git



More information about the Pkg-privacy-commits mailing list