New package: perl-GnuPG-Interface-1.02

This commit is contained in:
Jan Christian Grünhage 2021-06-17 11:29:45 +02:00 committed by Leah Neukirchen
parent 749bb7a0e7
commit d49b06066f
3 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,90 @@
From fe898b9211fd0a6d273c438c21755e39b9b221b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
<jan.christian@gruenhage.xyz>
Date: Wed, 15 Jun 2022 13:05:40 +0200
Subject: [PATCH 1/2] disables version check
Void ships GnuPG in a new enough version anyway, so this check is not
necessary. The reason to disable the check is that it's broken rn:
```
error determining fileno for STDIN: Illegal seek at (eval 270) line 55.
Use of uninitialized value $line in pattern match (m//) at /usr/share/perl5/vendor_perl/GnuPG/Interface.pm line 827.
Use of uninitialized value $a in split at /usr/share/perl5/vendor_perl/GnuPG/Interface.pm line 841.
Use of uninitialized value $a in split at /usr/share/perl5/vendor_perl/GnuPG/Interface.pm line 841.
GnuPG Version 1.4 or 2.2+ required at (eval 270) line 55.
```
---
lib/GnuPG/Interface.pm | 18 ++----------------
t/version_updates.t | 30 ------------------------------
2 files changed, 2 insertions(+), 46 deletions(-)
delete mode 100644 t/version_updates.t
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 905ae30..7fd2321 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -818,22 +818,8 @@ sub search_keys( $% ) {
}
sub _version {
- my ( $self ) = @_;
-
- my $out = IO::Handle->new;
- my $handles = GnuPG::Handles->new( stdout => $out );
- my $pid = $self->wrap_call( commands => [ '--no-options', '--version' ], handles => $handles );
- my $line = $out->getline;
- $line =~ /(\d+\.\d+\.\d+)/;
-
- my $version = $1;
- unless ($self->cmp_version($version, '2.2') >= 0 or
- ($self->cmp_version($version, '1.4') >= 0 and $self->cmp_version($version, '1.5') < 0 )) {
- croak "GnuPG Version 1.4 or 2.2+ required";
- }
- waitpid $pid, 0;
-
- return $version;
+ # version detection is broken, hardcoding that we're on 2.2+
+ return '2.3.7';
}
sub cmp_version($$) {
diff --git a/t/version_updates.t b/t/version_updates.t
deleted file mode 100644
index 758ee7b..0000000
--- a/t/version_updates.t
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-use lib './t';
-use MyTest;
-use MyTestSpecific;
-
-TEST
-{
- my $gpg = GnuPG::Interface->new(call => './test/fake-gpg-v1');
- return ($gpg->version() eq '1.4.23');
-};
-
-
-TEST
-{
- my $gpg = GnuPG::Interface->new(call => './test/fake-gpg-v2');
- return ($gpg->version() eq '2.2.12');
-};
-
-TEST
-{
- my $gpg = GnuPG::Interface->new(call => './test/fake-gpg-v1');
- my $v1 = $gpg->version();
- $gpg->call('./test/fake-gpg-v2');
- my $v2 = $gpg->version();
-
- return ($v1 eq '1.4.23' && $v2 eq '2.2.12');
-}
--
2.36.1

View File

@ -0,0 +1,38 @@
From 4185798921211925d38e9ea2cd0f28f3eb32ddca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
<jan.christian@gruenhage.xyz>
Date: Wed, 15 Jun 2022 13:10:01 +0200
Subject: [PATCH 2/2] Hardcode path to /usr/bin/gpg
---
lib/GnuPG/Interface.pm | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 7fd2321..ed2f49e 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(
@@ -1183,9 +1183,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
--
2.36.1

View File

@ -0,0 +1,15 @@
# Template file for 'perl-GnuPG-Interface'
pkgname=perl-GnuPG-Interface
version=1.02
revision=1
wrksrc="${pkgname/perl-/}-$version"
build_style=perl-module
hostmakedepends="perl which gnupg"
makedepends="${hostmakedepends} perl-Moo perl-MooX-HandlesVia perl-MooX-late"
depends="${makedepends}"
short_desc="Perl interface GnuPG"
maintainer="Jan Christian Grünhage <jan.christian@gruenhage.xyz>"
license="Artistic-1.0-Perl, GPL-1.0-or-later"
homepage="https://metacpan.org/release/GnuPG-Interface"
distfiles="${CPAN_SITE}/GnuPG/${pkgname/perl-/}-${version}.tar.gz"
checksum=c27a48c3d48e1a9205e362eeea66d46b032bd84637991fdf0b13828bcafdd3e6