--- .../0001-use-fake-pinentry-Closes-835075.patch | 83 ++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 7 ++ 3 files changed, 91 insertions(+) create mode 100644 debian/patches/0001-use-fake-pinentry-Closes-835075.patch create mode 100644 debian/patches/series
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 <d...@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 -- 2.9.3