[Bps-public-commit] GnuPG-Interface branch, master, updated. cc816949f8e26073e361f7ef78223052a1a69127
jesse
jesse at bestpractical.com
Thu Sep 24 13:59:08 EDT 2009
The branch, master has been updated
via cc816949f8e26073e361f7ef78223052a1a69127 (commit)
via 1570947b3bf29453c6dcdbe8c97165902adbd775 (commit)
via f64364c929b54534bbbcffe5a9e64f0609189dd7 (commit)
from 76b059c9dd179e0f3f308cc2e016e34cdf831bba (commit)
Summary of changes:
ChangeLog | 4 ++++
Makefile.PL | 13 ++++++++-----
lib/GnuPG/Interface.pm | 35 +++++++++++++++++++++++++++++------
t/MyTestSpecific.pm | 9 ++++++++-
4 files changed, 49 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit f64364c929b54534bbbcffe5a9e64f0609189dd7
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Sep 25 02:52:03 2009 +0900
GnuPg Interface updated for compatibility with GPG 2
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 1efb6b2..6c296da 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -20,7 +20,6 @@ use Carp;
use Fcntl;
use vars qw( $VERSION );
use Fatal qw( open close pipe fcntl );
-use AutoLoader 'AUTOLOAD';
use Class::Struct;
use IO::Handle;
@@ -335,11 +334,7 @@ sub my_fileno {
return $fileno;
}
-__PACKAGE__->meta->make_immutable;
-
-1;
-__END__
###################################################################
@@ -425,6 +420,12 @@ sub get_keys {
$local_id, $owner_trust, $user_id_string
) = @fields[ 1 .. $#fields ];
+
+ # GnuPg 2.x uses epoch time for creation and expiration date strings.
+ # For backward compatibility, we convert them back using GMT;
+ $creation_date_string = $self->_downrez_gpg2_date($creation_date_string);
+ $expiration_date_string = $self->_downrez_gpg2_date($expiration_date_string);
+
$current_key = $current_fingerprinted_key
= $record_type eq 'pub'
? GnuPG::PublicKey->new()
@@ -458,6 +459,7 @@ sub get_keys {
$signature_date_string, $user_id_string
) = @fields[ 3 .. 5, 9 ];
+ $signature_date_string = $self->_downrez_gpg2_date($signature_date_string);
my $signature = GnuPG::Signature->new(
algo_num => $algo_num,
hex_id => $hex_key_id,
@@ -492,6 +494,8 @@ sub get_keys {
$local_id
) = @fields[ 1 .. 7 ];
+ $creation_date_string = $self->_downrez_gpg2_date($creation_date_string);
+ $expiration_date_string = $self->_downrez_gpg2_date($expiration_date_string);
$current_signed_item = $current_fingerprinted_key
= GnuPG::SubKey->new(
validity => $validity,
@@ -520,6 +524,19 @@ sub get_keys {
return @returned_keys;
}
+sub _downrez_gpg2_date {
+ my $self = shift;
+ my $date = shift;
+ if ($date =~ /^\d+$/) {
+ my ($year,$month,$day) = (gmtime($date))[5,4,3];
+ $year += 1900;
+ $month += 1;
+ return sprintf('%04d-%02d-%02d', $year, $month, $day);
+ }
+ return $date;
+}
+
+
################################################################
sub list_public_keys {
@@ -1223,3 +1240,9 @@ GnuPg::Interface is currently maintained by Jesse Vincent <jesse at cpan.org>.
Frank J. Tobin, ftobin at cpan.org was the original author of the package.
=cut
+
+
+__PACKAGE__->meta->make_immutable;
+
+1;
+
commit 1570947b3bf29453c6dcdbe8c97165902adbd775
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Sep 25 02:55:39 2009 +0900
Now search for gpg2 on install and for tests
diff --git a/Makefile.PL b/Makefile.PL
index c46e091..38b8899 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,13 +2,16 @@ use strict;
use warnings;
use inc::Module::Install;
-my $gpg_find = 'which gpg';
-print "$gpg_find ... ";
-system($gpg_find);
-if ( $? != 0 ) {
- die "gpg (GnuPG) not found";
+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 }
}
+
author 'Frank J. Tobin';
abstract 'supply object methods for interacting with GnuPG';
name 'GnuPG-Interface';
diff --git a/t/MyTestSpecific.pm b/t/MyTestSpecific.pm
index 09a2371..629c673 100644
--- a/t/MyTestSpecific.pm
+++ b/t/MyTestSpecific.pm
@@ -39,7 +39,14 @@ use vars qw( @ISA @EXPORT
);
-$gpg_program = 'gpg';
+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',
commit cc816949f8e26073e361f7ef78223052a1a69127
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Sep 25 02:58:58 2009 +0900
0.41_01
diff --git a/ChangeLog b/ChangeLog
index 23ab977..b6f7f8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+0.41_01 Fri Sep 25 02:56:33 JST 2009
+
+ * Beginnings of support for GPG2
+
0.40_04 Tue Apr 21 19:50:12 JST 2009
* Use Any::Moose instead of Moose for Mouse celerity (Sartak)
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 6c296da..11cb4dd 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -26,7 +26,7 @@ use IO::Handle;
use GnuPG::Options;
use GnuPG::Handles;
-$VERSION = '0.40_04';
+$VERSION = '0.41_01';
has $_ => (
isa => 'Any',
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list