[Bps-public-commit] GnuPG-Interface branch, master, updated. 0.45-4-g9841d55

Alex Vandiver alexmv at bestpractical.com
Mon Dec 12 12:04:37 EST 2011


The branch, master has been updated
       via  9841d559ca3a907bd65b681f156831186f12258b (commit)
       via  af9f79d0c1a0c0e73824e31972501a91ba69d75d (commit)
       via  749dfee007da1522fedb8f1333b6b6f513436687 (commit)
       via  2c30ea1d181371db94297b796b7b7152e807ffad (commit)
      from  9a3e4a8e06fb1c6049e8989f023ce0f345a461a9 (commit)

Summary of changes:
 Makefile.PL            |   16 ++++++++--------
 lib/GnuPG/Interface.pm |   31 ++++++++++++++++++++++++++++---
 t/MyTestSpecific.pm    |   14 +-------------
 3 files changed, 37 insertions(+), 24 deletions(-)

- Log -----------------------------------------------------------------
commit 2c30ea1d181371db94297b796b7b7152e807ffad
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sat Oct 29 03:54:06 2011 -0400

    Add a missing semicolon in an example

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index f39fd8b..17cb064 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -1202,9 +1202,9 @@ The following setup can be done before any of the following examples:
   close $input;
   close $cipher_file;
 
-  my @plaintext    = <$output>;   # reading the output
-  my @error_output = <$error>;    # reading the error
-  my @status_info  = <$status_fh> # read the status info
+  my @plaintext    = <$output>;    # reading the output
+  my @error_output = <$error>;     # reading the error
+  my @status_info  = <$status_fh>; # read the status info
 
   # clean up...
   close $output;

commit 749dfee007da1522fedb8f1333b6b6f513436687
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Oct 31 22:39:36 2011 -0400

    Add a search_keys wrapper

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 17cb064..545b59b 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -745,6 +745,14 @@ sub send_keys( $% ) {
     );
 }
 
+sub search_keys( $% ) {
+    my ( $self, %args ) = @_;
+    return $self->wrap_call(
+        %args,
+        commands => ['--search-keys']
+    );
+}
+
 sub test_default_key_passphrase() {
     my ($self) = @_;
 
@@ -928,6 +936,8 @@ initialization of data members.
 
 =item send_keys( % )
 
+=item search_keys( % )
+
 These methods each correspond directly to or are very similar
 to a GnuPG command described in L<gpg>.  Each of these methods
 takes a hash, which currently must contain a key of B<handles>

commit af9f79d0c1a0c0e73824e31972501a91ba69d75d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Dec 12 11:58:04 2011 -0500

    Remove effectively dead code for gpg2 checking
    
    Two places attempted to test for gpg 1.4, or fall back to gpg2 if it
    existed.  However, because it either 'die'd or 'last'ed, it was
    impossible to reach the gpg2 iteration of the loop.  Simply remove the
    useless loop, and test for the presence of 'gpg', as well as its
    version.

diff --git a/Makefile.PL b/Makefile.PL
index 58c3e78..8156e7f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,14 +2,14 @@ use strict;
 use warnings;
 use inc::Module::Install;
 
-for my $gpg qw(gpg gpg2) {
-    my $gpg_find = "which $gpg";
-    print "$gpg_find ... ";
-    system($gpg_find);
-    if ( $? != 0 ) {
-        die "gpg (GnuPG) not found";
-    } else { last }
-}
+print "which gpg ... ";
+system("which", "gpg");
+die "gpg (GnuPG) not found" if ( $? != 0 );
+
+my $output = `gpg --version`;
+die "Can't determine gpg version"
+    unless $output =~ /^gpg \(GnuPG\) (\d+\.\d+)/;
+die "gpg (GnuPG) 1.4 or later is required" unless $1 >= 1.4;
 
 
 author 'Frank J. Tobin';
diff --git a/t/MyTestSpecific.pm b/t/MyTestSpecific.pm
index 629c673..7894ccc 100644
--- a/t/MyTestSpecific.pm
+++ b/t/MyTestSpecific.pm
@@ -38,19 +38,7 @@ use vars qw( @ISA           @EXPORT
 	      texts                  file_match
 	    );
 
-
-for my $gpg qw(gpg gpg2) {
-    my $gpg_find = "which $gpg";
-    print "$gpg_find ... ";
-    system($gpg_find);
-    if ( $? != 0 ) {
-        die "gpg (GnuPG) not found";
-    } else { $gpg_program = $gpg; last }
-}
-
-$gnupg = GnuPG::Interface->new( gnupg_call  => $gpg_program,
-				passphrase  => 'test',
-			      );
+$gnupg = GnuPG::Interface->new( passphrase => 'test' );
 
 $gnupg->options->hash_init( homedir              => 'test',
 			    armor                => 1,

commit 9841d559ca3a907bd65b681f156831186f12258b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Dec 12 12:04:18 2011 -0500

    Add a ->version method to determine the GnuPG version

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 545b59b..42573bd 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -753,6 +753,17 @@ sub search_keys( $% ) {
     );
 }
 
+sub version {
+    my ( $self ) = @_;
+
+    my $out = IO::Handle->new;
+    my $handles = GnuPG::Handles->new( stdout => $out );
+    $self->wrap_call( commands => [ '--version' ], handles => $handles );
+    my $line = $out->getline;
+    $line =~ /(\d+\.\d+\.\d+)/;
+    return $1;
+}
+
 sub test_default_key_passphrase() {
     my ($self) = @_;
 
@@ -1019,6 +1030,10 @@ while signing a short message using the values of
 the B<passphrase> data member, and the default
 key specified in the B<options> data member.
 
+=item version()
+
+Returns the version of GnuPG that GnuPG::Interface is running.
+
 =back
 
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list