[libcrypt-openssl-x509-perl] 01/01: Imported Upstream version 1.8.3
Salvatore Bonaccorso
carnil at debian.org
Thu Aug 15 10:10:12 UTC 2013
This is an automated email from the git hooks/post-receive script.
carnil pushed a commit to annotated tag upstream/1.8.3
in repository libcrypt-openssl-x509-perl.
commit 189863db30289f938c39145495ac6d82970d8e09
Author: Salvatore Bonaccorso <carnil at debian.org>
Date: Thu Aug 15 11:52:36 2013 +0200
Imported Upstream version 1.8.3
---
Changes | 3 +
Makefile.PL | 16 +++-
README | 5 +-
X509.pm | 32 ++++---
X509.xs | 169 ++++++++++++++++++++++++++++++++-----
inc/Module/AutoInstall.pm | 150 +++++++++++++++++++++++++++-----
inc/Module/Install.pm | 6 +-
inc/Module/Install/AutoInstall.pm | 13 ++-
inc/Module/Install/Base.pm | 2 +-
inc/Module/Install/Can.pm | 85 +++++++++++++++++--
inc/Module/Install/Compiler.pm | 2 +-
inc/Module/Install/External.pm | 23 ++++-
inc/Module/Install/Fetch.pm | 2 +-
inc/Module/Install/Include.pm | 2 +-
inc/Module/Install/Makefile.pm | 27 +++---
inc/Module/Install/Metadata.pm | 29 ++++---
inc/Module/Install/Win32.pm | 2 +-
inc/Module/Install/WriteAll.pm | 2 +-
t/x509.t | 5 +-
19 files changed, 467 insertions(+), 108 deletions(-)
diff --git a/Changes b/Changes
index 346ff1a..d6610eb 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Revision history for Perl extension Crypt::OpenSSL::X509.
+1.8.3 Mon Aug 12 05:50:58 PDT 2013
+ - Fix Github Issues #2, 10, 15, 17, 22, 23, 24 & 25
+
1.8.2 Sat May 7 20:19:58 PDT 2011
- Fix warnings under gcc 4.6
diff --git a/Makefile.PL b/Makefile.PL
index 78550ef..69664a6 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,5 +1,7 @@
use inc::Module::Install;
+use Config;
+
name('Crypt-OpenSSL-X509');
license('perl');
perl_version('5.005');
@@ -10,11 +12,17 @@ bugtracker 'https://github.com/dsully/perl-crypt-openssl-x509/issues';
requires_external_cc();
-cc_inc_paths('/usr/include/openssl', '/usr/local/include/ssl', '/usr/local/ssl/include');
-cc_lib_paths('/usr/lib', '/usr/local/lib', '/usr/local/ssl/lib');
+if ($Config::Config{myuname} =~ /^Win(32|64) strawberry-perl\b/) {
+ cc_lib_links("eay$1");
+}
+else {
+ cc_inc_paths('/usr/include/openssl', '/usr/local/include/ssl', '/usr/local/ssl/include');
+ cc_lib_paths('/usr/lib', '/usr/local/lib', '/usr/local/ssl/lib');
+
+ cc_lib_links('crypto');
-cc_lib_links('crypto');
-cc_optimize_flags('-O2 -g -Wall -Werror');
+ cc_optimize_flags('-O2 -g -Wall -Werror');
+}
auto_install();
WriteAll();
diff --git a/README b/README
index e737e6a..a593ee1 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Crypt/OpenSSL/X509 version 1.8.2
+Crypt/OpenSSL/X509 version 1.8.3
===============================
The README is used to introduce the module and provide instructions on
@@ -31,8 +31,7 @@ COPYRIGHT AND LICENCE
Put the correct copyright and licence information here.
-Copyright (C) 2004-2011 Dan Sully
+Copyright (C) 2004-2013 Dan Sully
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-
diff --git a/X509.pm b/X509.pm
index 35b2101..09865dc 100644
--- a/X509.pm
+++ b/X509.pm
@@ -5,19 +5,13 @@ use vars qw($VERSION @EXPORT_OK);
use Exporter;
use base qw(Exporter);
-$VERSION = '1.800.2';
+$VERSION = '1.803';
@EXPORT_OK = qw(
FORMAT_UNDEF FORMAT_ASN1 FORMAT_TEXT FORMAT_PEM FORMAT_NETSCAPE
FORMAT_PKCS12 FORMAT_SMIME FORMAT_ENGINE FORMAT_IISSGC OPENSSL_VERSION_NUMBER
);
-sub Crypt::OpenSSL::X509::bit_length {
- my $x509 = shift;
-
- return length($x509->modulus) * 4; # each character is one hex digit = 4 bits
-}
-
sub Crypt::OpenSSL::X509::has_extension_oid {
my $x509 = shift;
my $oid = shift;
@@ -126,7 +120,7 @@ Crypt::OpenSSL::X509 - Perl extension to OpenSSL's X509 API.
print $x509->exponent() . "\n";
print $x509->fingerprint_sha1() . "\n";
print $x509->fingerprint_md5() . "\n";
- print $x509->as_string(Crypt::OpenSSL::X509::FORMAT_TEXT) . "\n";
+ print $x509->as_string() . "\n";
my $x509 = Crypt::OpenSSL::X509->new_from_string(
$der_encoded_data, Crypt::OpenSSL::X509::FORMAT_ASN1
@@ -134,9 +128,9 @@ Crypt::OpenSSL::X509 - Perl extension to OpenSSL's X509 API.
# given a time offset of $seconds, will the certificate be valid?
if ($x509->checkend($seconds)) {
- # cert is ok at $seconds offset
- } else {
# cert is expired at $seconds offset
+ } else {
+ # cert is ok at $seconds offset
}
my $exts = $x509->extensions_by_oid();
@@ -229,6 +223,14 @@ Certificate version as a string.
Signature algorithm name as a string.
+=item key_alg_name
+
+Public key algorithm name as a string.
+
+=item curve
+
+Name of the EC curve used in the public key.
+
=back
=head2 X509 METHODS
@@ -251,7 +253,7 @@ Return the certificate as a string in the specified format. C<FORMAT> can be one
=item modulus ( )
-Return the modulus for an RSA public key as a string of hex digits. For DSA, return the public key. Other algorithms are not supported.
+Return the modulus for an RSA public key as a string of hex digits. For DSA and EC return the public key. Other algorithms are not supported.
=item bit_length ( )
@@ -265,11 +267,11 @@ Return the specified message digest for the certificate.
=item checkend( OFFSET )
-Given an offset in seconds, will the certificate be expired?
+Given an offset in seconds, will the certificate be expired? Returns True if the certificate will be expired. False otherwise.
=item pubkey ( )
-Return the RSA or DSA public key.
+Return the RSA, DSA, or EC public key.
=item num_extensions ( )
@@ -281,7 +283,9 @@ Return the Extension specified by the integer C<INDEX>.
Methods for handling Extension objects are given below.
=item extensions_by_oid ( )
+
=item extensions_by_name ( )
+
=item extensions_by_long_name ( )
Return a hash of Extensions indexed by OID or name.
@@ -407,7 +411,7 @@ Daniel Kahn Gillmor E<lt>dkg at fifthhorseman.netE<gt>
=head1 COPYRIGHT AND LICENSE
-Copyright 2004-2011 by Dan Sully
+Copyright 2004-2013 by Dan Sully
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
diff --git a/X509.xs b/X509.xs
index cb656aa..ab674c9 100644
--- a/X509.xs
+++ b/X509.xs
@@ -11,6 +11,10 @@
#include <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include <openssl/opensslconf.h>
+#ifndef OPENSSL_NO_EC
+# include <openssl/ec.h>
+#endif
/* from openssl/apps/apps.h */
#define FORMAT_UNDEF 0
@@ -105,7 +109,7 @@ static SV* sv_bio_utf8_on(BIO *bio) {
const U8* cur;
while ((start < end) && !is_utf8_string_loclen(start, len, &cur, 0)) {
- sv_catpvn(nsv, (const char*)start, (cur - start) - 1); /* text that was ok */
+ sv_catpvn(nsv, (const char*)start, (cur - start) + 1); /* text that was ok */
sv_catpvn(nsv, (const char*)utf8_substitute_char, 3); /* insert \x{fffd} */
start = cur + 1;
len = end - cur;
@@ -228,10 +232,10 @@ void _decode_netscape(BIO *bio, X509 *x509) {
os.data = (unsigned char *)NETSCAPE_CERT_HDR;
os.length = strlen(NETSCAPE_CERT_HDR);
ah.header = &os;
- ah.data = x509;
+ ah.data = (char *)x509;
ah.meth = X509_asn1_meth();
- ASN1_i2d_bio((i2d_of_void*)i2d_ASN1_HEADER, bio, (unsigned char *)&ah);
+ ASN1_i2d_bio(i2d_ASN1_HEADER, bio, (unsigned char *)&ah);
#endif
}
@@ -267,6 +271,9 @@ BOOT:
for (i = 0; (name = Crypt__OpenSSL__X509__const[i].n); i++) {
newCONSTSUB(stash, name, newSViv(Crypt__OpenSSL__X509__const[i].v));
}
+
+ ERR_load_crypto_strings();
+ OPENSSL_add_all_algorithms_conf();
}
Crypt::OpenSSL::X509
@@ -364,6 +371,7 @@ accessor(x509)
email = 7
version = 8
sig_alg_name = 9
+ key_alg_name = 10
PREINIT:
BIO *bio;
@@ -422,6 +430,9 @@ accessor(x509)
} else if (ix == 9) {
i2a_ASN1_OBJECT(bio, x509->sig_alg->algorithm);
+ } else if ( ix == 10 ) {
+
+ i2a_ASN1_OBJECT(bio, x509->cert_info->key->algor->algorithm);
}
RETVAL = sv_bio_final(bio);
@@ -503,6 +514,103 @@ as_string(x509, format = FORMAT_PEM)
RETVAL
SV*
+bit_length(x509)
+ Crypt::OpenSSL::X509 x509;
+
+ PREINIT:
+ EVP_PKEY *pkey;
+ int length;
+
+ CODE:
+ pkey = X509_extract_key(x509);
+ if (pkey == NULL) {
+ EVP_PKEY_free(pkey);
+ croak("Public key is unavailable\n");
+ }
+
+ switch(pkey->type) {
+ case EVP_PKEY_RSA:
+ length = BN_num_bits(pkey->pkey.rsa->n);
+ break;
+ case EVP_PKEY_DSA:
+ length = BN_num_bits(pkey->pkey.dsa->p);
+ break;
+#ifndef OPENSSL_NO_EC
+ case EVP_PKEY_EC:
+ {
+ const EC_GROUP *group;
+ BIGNUM* ec_order;
+ ec_order = BN_new();
+ if ( !ec_order ) {
+ EVP_PKEY_free(pkey);
+ croak("Could not malloc bignum");
+ }
+ //
+ if ( (group = EC_KEY_get0_group(pkey->pkey.ec)) == NULL) {
+ EVP_PKEY_free(pkey);
+ croak("No EC group");
+ }
+ //
+ if (!EC_GROUP_get_order(group, ec_order, NULL)) {
+ EVP_PKEY_free(pkey);
+ croak("Could not get ec-group order");
+ }
+ length = BN_num_bits(ec_order);
+ //
+ BN_free(ec_order);
+ break;
+ }
+#endif
+ default:
+ EVP_PKEY_free(pkey);
+ croak("Unknown public key type");
+ }
+
+ RETVAL = newSVuv(length);
+
+ OUTPUT:
+ RETVAL
+
+const char*
+curve(x509)
+ Crypt::OpenSSL::X509 x509;
+
+ CODE:
+#ifdef OPENSSL_NO_EC
+ if ( x509 ) {} // fix unused variable warning.
+ croak("OpenSSL without EC-support");
+#else
+ EVP_PKEY *pkey;
+ pkey = X509_extract_key(x509);
+ if (pkey == NULL) {
+ EVP_PKEY_free(pkey);
+ croak("Public key is unavailable\n");
+ }
+ if ( pkey->type == EVP_PKEY_EC ) {
+ const EC_GROUP *group;
+ int nid;
+ if ( (group = EC_KEY_get0_group(pkey->pkey.ec)) == NULL) {
+ EVP_PKEY_free(pkey);
+ croak("No EC group");
+ }
+ nid = EC_GROUP_get_curve_name(group);
+ if ( nid == 0 ) {
+ EVP_PKEY_free(pkey);
+ croak("invalid nid");
+ }
+ RETVAL = OBJ_nid2sn(nid);
+ } else {
+ EVP_PKEY_free(pkey);
+ croak("Wrong Algorithm type\n");
+ }
+ EVP_PKEY_free(pkey);
+#endif
+
+ OUTPUT:
+ RETVAL
+
+
+SV*
modulus(x509)
Crypt::OpenSSL::X509 x509;
@@ -512,7 +620,7 @@ modulus(x509)
CODE:
- pkey = X509_get_pubkey(x509);
+ pkey = X509_extract_key(x509);
bio = sv_bio_create();
if (pkey == NULL) {
@@ -529,7 +637,24 @@ modulus(x509)
} else if (pkey->type == EVP_PKEY_DSA) {
BN_print(bio, pkey->pkey.dsa->pub_key);
-
+#ifndef OPENSSL_NO_EC
+ } else if ( pkey->type == EVP_PKEY_EC ) {
+ const EC_POINT *public_key;
+ const EC_GROUP *group;
+ BIGNUM *pub_key=NULL;
+ if ( (group = EC_KEY_get0_group(pkey->pkey.ec)) == NULL) {
+ BIO_free_all(bio);
+ EVP_PKEY_free(pkey);
+ croak("No EC group");
+ }
+ public_key = EC_KEY_get0_public_key(pkey->pkey.ec);
+ if ((pub_key = EC_POINT_point2bn(group, public_key, EC_KEY_get_conv_form(pkey->pkey.ec), NULL, NULL)) == NULL) {
+ BIO_free_all(bio);
+ EVP_PKEY_free(pkey);
+ croak("EC library error");
+ }
+ BN_print(bio, pub_key);
+#endif
} else {
BIO_free_all(bio);
@@ -667,7 +792,10 @@ pubkey(x509)
} else if (pkey->type == EVP_PKEY_DSA) {
PEM_write_bio_DSA_PUBKEY(bio, pkey->pkey.dsa);
-
+#ifndef OPENSSL_NO_EC
+ } else if ( pkey->type == EVP_PKEY_EC ) {
+ PEM_write_bio_EC_PUBKEY(bio, pkey->pkey.ec);
+#endif
} else {
BIO_free_all(bio);
@@ -682,20 +810,6 @@ pubkey(x509)
OUTPUT:
RETVAL
-SV*
-pub_exponent(x509)
- Crypt::OpenSSL::X509 x509
- PREINIT:
- EVP_PKEY *pkey;
- BIO *bio;
- CODE:
- bio = sv_bio_create();
- pkey = X509_get_pubkey(x509);
- BN_print(bio,pkey->pkey.rsa->e);
- RETVAL = sv_bio_final(bio);
- OUTPUT:
- RETVAL
-
char*
pubkey_type(x509)
Crypt::OpenSSL::X509 x509;
@@ -704,12 +818,21 @@ pubkey_type(x509)
CODE:
RETVAL=NULL;
pkey = X509_get_pubkey(x509);
- if(pkey->type == EVP_PKEY_DSA){
+
+ if(!pkey)
+ XSRETURN_UNDEF;
+
+ if (pkey->type == EVP_PKEY_DSA) {
RETVAL="dsa";
- }
- else if(pkey->type == EVP_PKEY_RSA){
+
+ } else if (pkey->type == EVP_PKEY_RSA) {
RETVAL="rsa";
+#ifndef OPENSSL_NO_EC
+ } else if ( pkey->type == EVP_PKEY_EC ) {
+ RETVAL="ec";
+#endif
}
+
OUTPUT:
RETVAL
diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
index 60b90ea..aa7aa92 100644
--- a/inc/Module/AutoInstall.pm
+++ b/inc/Module/AutoInstall.pm
@@ -3,11 +3,12 @@ package Module::AutoInstall;
use strict;
use Cwd ();
+use File::Spec ();
use ExtUtils::MakeMaker ();
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.03';
+ $VERSION = '1.06';
}
# special map on pre-defined feature sets
@@ -17,11 +18,14 @@ my %FeatureMap = (
);
# various lexical flags
-my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
+my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $InstallDepsTarget, $HasCPANPLUS );
my (
- $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
+ $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps,
+ $UpgradeDeps
);
-my ( $PostambleActions, $PostambleUsed );
+my ( $PostambleActions, $PostambleActionsNoTest, $PostambleActionsUpgradeDeps,
+ $PostambleActionsUpgradeDepsNoTest, $PostambleActionsListDeps,
+ $PostambleActionsListAllDeps, $PostambleUsed, $NoTest);
# See if it's a testing or non-interactive session
_accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN );
@@ -31,6 +35,10 @@ sub _accept_default {
$AcceptDefault = shift;
}
+sub _installdeps_target {
+ $InstallDepsTarget = shift;
+}
+
sub missing_modules {
return @Missing;
}
@@ -63,6 +71,11 @@ sub _init {
__PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
exit 0;
}
+ elsif ( $arg =~ /^--upgradedeps=(.*)$/ ) {
+ $UpgradeDeps = 1;
+ __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
+ exit 0;
+ }
elsif ( $arg =~ /^--default(?:deps)?$/ ) {
$AcceptDefault = 1;
}
@@ -125,7 +138,7 @@ sub import {
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
- $UnderCPAN = _check_lock(1) unless $SkipInstall;
+ $UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
@@ -175,7 +188,7 @@ sub import {
}
# XXX: check for conflicts and uninstalls(!) them.
- my $cur = _load($mod);
+ my $cur = _version_of($mod);
if (_version_cmp ($cur, $arg) >= 0)
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
@@ -207,6 +220,7 @@ sub import {
$CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
+ or $InstallDepsTarget
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
@@ -237,10 +251,17 @@ sub import {
}
}
- if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
+ if ( @Missing and not( $CheckOnly or $UnderCPAN) ) {
require Config;
- print
-"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
+ my $make = $Config::Config{make};
+ if ($InstallDepsTarget) {
+ print
+"*** To install dependencies type '$make installdeps' or '$make installdeps_notest'.\n";
+ }
+ else {
+ print
+"*** Dependencies will be installed the next time you type '$make'.\n";
+ }
# make an educated guess of whether we'll need root permission.
print " (You may need to do that as the 'root' user.)\n"
@@ -271,6 +292,10 @@ END_MESSAGE
sub _check_lock {
return unless @Missing or @_;
+ if ($ENV{PERL5_CPANM_IS_RUNNING}) {
+ return _running_under('cpanminus');
+ }
+
my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
@@ -324,7 +349,7 @@ sub install {
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed
- if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
+ if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
else {
@@ -332,6 +357,11 @@ sub install {
}
}
+ if ($UpgradeDeps) {
+ push @modules, @installed;
+ @installed = ();
+ }
+
return @installed unless @modules; # nothing to do
return @installed if _check_lock(); # defer to the CPAN shell
@@ -363,7 +393,7 @@ sub install {
# see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
- if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
+ if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
@@ -463,6 +493,11 @@ sub _cpanplus_config {
} else {
die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n";
}
+ push @config, 'prereqs', $value;
+ } elsif ( $key eq 'force' ) {
+ push @config, $key, $value;
+ } elsif ( $key eq 'notest' ) {
+ push @config, 'skiptest', $value;
} else {
die "*** Cannot convert option $key to CPANPLUS version.\n";
}
@@ -497,10 +532,14 @@ sub _install_cpan {
# set additional options
while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) {
( $args{$opt} = $arg, next )
- if $opt =~ /^force$/; # pseudo-option
+ if $opt =~ /^(?:force|notest)$/; # pseudo-option
$CPAN::Config->{$opt} = $arg;
}
+ if ($args{notest} && (not CPAN::Shell->can('notest'))) {
+ die "Your version of CPAN is too old to support the 'notest' pragma";
+ }
+
local $CPAN::Config->{prerequisites_policy} = 'follow';
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
@@ -519,8 +558,16 @@ sub _install_cpan {
delete $INC{$inc};
}
- my $rv = $args{force} ? CPAN::Shell->force( install => $pkg )
- : CPAN::Shell->install($pkg);
+ my $rv = do {
+ if ($args{force}) {
+ CPAN::Shell->force( install => $pkg )
+ } elsif ($args{notest}) {
+ CPAN::Shell->notest( install => $pkg )
+ } else {
+ CPAN::Shell->install($pkg)
+ }
+ };
+
$rv ||= eval {
$CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, )
->{install}
@@ -575,7 +622,7 @@ sub _update_to {
my $ver = shift;
return
- if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
+ if _version_cmp( _version_of($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
@@ -660,16 +707,30 @@ sub _can_write {
# load a module and return the version it reports
sub _load {
- my $mod = pop; # class/instance doesn't matter
+ my $mod = pop; # method/function doesn't matter
my $file = $mod;
-
$file =~ s|::|/|g;
$file .= '.pm';
-
local $@;
return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 );
}
+# report version without loading a module
+sub _version_of {
+ my $mod = pop; # method/function doesn't matter
+ my $file = $mod;
+ $file =~ s|::|/|g;
+ $file .= '.pm';
+ foreach my $dir ( @INC ) {
+ next if ref $dir;
+ my $path = File::Spec->catfile($dir, $file);
+ next unless -e $path;
+ require ExtUtils::MM_Unix;
+ return ExtUtils::MM_Unix->parse_version($path);
+ }
+ return undef;
+}
+
# Load CPAN.pm and it's configuration
sub _load_cpan {
return if $CPAN::VERSION and $CPAN::Config and not @_;
@@ -763,6 +824,35 @@ sub _make_args {
: "\$(NOECHO) \$(NOOP)"
);
+ my $deps_list = join( ',', @Missing, @Existing );
+
+ $PostambleActionsUpgradeDeps =
+ "\$(PERL) $0 --config=$config --upgradedeps=$deps_list";
+
+ my $config_notest =
+ join( ',', (UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config}),
+ 'notest', 1 )
+ if $Config;
+
+ $PostambleActionsNoTest = (
+ ($missing and not $UnderCPAN)
+ ? "\$(PERL) $0 --config=$config_notest --installdeps=$missing"
+ : "\$(NOECHO) \$(NOOP)"
+ );
+
+ $PostambleActionsUpgradeDepsNoTest =
+ "\$(PERL) $0 --config=$config_notest --upgradedeps=$deps_list";
+
+ $PostambleActionsListDeps =
+ '@$(PERL) -le "print for @ARGV" '
+ . join(' ', map $Missing[$_], grep $_ % 2 == 0, 0..$#Missing);
+
+ my @all = (@Missing, @Existing);
+
+ $PostambleActionsListAllDeps =
+ '@$(PERL) -le "print for @ARGV" '
+ . join(' ', map $all[$_], grep $_ % 2 == 0, 0..$#all);
+
return %args;
}
@@ -797,11 +887,15 @@ sub Write {
sub postamble {
$PostambleUsed = 1;
+ my $fragment;
- return <<"END_MAKE";
+ $fragment .= <<"AUTO_INSTALL" if !$InstallDepsTarget;
config :: installdeps
\t\$(NOECHO) \$(NOOP)
+AUTO_INSTALL
+
+ $fragment .= <<"END_MAKE";
checkdeps ::
\t\$(PERL) $0 --checkdeps
@@ -809,12 +903,28 @@ checkdeps ::
installdeps ::
\t$PostambleActions
+installdeps_notest ::
+\t$PostambleActionsNoTest
+
+upgradedeps ::
+\t$PostambleActionsUpgradeDeps
+
+upgradedeps_notest ::
+\t$PostambleActionsUpgradeDepsNoTest
+
+listdeps ::
+\t$PostambleActionsListDeps
+
+listalldeps ::
+\t$PostambleActionsListAllDeps
+
END_MAKE
+ return $fragment;
}
1;
__END__
-#line 1071
+#line 1193
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 8ee839d..4ecf46b 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.00';
+ $VERSION = '1.06';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -451,7 +451,7 @@ sub _version ($) {
}
sub _cmp ($$) {
- _version($_[0]) <=> _version($_[1]);
+ _version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
@@ -467,4 +467,4 @@ sub _CLASS ($) {
1;
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2012 Adam Kennedy.
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index f1f5356..6efe4fe 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -73,6 +73,17 @@ sub auto_install {
);
}
+sub installdeps_target {
+ my ($self, @args) = @_;
+
+ $self->include('Module::AutoInstall');
+ require Module::AutoInstall;
+
+ Module::AutoInstall::_installdeps_target(1);
+
+ $self->auto_install(@args);
+}
+
sub auto_install_now {
my $self = shift;
$self->auto_install(@_);
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b55bda3..802844a 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 71ccc27..22167b8 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -3,13 +3,12 @@ package Module::Install::Can;
use strict;
use Config ();
-use File::Spec ();
use ExtUtils::MakeMaker ();
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -29,7 +28,7 @@ sub can_use {
eval { require $mod; $pkg->VERSION($ver || 0); 1 };
}
-# check if we can run some command
+# Check if we can run some command
sub can_run {
my ($self, $cmd) = @_;
@@ -38,14 +37,88 @@ sub can_run {
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
next if $dir eq '';
- my $abs = File::Spec->catfile($dir, $_[1]);
+ require File::Spec;
+ my $abs = File::Spec->catfile($dir, $cmd);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
return;
}
-# can we locate a (the) C compiler
+# Can our C compiler environment build XS files
+sub can_xs {
+ my $self = shift;
+
+ # Ensure we have the CBuilder module
+ $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
+
+ # Do we have the configure_requires checker?
+ local $@;
+ eval "require ExtUtils::CBuilder;";
+ if ( $@ ) {
+ # They don't obey configure_requires, so it is
+ # someone old and delicate. Try to avoid hurting
+ # them by falling back to an older simpler test.
+ return $self->can_cc();
+ }
+
+ # Do we have a working C compiler
+ my $builder = ExtUtils::CBuilder->new(
+ quiet => 1,
+ );
+ unless ( $builder->have_compiler ) {
+ # No working C compiler
+ return 0;
+ }
+
+ # Write a C file representative of what XS becomes
+ require File::Temp;
+ my ( $FH, $tmpfile ) = File::Temp::tempfile(
+ "compilexs-XXXXX",
+ SUFFIX => '.c',
+ );
+ binmode $FH;
+ print $FH <<'END_C';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int main(int argc, char **argv) {
+ return 0;
+}
+
+int boot_sanexs() {
+ return 1;
+}
+
+END_C
+ close $FH;
+
+ # Can the C compiler access the same headers XS does
+ my @libs = ();
+ my $object = undef;
+ eval {
+ local $^W = 0;
+ $object = $builder->compile(
+ source => $tmpfile,
+ );
+ @libs = $builder->link(
+ objects => $object,
+ module_name => 'sanexs',
+ );
+ };
+ my $result = $@ ? 0 : 1;
+
+ # Clean up all the build files
+ foreach ( $tmpfile, $object, @libs ) {
+ next unless defined $_;
+ 1 while unlink;
+ }
+
+ return $result;
+}
+
+# Can we locate a (the) C compiler
sub can_cc {
my $self = shift;
my @chunks = split(/ /, $Config::Config{cc}) or return;
@@ -78,4 +151,4 @@ if ( $^O eq 'cygwin' ) {
__END__
-#line 156
+#line 236
diff --git a/inc/Module/Install/Compiler.pm b/inc/Module/Install/Compiler.pm
index 747dd14..ada2475 100644
--- a/inc/Module/Install/Compiler.pm
+++ b/inc/Module/Install/Compiler.pm
@@ -7,7 +7,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/External.pm b/inc/Module/Install/External.pm
index 5e29f10..53522d6 100644
--- a/inc/Module/Install/External.pm
+++ b/inc/Module/Install/External.pm
@@ -8,11 +8,28 @@ use Module::Install::Base ();
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
+sub requires_xs {
+ my $self = shift;
+
+ # First check for the basic C compiler
+ $self->requires_external_cc;
+
+ # We need a C compiler that can build XS files
+ unless ( $self->can_xs ) {
+ print "Unresolvable missing external dependency.\n";
+ print "This package requires perl's header files.\n";
+ print STDERR "NA: Unable to build distribution on this platform.\n";
+ exit(0);
+ }
+
+ 1;
+}
+
sub requires_external_cc {
my $self = shift;
@@ -41,7 +58,7 @@ sub requires_external_bin {
$self->load('can_run');
# Locate the bin
- print "Locating required external dependency bin:$bin...";
+ print "Locating bin:$bin...";
my $found_bin = $self->can_run( $bin );
if ( $found_bin ) {
print " found at $found_bin.\n";
@@ -63,4 +80,4 @@ sub requires_external_bin {
__END__
-#line 138
+#line 171
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index ec1f106..bee0c4f 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index a28cd4c..8310e4c 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 5dfd0e9..7052f36 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -215,18 +215,22 @@ sub write {
require ExtUtils::MakeMaker;
if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
- # MakeMaker can complain about module versions that include
- # an underscore, even though its own version may contain one!
- # Hence the funny regexp to get rid of it. See RT #35800
- # for details.
- my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
- $self->build_requires( 'ExtUtils::MakeMaker' => $v );
- $self->configure_requires( 'ExtUtils::MakeMaker' => $v );
+ # This previous attempted to inherit the version of
+ # ExtUtils::MakeMaker in use by the module author, but this
+ # was found to be untenable as some authors build releases
+ # using future dev versions of EU:MM that nobody else has.
+ # Instead, #toolchain suggests we use 6.59 which is the most
+ # stable version on CPAN at time of writing and is, to quote
+ # ribasushi, "not terminally fucked, > and tested enough".
+ # TODO: We will now need to maintain this over time to push
+ # the version up as new versions are released.
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
} else {
# Allow legacy-compatibility with 5.005 by depending on the
# most recent EU:MM that supported 5.005.
- $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
- $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
}
# Generate the MakeMaker params
@@ -241,7 +245,6 @@ in a module, and provide its file path via 'version_from' (or
'all_from' if you prefer) in Makefile.PL.
EOT
- $DB::single = 1;
if ( $self->tests ) {
my @tests = split ' ', $self->tests;
my %seen;
@@ -412,4 +415,4 @@ sub postamble {
__END__
-#line 541
+#line 544
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index cfe45b3..58430f3 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -151,15 +151,21 @@ sub install_as_site { $_[0]->installdirs('site') }
sub install_as_vendor { $_[0]->installdirs('vendor') }
sub dynamic_config {
- my $self = shift;
- unless ( @_ ) {
- warn "You MUST provide an explicit true/false value to dynamic_config\n";
- return $self;
+ my $self = shift;
+ my $value = @_ ? shift : 1;
+ if ( $self->{values}->{dynamic_config} ) {
+ # Once dynamic we never change to static, for safety
+ return 0;
}
- $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
+ $self->{values}->{dynamic_config} = $value ? 1 : 0;
return 1;
}
+# Convenience command
+sub static_config {
+ shift->dynamic_config(0);
+}
+
sub perl_version {
my $self = shift;
return $self->{values}->{perl_version} unless @_;
@@ -170,7 +176,7 @@ sub perl_version {
# Normalize the version
$version = $self->_perl_version($version);
- # We don't support the reall old versions
+ # We don't support the really old versions
unless ( $version >= 5.005 ) {
die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
}
@@ -515,6 +521,7 @@ sub __extract_license {
'GNU Free Documentation license' => 'unrestricted', 1,
'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
+ 'Artistic license 2\.0' => 'artistic_2', 1,
'Artistic license' => 'artistic', 1,
'Apache (?:Software )?license' => 'apache', 1,
'GPL' => 'gpl', 1,
@@ -550,9 +557,9 @@ sub license_from {
sub _extract_bugtracker {
my @links = $_[0] =~ m#L<(
- \Qhttp://rt.cpan.org/\E[^>]+|
- \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
- \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+ https?\Q://rt.cpan.org/\E[^>]+|
+ https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+ https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
)>#gx;
my %links;
@links{@links}=();
@@ -581,7 +588,7 @@ sub bugtracker_from {
sub requires_from {
my $self = shift;
my $content = Module::Install::_readperl($_[0]);
- my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+ my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index edc18b4..eeaa3fe 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index d0f6599..85d8018 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '1.06';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/t/utf8.t b/t/utf8.t
old mode 100755
new mode 100644
diff --git a/t/x509.t b/t/x509.t
old mode 100755
new mode 100644
index 21dec61..d249cc5
--- a/t/x509.t
+++ b/t/x509.t
@@ -1,5 +1,5 @@
-use Test::More tests => 49;
+use Test::More tests => 50;
BEGIN { use_ok('Crypt::OpenSSL::X509') };
@@ -32,7 +32,8 @@ ok($x509->email() eq 'server-certs at thawte.com', 'email()');
is($x509->version, '02', 'version');
-is($x509->sig_alg_name, 'md5WithRSAEncryption', 'version');
+is($x509->sig_alg_name, 'md5WithRSAEncryption', 'signature algorithm');
+is($x509->key_alg_name, 'rsaEncryption', 'key algorithm');
is($x509->bit_length, 1024, 'bit_length()');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcrypt-openssl-x509-perl.git
More information about the Pkg-perl-cvs-commits
mailing list