summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/detect-taint-mode36
-rw-r--r--debian/patches/hardcode-path31
-rw-r--r--debian/patches/series6
-rw-r--r--debian/patches/test-allow-interface-to-fail26
-rw-r--r--debian/patches/test-dummy-binaries65
-rw-r--r--debian/patches/test-gnupg118
-rw-r--r--debian/patches/test_reset_version_on_call_change42
7 files changed, 224 insertions, 0 deletions
diff --git a/debian/patches/detect-taint-mode b/debian/patches/detect-taint-mode
new file mode 100644
index 0000000..f43bed4
--- /dev/null
+++ b/debian/patches/detect-taint-mode
@@ -0,0 +1,36 @@
+Description: Test that Taint mode works
+Author: Andrew Ruthven
+Bug: https://rt.cpan.org/Ticket/Display.html?id=133041
+Last-Update: 2021-01-28
+
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- /dev/null
++++ b/t/taint.t
+@@ -0,0 +1,26 @@
++#!/usr/bin/perl -wT
++#
++# Ensure we can instatiate in Taint mode. Don't need to
++# do any work, as GnuPG::Interface runs the command we're going
++# to use to detect the version.
++
++use strict;
++
++use lib './t';
++use MyTest;
++
++use GnuPG::Interface;
++
++my $gnupg;
++
++# See that we instantiate an object in Taint mode
++TEST
++{
++ $gnupg = GnuPG::Interface->new( call => '/usr/bin/gpg' );
++};
++
++# See that version is set
++TEST
++{
++ defined $gnupg->version;
++};
diff --git a/debian/patches/hardcode-path b/debian/patches/hardcode-path
new file mode 100644
index 0000000..1c6d8bc
--- /dev/null
+++ b/debian/patches/hardcode-path
@@ -0,0 +1,31 @@
+Description: Hardcode path to /usr/bin/gpg
+Author: Dominic Hargreaves
+Last-Update: 2021-02-10
+Forwarded: Not-Needed
+Bug-Debian: https://bugs.debian.org/981647
+
+diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
+index 13b313e..84312e2 100644
+--- a/lib/GnuPG/Interface.pm
++++ b/lib/GnuPG/Interface.pm
+@@ -76,7 +76,7 @@ sub gnupg_call { shift->call(@_); }
+
+ sub BUILD {
+ my ( $self, $args ) = @_;
+- $self->hash_init( call => 'gpg', %$args );
++ $self->hash_init( call => '/usr/bin/gpg', %$args );
+ }
+
+ struct(
+@@ -1190,9 +1190,8 @@ keys to list in a key-listing.
+
+ =item call
+
+-This defines the call made to invoke GnuPG. Defaults to 'gpg'; this
+-should be changed if 'gpg' is not in your path, or there is a different
+-name for the binary on your system.
++This defines the call made to invoke GnuPG. Defaults to '/usr/bin/gpg'; this
++should be changed if there is a different name for the binary on your system.
+
+ =item passphrase
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..19ecc7a
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,6 @@
+test_reset_version_on_call_change
+test-gnupg1
+test-allow-interface-to-fail
+test-dummy-binaries
+detect-taint-mode
+hardcode-path
diff --git a/debian/patches/test-allow-interface-to-fail b/debian/patches/test-allow-interface-to-fail
new file mode 100644
index 0000000..d8db0a7
--- /dev/null
+++ b/debian/patches/test-allow-interface-to-fail
@@ -0,0 +1,26 @@
+Description: Allow setting the call program to fail
+ This test is checking that the old setter/getter interface
+ works. My fix to resetting the version causes this test to
+ fail on Debian as we have no binary called 'gnupg'. Since
+ the test is testing the setter/getter we don't care if
+ loading the version fails.
+Author: Andrew Ruthven <andrew@etc.gen.nz>
+Bug: https://rt.cpan.org/Ticket/Display.html?id=133021
+Last-Update: 2020-07-19
+
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/t/Interface.t
++++ b/t/Interface.t
+@@ -24,6 +24,10 @@
+ # deprecation test
+ TEST
+ {
+- $gnupg->gnupg_call( $v2 );
++ # Setting the program to call now calls the program to
++ # determine the version, but if gnupg doesn't exist we
++ # can't run it. Since we're just checking that call()
++ # has changed, let setting the variable fail.
++ eval { $gnupg->gnupg_call( $v2 ) };
+ $gnupg->call() eq $v2;
+ };
diff --git a/debian/patches/test-dummy-binaries b/debian/patches/test-dummy-binaries
new file mode 100644
index 0000000..9010cf0
--- /dev/null
+++ b/debian/patches/test-dummy-binaries
@@ -0,0 +1,65 @@
+Description: Ensure that we have some dummy "binaries" around for testing.
+ The test scripts require that gpg1, gpg and gnupg all exist and are
+ executable, otherwise warnings will be thrown.
+
+ This patch provides those "binaries", but they actually only print the
+ a version number that matches the binary.
+
+ It is still necessary to have at least one real GnuPG binary installed
+ for the test suite to pass. For Debian, but gpg and gpg1 need to be
+ present.
+
+ The patch to t/update_version.t isn't required on Debian, but is included
+ as this patch set has been forwarded upstream, and may be required
+ elsewhere. This is also why dummy scripts for gpg, gpg1 and gnupg are
+ provided.
+Author: Andrew Ruthven
+Bug: https://rt.cpan.org/Ticket/Display.html?id=133039
+Last-Update: 2020-07-23
+
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/t/Interface.t
++++ b/t/Interface.t
+@@ -8,6 +8,10 @@
+ use lib './t';
+ use MyTest;
+
++# Make sure that there are some dummy scripts available so no warnings
++# are thrown.
++$ENV{PATH} .= ":t/bin";
++
+ use GnuPG::Interface;
+
+ my $v1 = './test/fake-gpg-v1';
+--- /dev/null
++++ b/t/bin/gnupg
+@@ -0,0 +1,3 @@
++#!/bin/sh
++
++echo "gpg (GnuPG) 2.2.20"
+--- /dev/null
++++ b/t/bin/gpg
+@@ -0,0 +1,3 @@
++#!/bin/sh
++
++echo "gpg (GnuPG) 2.2.20"
+--- /dev/null
++++ b/t/bin/gpg1
+@@ -0,0 +1,3 @@
++#!/bin/sh
++
++echo "gpg (GnuPG) 1.4.23"
+--- a/t/update_version.t
++++ b/t/update_version.t
+@@ -14,6 +14,10 @@
+ use lib './t';
+ use MyTest;
+
++# Make sure that there are some dummy scripts available so no warnings
++# are thrown.
++$ENV{PATH} .= ":t/bin";
++
+ use GnuPG::Interface;
+
+ my $gnupg = GnuPG::Interface->new();
diff --git a/debian/patches/test-gnupg1 b/debian/patches/test-gnupg1
new file mode 100644
index 0000000..ceaaf58
--- /dev/null
+++ b/debian/patches/test-gnupg1
@@ -0,0 +1,18 @@
+Description: Test against GnuPG v1
+ The test cases only test "gpg" which for Debian is v2. As the module also
+ supports v1 which we ship, we should test against it.
+Author: Andrew Ruthven <andrew@etc.gen.nz>
+Forwarded: not-needed
+Last-Update: 2020-07-18
+
+--- a/t/MyTestSpecific.pm
++++ b/t/MyTestSpecific.pm
+@@ -53,7 +53,7 @@
+
+ $ENV{'GNUPGHOME'} = $homedir;
+
+-$gnupg = GnuPG::Interface->new( passphrase => 'test' );
++$gnupg = GnuPG::Interface->new( passphrase => 'test', call => ($ENV{'CALL'} || 'gpg') );
+ $gnupg->options->hash_init( homedir => $homedir,
+ armor => 1,
+ meta_interactive => 0,
diff --git a/debian/patches/test_reset_version_on_call_change b/debian/patches/test_reset_version_on_call_change
new file mode 100644
index 0000000..3d6ae06
--- /dev/null
+++ b/debian/patches/test_reset_version_on_call_change
@@ -0,0 +1,42 @@
+Description: Using 'call' method doesn't reset gpg version
+ GnuPG::Interface allows the use of the 'call' method to change
+ the program to be used. Test that this works.
+Author: Andrew Ruthven <andrew@etc.gen.nz>
+Bug: https://rt.cpan.org/Ticket/Display.html?id=133021
+Last-Update: 2021-01-28
+--- /dev/null
++++ b/t/update_version.t
+@@ -0,0 +1,33 @@
++#!/usr/bin/perl -w
++#
++# Request Tracker 4 tests use call() to change the program
++# to use to gpg1, however GnuPG::Interface has already set
++# the version to 2.2.x and didn't clear the version, therefore
++# GnuPG::Interface tried to use --pinentry-mode which
++# would fail.
++#
++# Test to ensure that version is cleared - which is then
++# lazy loaded when needed.
++
++use strict;
++
++use lib './t';
++use MyTest;
++
++use GnuPG::Interface;
++
++my $gnupg = GnuPG::Interface->new();
++
++# See that version is set
++TEST
++{
++ $gnupg->cmp_version($gnupg->version, '2.2') > 0;
++};
++
++$gnupg->call('gpg1');
++
++# See that version is set to 1.4.x.
++TEST
++{
++ $gnupg->cmp_version($gnupg->version, '1.5') < 0;
++};