[libmail-gnupg-perl] 01/02: Add patch to make testsuite and autopkgtest work with gnupg2.

gregor herrmann gregoa at debian.org
Tue Sep 6 19:43:10 UTC 2016


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

gregoa pushed a commit to branch master
in repository libmail-gnupg-perl.

commit 9f58451a7d53d816a2ae333ec6161fe0c63b3964
Author: gregor herrmann <gregoa at debian.org>
Date:   Tue Sep 6 21:40:40 2016 +0200

    Add patch to make testsuite and autopkgtest work with gnupg2.
    
    Thanks: Daniel Kahn Gillmor for the patch.
    Closes: #835075
---
 .../0001-use-fake-pinentry-Closes-835075.patch     | 83 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       |  7 ++
 debian/tests/pkg-perl/smoke-setup                  |  6 ++
 4 files changed, 97 insertions(+)

diff --git a/debian/patches/0001-use-fake-pinentry-Closes-835075.patch b/debian/patches/0001-use-fake-pinentry-Closes-835075.patch
new file mode 100644
index 0000000..19dc3f4
--- /dev/null
+++ b/debian/patches/0001-use-fake-pinentry-Closes-835075.patch
@@ -0,0 +1,83 @@
+From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Date: Fri, 2 Sep 2016 08:46:23 -0400
+Subject: use fake pinentry (Closes: #835075)
+
+This allows us to run the tests against all versions of GnuPG.
+---
+ t/30.inline-decrypt.t |  7 +++++++
+ t/fake-pinentry.pl    | 16 ++++++++++++++++
+ t/import_keys.pl      |  9 +++++++++
+ 3 files changed, 32 insertions(+)
+ create mode 100755 t/fake-pinentry.pl
+
+diff --git a/t/30.inline-decrypt.t b/t/30.inline-decrypt.t
+index bb38ee2..8b74e1c 100644
+--- a/t/30.inline-decrypt.t
++++ b/t/30.inline-decrypt.t
+@@ -4,6 +4,8 @@ use Test::More;
+ use Mail::GnuPG;
+ use MIME::Entity;
+ use File::Temp qw(tempdir);
++use Cwd;
++use IO::File;
+ 
+ use strict;
+ 
+@@ -25,6 +27,11 @@ unless ( 0 == system("gpg --version 2>&1 >/dev/null") ) {
+ }
+ 
+ my $tmpdir = tempdir( "mgtXXXXX", CLEANUP => 1);
++my $agentconf = IO::File->new("> $tmpdir/gpg-agent.conf");
++if (defined $agentconf) {
++  print $agentconf "pinentry-program ".getcwd."/t/fake-pinentry.pl\n";
++  $agentconf->close;
++}
+ 
+ unless ( 0 == system("gpg --homedir $tmpdir --trusted-key 0x49539D60EFEA4EAD --import t/test-key.pgp 2>&1 >/dev/null")) {
+   plan skip_all => "unable to import testing keys";
+diff --git a/t/fake-pinentry.pl b/t/fake-pinentry.pl
+new file mode 100755
+index 0000000..c138b5d
+--- /dev/null
++++ b/t/fake-pinentry.pl
+@@ -0,0 +1,16 @@
++#!/usr/bin/perl -w
++use strict;
++use warnings;
++
++# turn off buffering
++$| = 1;
++
++print "OK This is only for test suites, and should never be used in production\n";
++while (<STDIN>) {
++  chomp;
++  next if (/^$/);
++  print ("D passphrase\n") if (/^getpin/i);
++  print "OK\n";
++  exit if (/^bye/i);
++}
++1;
+diff --git a/t/import_keys.pl b/t/import_keys.pl
+index 06ee759..df69111 100644
+--- a/t/import_keys.pl
++++ b/t/import_keys.pl
+@@ -1,3 +1,6 @@
++use IO::File;
++use Cwd;
++
+ sub import_keys($){
+   my $filename=shift;
+ 
+@@ -10,6 +13,12 @@ sub import_keys($){
+   }
+ 
+   my $gpghome = tempdir( "mgtXXXXX", CLEANUP => 1);
++  my $agentconf = IO::File->new("> $gpghome/gpg-agent.conf");
++  if (defined $agentconf) {
++    print $agentconf "pinentry-program ".getcwd."/t/fake-pinentry.pl\n";
++    $agentconf->close;
++  }
++
+   unless ( 0 == system("gpg --homedir $gpghome $trusted --import $filename 2>&1 >/dev/null")) {
+     return undef;
+   }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ec42a52
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-use-fake-pinentry-Closes-835075.patch
diff --git a/debian/rules b/debian/rules
index 2d33f6a..a872481 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,3 +2,10 @@
 
 %:
 	dh $@
+
+# only necessary because debian/patches doesn't change the mode of added files.
+# once debian/patches/0001-use-fake-pinentry-Closes-835075.patch is upstream
+# this can be dropped:
+override_dh_auto_test:
+	chmod a+x t/fake-pinentry.pl
+	dh_auto_test
diff --git a/debian/tests/pkg-perl/smoke-setup b/debian/tests/pkg-perl/smoke-setup
new file mode 100755
index 0000000..21fdbe9
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-setup
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# only necessary because debian/patches doesn't change the mode of added files.
+# once debian/patches/0001-use-fake-pinentry-Closes-835075.patch is upstream
+# this can be dropped:
+chmod a+x $TDIR/t/fake-pinentry.pl

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmail-gnupg-perl.git



More information about the Pkg-perl-cvs-commits mailing list