Skip to content

Commit 8d848e5

Browse files
committed
* Release 0.62.
1 parent c04ce72 commit 8d848e5

File tree

18 files changed

+953
-299
lines changed

18 files changed

+953
-299
lines changed

Changes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
[Changes for 0.62 - Fri Nov 2 20:59:28 CST 2012]
2+
3+
* Support for gpg under these alternate names:
4+
5+
gpg gpg2 gnupg gnupg2
6+
7+
Contributed by: Michael Schwern
8+
19
[Changes for 0.61 - 2009年11月19日 周四 00時56分41秒 CST]
210

311
* Added "=encoding utf8" to POD to fix author name display.

META.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ abstract: 'Module signature file manipulation'
33
author:
44
- '唐鳳 <[email protected]>'
55
build_requires:
6-
ExtUtils::MakeMaker: 6.42
6+
ExtUtils::MakeMaker: 6.36
77
Test::More: 0
88
configure_requires:
9-
ExtUtils::MakeMaker: 6.42
9+
ExtUtils::MakeMaker: 6.36
1010
distribution_type: module
11-
generated_by: 'Module::Install version 0.91'
12-
license: CC0
11+
dynamic_config: 1
12+
generated_by: 'Module::Install version 1.06'
13+
license: cc0
1314
meta-spec:
1415
url: http://module-build.sourceforge.net/META-spec-v1.4.html
1516
version: 1.4
@@ -23,4 +24,4 @@ requires:
2324
perl: 5.005
2425
resources:
2526
repository: http://github.com/audreyt/module-signature
26-
version: 0.61
27+
version: 0.62

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ NAME
22
Module::Signature - Module signature file manipulation
33

44
VERSION
5-
This document describes version 0.61 of Module::Signature, released
6-
November 18, 2009.
5+
This document describes version 0.62 of Module::Signature, released
6+
November 2, 2012.
77

88
SYNOPSIS
99
As a shell command:

inc/Module/AutoInstall.pm

Lines changed: 146 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package Module::AutoInstall;
33

44
use strict;
55
use Cwd ();
6+
use File::Spec ();
67
use ExtUtils::MakeMaker ();
78

89
use vars qw{$VERSION};
910
BEGIN {
10-
$VERSION = '1.03';
11+
$VERSION = '1.06';
1112
}
1213

1314
# special map on pre-defined feature sets
@@ -17,11 +18,14 @@ my %FeatureMap = (
1718
);
1819

1920
# various lexical flags
20-
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
21+
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $InstallDepsTarget, $HasCPANPLUS );
2122
my (
22-
$Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
23+
$Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps,
24+
$UpgradeDeps
2325
);
24-
my ( $PostambleActions, $PostambleUsed );
26+
my ( $PostambleActions, $PostambleActionsNoTest, $PostambleActionsUpgradeDeps,
27+
$PostambleActionsUpgradeDepsNoTest, $PostambleActionsListDeps,
28+
$PostambleActionsListAllDeps, $PostambleUsed, $NoTest);
2529

2630
# See if it's a testing or non-interactive session
2731
_accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN );
@@ -31,6 +35,10 @@ sub _accept_default {
3135
$AcceptDefault = shift;
3236
}
3337

38+
sub _installdeps_target {
39+
$InstallDepsTarget = shift;
40+
}
41+
3442
sub missing_modules {
3543
return @Missing;
3644
}
@@ -63,6 +71,11 @@ sub _init {
6371
__PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
6472
exit 0;
6573
}
74+
elsif ( $arg =~ /^--upgradedeps=(.*)$/ ) {
75+
$UpgradeDeps = 1;
76+
__PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
77+
exit 0;
78+
}
6679
elsif ( $arg =~ /^--default(?:deps)?$/ ) {
6780
$AcceptDefault = 1;
6881
}
@@ -125,7 +138,7 @@ sub import {
125138
# check entirely since we don't want to have to load (and configure)
126139
# an old CPAN just for a cosmetic message
127140

128-
$UnderCPAN = _check_lock(1) unless $SkipInstall;
141+
$UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;
129142

130143
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
131144
my ( @required, @tests, @skiptests );
@@ -175,7 +188,7 @@ sub import {
175188
}
176189

177190
# XXX: check for conflicts and uninstalls(!) them.
178-
my $cur = _load($mod);
191+
my $cur = _version_of($mod);
179192
if (_version_cmp ($cur, $arg) >= 0)
180193
{
181194
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
@@ -207,6 +220,7 @@ sub import {
207220
$CheckOnly
208221
or ($mandatory and $UnderCPAN)
209222
or $AllDeps
223+
or $InstallDepsTarget
210224
or _prompt(
211225
qq{==> Auto-install the }
212226
. ( @required / 2 )
@@ -237,10 +251,17 @@ sub import {
237251
}
238252
}
239253

240-
if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
254+
if ( @Missing and not( $CheckOnly or $UnderCPAN) ) {
241255
require Config;
242-
print
243-
"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
256+
my $make = $Config::Config{make};
257+
if ($InstallDepsTarget) {
258+
print
259+
"*** To install dependencies type '$make installdeps' or '$make installdeps_notest'.\n";
260+
}
261+
else {
262+
print
263+
"*** Dependencies will be installed the next time you type '$make'.\n";
264+
}
244265

245266
# make an educated guess of whether we'll need root permission.
246267
print " (You may need to do that as the 'root' user.)\n"
@@ -253,6 +274,8 @@ sub import {
253274
# import to main::
254275
no strict 'refs';
255276
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
277+
278+
return (@Existing, @Missing);
256279
}
257280

258281
sub _running_under {
@@ -269,6 +292,10 @@ END_MESSAGE
269292
sub _check_lock {
270293
return unless @Missing or @_;
271294

295+
if ($ENV{PERL5_CPANM_IS_RUNNING}) {
296+
return _running_under('cpanminus');
297+
}
298+
272299
my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
273300

274301
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
@@ -322,14 +349,19 @@ sub install {
322349
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
323350

324351
# grep out those already installed
325-
if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
352+
if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
326353
push @installed, $pkg;
327354
}
328355
else {
329356
push @modules, $pkg, $ver;
330357
}
331358
}
332359

360+
if ($UpgradeDeps) {
361+
push @modules, @installed;
362+
@installed = ();
363+
}
364+
333365
return @installed unless @modules; # nothing to do
334366
return @installed if _check_lock(); # defer to the CPAN shell
335367

@@ -361,7 +393,7 @@ sub install {
361393

362394
# see if we have successfully installed them
363395
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
364-
if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
396+
if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
365397
push @installed, $pkg;
366398
}
367399
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
@@ -461,6 +493,11 @@ sub _cpanplus_config {
461493
} else {
462494
die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n";
463495
}
496+
push @config, 'prereqs', $value;
497+
} elsif ( $key eq 'force' ) {
498+
push @config, $key, $value;
499+
} elsif ( $key eq 'notest' ) {
500+
push @config, 'skiptest', $value;
464501
} else {
465502
die "*** Cannot convert option $key to CPANPLUS version.\n";
466503
}
@@ -495,10 +532,14 @@ sub _install_cpan {
495532
# set additional options
496533
while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) {
497534
( $args{$opt} = $arg, next )
498-
if $opt =~ /^force$/; # pseudo-option
535+
if $opt =~ /^(?:force|notest)$/; # pseudo-option
499536
$CPAN::Config->{$opt} = $arg;
500537
}
501538

539+
if ($args{notest} && (not CPAN::Shell->can('notest'))) {
540+
die "Your version of CPAN is too old to support the 'notest' pragma";
541+
}
542+
502543
local $CPAN::Config->{prerequisites_policy} = 'follow';
503544

504545
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
@@ -517,8 +558,16 @@ sub _install_cpan {
517558
delete $INC{$inc};
518559
}
519560

520-
my $rv = $args{force} ? CPAN::Shell->force( install => $pkg )
521-
: CPAN::Shell->install($pkg);
561+
my $rv = do {
562+
if ($args{force}) {
563+
CPAN::Shell->force( install => $pkg )
564+
} elsif ($args{notest}) {
565+
CPAN::Shell->notest( install => $pkg )
566+
} else {
567+
CPAN::Shell->install($pkg)
568+
}
569+
};
570+
522571
$rv ||= eval {
523572
$CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, )
524573
->{install}
@@ -573,7 +622,7 @@ sub _update_to {
573622
my $ver = shift;
574623

575624
return
576-
if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
625+
if _version_cmp( _version_of($class), $ver ) >= 0; # no need to upgrade
577626

578627
if (
579628
_prompt( "==> A newer version of $class ($ver) is required. Install?",
@@ -658,21 +707,48 @@ sub _can_write {
658707

659708
# load a module and return the version it reports
660709
sub _load {
661-
my $mod = pop; # class/instance doesn't matter
710+
my $mod = pop; # method/function doesn't matter
662711
my $file = $mod;
663-
664712
$file =~ s|::|/|g;
665713
$file .= '.pm';
666-
667714
local $@;
668715
return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 );
669716
}
670717

718+
# report version without loading a module
719+
sub _version_of {
720+
my $mod = pop; # method/function doesn't matter
721+
my $file = $mod;
722+
$file =~ s|::|/|g;
723+
$file .= '.pm';
724+
foreach my $dir ( @INC ) {
725+
next if ref $dir;
726+
my $path = File::Spec->catfile($dir, $file);
727+
next unless -e $path;
728+
require ExtUtils::MM_Unix;
729+
return ExtUtils::MM_Unix->parse_version($path);
730+
}
731+
return undef;
732+
}
733+
671734
# Load CPAN.pm and it's configuration
672735
sub _load_cpan {
673736
return if $CPAN::VERSION and $CPAN::Config and not @_;
674737
require CPAN;
675-
if ( $CPAN::HandleConfig::VERSION ) {
738+
739+
# CPAN-1.82+ adds CPAN::Config::AUTOLOAD to redirect to
740+
# CPAN::HandleConfig->load. CPAN reports that the redirection
741+
# is deprecated in a warning printed at the user.
742+
743+
# CPAN-1.81 expects CPAN::HandleConfig->load, does not have
744+
# $CPAN::HandleConfig::VERSION but cannot handle
745+
# CPAN::Config->load
746+
747+
# Which "versions expect CPAN::Config->load?
748+
749+
if ( $CPAN::HandleConfig::VERSION
750+
|| CPAN::HandleConfig->can('load')
751+
) {
676752
# Newer versions of CPAN have a HandleConfig module
677753
CPAN::HandleConfig->load;
678754
} else {
@@ -748,6 +824,35 @@ sub _make_args {
748824
: "\$(NOECHO) \$(NOOP)"
749825
);
750826

827+
my $deps_list = join( ',', @Missing, @Existing );
828+
829+
$PostambleActionsUpgradeDeps =
830+
"\$(PERL) $0 --config=$config --upgradedeps=$deps_list";
831+
832+
my $config_notest =
833+
join( ',', (UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config}),
834+
'notest', 1 )
835+
if $Config;
836+
837+
$PostambleActionsNoTest = (
838+
($missing and not $UnderCPAN)
839+
? "\$(PERL) $0 --config=$config_notest --installdeps=$missing"
840+
: "\$(NOECHO) \$(NOOP)"
841+
);
842+
843+
$PostambleActionsUpgradeDepsNoTest =
844+
"\$(PERL) $0 --config=$config_notest --upgradedeps=$deps_list";
845+
846+
$PostambleActionsListDeps =
847+
'@$(PERL) -le "print for @ARGV" '
848+
. join(' ', map $Missing[$_], grep $_ % 2 == 0, 0..$#Missing);
849+
850+
my @all = (@Missing, @Existing);
851+
852+
$PostambleActionsListAllDeps =
853+
'@$(PERL) -le "print for @ARGV" '
854+
. join(' ', map $all[$_], grep $_ % 2 == 0, 0..$#all);
855+
751856
return %args;
752857
}
753858

@@ -782,24 +887,44 @@ sub Write {
782887

783888
sub postamble {
784889
$PostambleUsed = 1;
890+
my $fragment;
785891

786-
return <<"END_MAKE";
892+
$fragment .= <<"AUTO_INSTALL" if !$InstallDepsTarget;
787893
788894
config :: installdeps
789895
\t\$(NOECHO) \$(NOOP)
896+
AUTO_INSTALL
897+
898+
$fragment .= <<"END_MAKE";
790899
791900
checkdeps ::
792901
\t\$(PERL) $0 --checkdeps
793902
794903
installdeps ::
795904
\t$PostambleActions
796905
906+
installdeps_notest ::
907+
\t$PostambleActionsNoTest
908+
909+
upgradedeps ::
910+
\t$PostambleActionsUpgradeDeps
911+
912+
upgradedeps_notest ::
913+
\t$PostambleActionsUpgradeDepsNoTest
914+
915+
listdeps ::
916+
\t$PostambleActionsListDeps
917+
918+
listalldeps ::
919+
\t$PostambleActionsListAllDeps
920+
797921
END_MAKE
798922

923+
return $fragment;
799924
}
800925

801926
1;
802927

803928
__END__
804929
805-
#line 1056
930+
#line 1193

0 commit comments

Comments
 (0)