Codebase list libmodule-signature-perl / a6804dd
Imported Upstream version 0.73 Salvatore Bonaccorso 10 years ago
17 changed file(s) with 358 addition(s) and 99 deletion(s). Raw diff Collapse all Expand all
0 [Changes for 0.73 - Wed Jun 5 23:44:57 CST 2013]
1
2 * Properly redo the previous fix using File::Spec->file_name_is_absolute.
3
4 [Changes for 0.72 - Wed Jun 5 23:19:02 CST 2013]
5
6 * Only allow loading Digest::* from absolute paths in @INC,
7 by ensuring they begin with \ or / characters.
8
9 Contributed by: Florian Weimer (CVE-2013-2145)
10
11 [Changes for 0.71 - Tue Jun 4 18:24:10 CST 2013]
12
13 * Constrain the user-specified digest name to /^\w+\d+$/.
14
15 * Avoid loading Digest::* from relative paths in @INC.
16
17 Contributed by: Florian Weimer (CVE-2013-2145)
18
19 [Changes for 0.70 - Thu Nov 29 01:45:54 CST 2012]
20
21 * Don't check gpg version if gpg does not exist.
22
23 This avoids unnecessary warnings during installation
24 when gpg executable is not installed.
25
26 Contributed by: Kenichi Ishigaki
27
28 [Changes for 0.69 - Fri Nov 2 23:04:19 CST 2012]
29
30 * Support for gpg under these alternate names:
31
32 gpg gpg2 gnupg gnupg2
33
34 Contributed by: Michael Schwern
35
036 [Changes for 0.68 - Fri, 13 May 2011 11:51:50 +0200]
137
238 * Fix breakage introduced by 0.67 (Andreas König).
22 author:
33 - '唐鳳 <cpan@audreyt.org>'
44 build_requires:
5 ExtUtils::MakeMaker: 6.42
5 ExtUtils::MakeMaker: 6.36
66 IPC::Run: 0
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 1.00'
11 dynamic_config: 1
12 generated_by: 'Module::Install version 1.06'
1213 license: cc0
1314 meta-spec:
1415 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2324 perl: 5.005
2425 resources:
2526 repository: http://github.com/audreyt/module-signature
26 version: 0.68
27 version: 0.73
0 use strict;
01 use inc::Module::Install 0.92;
12
23 $|++;
6566 # dependencies so they will upgrade as needed.
6667 requires( @OPEN_PGP );
6768
68 } elsif ( locate_gpg() ) {
69 } elsif ( my $gpg = locate_gpg() ) {
6970 # We SHOULD have gpg, double-check formally
70 requires_external_bin 'gpg';
71
71 requires_external_bin $gpg;
7272 } elsif ( can_cc() and $ENV{AUTOMATED_TESTING} ) {
7373 # Dive headlong into a full Crypt::OpenPGP install.
7474 requires( @OPEN_PGP );
9797 sub locate_gpg {
9898 print "Looking for GNU Privacy Guard (gpg), a cryptographic signature tool...\n";
9999
100 my $gpg = can_run('gpg');
101 my $has_gpg = (
102 $gpg and
103 `gpg --version` =~ /GnuPG/
104 );
105
106 unless ( $has_gpg ) {
100 my ($gpg, $gpg_path);
101 for my $gpg_bin ('gpg', 'gpg2', 'gnupg', 'gnupg2') {
102 $gpg_path = can_run($gpg_bin);
103 next unless $gpg_path;
104 next unless `$gpg_bin --version` =~ /GnuPG/;
105 next unless defined `$gpg_bin --list-public-keys`;
106
107 $gpg = $gpg_bin;
108 last;
109 }
110 unless ( $gpg ) {
107111 print "gpg not found.\n";
108112 return;
109113 }
110114
111 print "GnuPG found ($gpg).\n";
115 print "GnuPG found ($gpg_path).\n";
112116
113117 return 1 if grep { /^--installdeps/} @ARGV;
114118
115119 if ( prompt("Import PAUSE and author keys to GnuPG?", 'y' ) =~ /^y/i) {
116120 print 'Importing... ';
117 system 'gpg', '--quiet', '--import', glob('*.pub');
121 system $gpg, '--quiet', '--import', glob('*.pub');
118122 print "done.\n";
119123 }
120124
121 return 1;
125 return $gpg;
122126 }
123127
124128 sub ask_user {
244244
245245 Module::Install, ExtUtils::MakeMaker, Module::Build
246246
247 Dist::Zilla::Plugin::Signature
248
247249 AUTHORS
248250 唐鳳 <cpan@audreyt.org>
249251
00 This file contains message digests of all files listed in MANIFEST,
1 signed via the Module::Signature module, version 0.68.
1 signed via the Module::Signature module, version 0.73.
22
33 To verify the content in this distribution, first make sure you have
44 Module::Signature installed, then type:
1515
1616 SHA1 0b722678d07c66ef6992f2cc2c9e9acf3bef0ecb AUDREY2006.pub
1717 SHA1 1e2b550757ebdf3ef2c0e8d1d06bcbb9c6b62a6f AUTHORS
18 SHA1 9dcc6558459cdbe474dcf325eb9e8eeb68815897 Changes
18 SHA1 fb3ceeacbd691a2dfa63f0b22be04eb67817971c Changes
1919 SHA1 366ad23151d9113e37f4a9edd4d3304ecc30b9d6 MANIFEST
2020 SHA1 af1667da11736451592aeba46d34e38c47a7201c MANIFEST.SKIP
21 SHA1 f38db924b0216aaff4ccf18247a62997acb447ce META.yml
22 SHA1 0024aa3f23ac84a928c4063e9435ca1607984e7e Makefile.PL
21 SHA1 1728bd49673df420cf1be5a93e8e95bfa6ad18ad META.yml
22 SHA1 3670c5391c41935eb113a75dcf190646a83eb553 Makefile.PL
2323 SHA1 37e858c51409a297ef5d3fb35dc57cd3b57f9a4d PAUSE2003.pub
24 SHA1 955ba924e9cd1bafccb4d6d7bd3be25c3ce8bf75 README
25 SHA1 7305dbe2904416e28decb05396988a5d51d578be inc/Module/Install.pm
26 SHA1 129960509127732258570c122042bc48615222e1 inc/Module/Install/Base.pm
27 SHA1 cf3356ed9a5bd2f732527ef9e7bc5ef4458c8a93 inc/Module/Install/Can.pm
28 SHA1 e083a5ec82c708f0a933785388b3ac2c94d802ec inc/Module/Install/External.pm
29 SHA1 bf0a3e1977effc2832d7a813a76dce3f31b437b6 inc/Module/Install/Fetch.pm
30 SHA1 b721c93ca5bc9a6aa863b49af15f1b1de6125935 inc/Module/Install/Makefile.pm
31 SHA1 026cc0551a0ad399d195e395b46bdf842e115192 inc/Module/Install/Metadata.pm
32 SHA1 d3a33569b41077d6a836f95bb63484c51e9d0a52 inc/Module/Install/ReadmeFromPod.pm
33 SHA1 d3a4c720c6ec7f8fce7df37002fbc9177fb77050 inc/Module/Install/Scripts.pm
34 SHA1 5457015ea5a50e93465bf2dafa29feebd547f85b inc/Module/Install/Win32.pm
35 SHA1 051e7fa8063908befa3440508d0584a2497b97db inc/Module/Install/WriteAll.pm
36 SHA1 e37281f2715f3a73c830d0408461fc0e3e43d419 lib/Module/Signature.pm
24 SHA1 6135b90837836cd8a72c78cbec211b2d84996c99 README
25 SHA1 8a924add836b60fb23b25c8506d45945e02f42f4 inc/Module/Install.pm
26 SHA1 2d0fad3bf255f8c1e7e1e34eafccc4f595603ddc inc/Module/Install/Base.pm
27 SHA1 f0e01fff7d73cd145fbf22331579918d4628ddb0 inc/Module/Install/Can.pm
28 SHA1 272e65bd98dd43c7acd8c272dde84fbe5794fc07 inc/Module/Install/External.pm
29 SHA1 7328966e4fda0c8451a6d3850704da0b84ac1540 inc/Module/Install/Fetch.pm
30 SHA1 b62ca5e2d58fa66766ccf4d64574f9e1a2250b34 inc/Module/Install/Makefile.pm
31 SHA1 1aa925be410bb3bfcd84a16985921f66073cc1d2 inc/Module/Install/Metadata.pm
32 SHA1 dc94326a076aca41452c1d65bf52a255feeb9ef7 inc/Module/Install/ReadmeFromPod.pm
33 SHA1 4d793c044726e06fe35d8d129b76da2803377f92 inc/Module/Install/Scripts.pm
34 SHA1 e4196994fa75e98bdfa2be0bdeeffef66de88171 inc/Module/Install/Win32.pm
35 SHA1 c3a6d0d5b84feb3280622e9599e86247d58b0d18 inc/Module/Install/WriteAll.pm
36 SHA1 6c5cda03253ec382b7f558f891d2f4868a235610 lib/Module/Signature.pm
3737 SHA1 0882c50213a28b7a30fc91fd58c19015f33348d0 script/cpansign
3838 SHA1 3ec6171779122b0bdc69937c283be11b2a15dd89 t/0-signature.t
3939 SHA1 307a744384e704d94031df73233f24174b843bc8 t/1-basic.t
4242 SHA1 69614dfba33a1ef498a2161f9e4718092652857c t/wrap.pl
4343 SHA1 61377898e9d7cb06d370f45167a925e16736de70 t/wrapped-tests.bin
4444 -----BEGIN PGP SIGNATURE-----
45 Version: GnuPG v1.4.11 (GNU/Linux)
45 Version: GnuPG v1.4.12 (Darwin)
4646
47 iEYEARECAAYFAk3M/5gACgkQdC8qQo5jWl6ejwCfYy2EE94jsoe1oY2w7Na3jSnX
48 1fwAnRgS45SDoKjbLSH1+6z37NL/MpGI
49 =NYb6
47 iEYEARECAAYFAlGvpckACgkQtLPdNzw1AaCR9wCfZp9kU2M8/1xG/5Nac1G7g4dH
48 rFwAnA5VfZ1qA17gOZF/sn/sRUhI6LwL
49 =aUN8
5050 -----END PGP SIGNATURE-----
33 use strict 'vars';
44 use vars qw{$VERSION};
55 BEGIN {
6 $VERSION = '1.00';
6 $VERSION = '1.06';
77 }
88
99 # Suspend handler for "redefined" warnings
22
33 use strict;
44 use Config ();
5 use File::Spec ();
65 use ExtUtils::MakeMaker ();
76 use Module::Install::Base ();
87
98 use vars qw{$VERSION @ISA $ISCORE};
109 BEGIN {
11 $VERSION = '1.00';
10 $VERSION = '1.06';
1211 @ISA = 'Module::Install::Base';
1312 $ISCORE = 1;
1413 }
2827 eval { require $mod; $pkg->VERSION($ver || 0); 1 };
2928 }
3029
31 # check if we can run some command
30 # Check if we can run some command
3231 sub can_run {
3332 my ($self, $cmd) = @_;
3433
3736
3837 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
3938 next if $dir eq '';
40 my $abs = File::Spec->catfile($dir, $_[1]);
39 require File::Spec;
40 my $abs = File::Spec->catfile($dir, $cmd);
4141 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
4242 }
4343
4444 return;
4545 }
4646
47 # can we locate a (the) C compiler
47 # Can our C compiler environment build XS files
48 sub can_xs {
49 my $self = shift;
50
51 # Ensure we have the CBuilder module
52 $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
53
54 # Do we have the configure_requires checker?
55 local $@;
56 eval "require ExtUtils::CBuilder;";
57 if ( $@ ) {
58 # They don't obey configure_requires, so it is
59 # someone old and delicate. Try to avoid hurting
60 # them by falling back to an older simpler test.
61 return $self->can_cc();
62 }
63
64 # Do we have a working C compiler
65 my $builder = ExtUtils::CBuilder->new(
66 quiet => 1,
67 );
68 unless ( $builder->have_compiler ) {
69 # No working C compiler
70 return 0;
71 }
72
73 # Write a C file representative of what XS becomes
74 require File::Temp;
75 my ( $FH, $tmpfile ) = File::Temp::tempfile(
76 "compilexs-XXXXX",
77 SUFFIX => '.c',
78 );
79 binmode $FH;
80 print $FH <<'END_C';
81 #include "EXTERN.h"
82 #include "perl.h"
83 #include "XSUB.h"
84
85 int main(int argc, char **argv) {
86 return 0;
87 }
88
89 int boot_sanexs() {
90 return 1;
91 }
92
93 END_C
94 close $FH;
95
96 # Can the C compiler access the same headers XS does
97 my @libs = ();
98 my $object = undef;
99 eval {
100 local $^W = 0;
101 $object = $builder->compile(
102 source => $tmpfile,
103 );
104 @libs = $builder->link(
105 objects => $object,
106 module_name => 'sanexs',
107 );
108 };
109 my $result = $@ ? 0 : 1;
110
111 # Clean up all the build files
112 foreach ( $tmpfile, $object, @libs ) {
113 next unless defined $_;
114 1 while unlink;
115 }
116
117 return $result;
118 }
119
120 # Can we locate a (the) C compiler
48121 sub can_cc {
49122 my $self = shift;
50123 my @chunks = split(/ /, $Config::Config{cc}) or return;
77150
78151 __END__
79152
80 #line 156
153 #line 236
77
88 use vars qw{$VERSION $ISCORE @ISA};
99 BEGIN {
10 $VERSION = '1.00';
10 $VERSION = '1.06';
1111 $ISCORE = 1;
1212 @ISA = qw{Module::Install::Base};
13 }
14
15 sub requires_xs {
16 my $self = shift;
17
18 # First check for the basic C compiler
19 $self->requires_external_cc;
20
21 # We need a C compiler that can build XS files
22 unless ( $self->can_xs ) {
23 print "Unresolvable missing external dependency.\n";
24 print "This package requires perl's header files.\n";
25 print STDERR "NA: Unable to build distribution on this platform.\n";
26 exit(0);
27 }
28
29 1;
1330 }
1431
1532 sub requires_external_cc {
4057 $self->load('can_run');
4158
4259 # Locate the bin
43 print "Locating required external dependency bin:$bin...";
60 print "Locating bin:$bin...";
4461 my $found_bin = $self->can_run( $bin );
4562 if ( $found_bin ) {
4663 print " found at $found_bin.\n";
6279
6380 __END__
6481
65 #line 138
82 #line 171
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '1.00';
8 $VERSION = '1.06';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
77
88 use vars qw{$VERSION @ISA $ISCORE};
99 BEGIN {
10 $VERSION = '1.00';
10 $VERSION = '1.06';
1111 @ISA = 'Module::Install::Base';
1212 $ISCORE = 1;
1313 }
214214 require ExtUtils::MakeMaker;
215215
216216 if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
217 # MakeMaker can complain about module versions that include
218 # an underscore, even though its own version may contain one!
219 # Hence the funny regexp to get rid of it. See RT #35800
220 # for details.
221 my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
222 $self->build_requires( 'ExtUtils::MakeMaker' => $v );
223 $self->configure_requires( 'ExtUtils::MakeMaker' => $v );
217 # This previous attempted to inherit the version of
218 # ExtUtils::MakeMaker in use by the module author, but this
219 # was found to be untenable as some authors build releases
220 # using future dev versions of EU:MM that nobody else has.
221 # Instead, #toolchain suggests we use 6.59 which is the most
222 # stable version on CPAN at time of writing and is, to quote
223 # ribasushi, "not terminally fucked, > and tested enough".
224 # TODO: We will now need to maintain this over time to push
225 # the version up as new versions are released.
226 $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 );
227 $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
224228 } else {
225229 # Allow legacy-compatibility with 5.005 by depending on the
226230 # most recent EU:MM that supported 5.005.
227 $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
228 $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
231 $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 );
232 $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
229233 }
230234
231235 # Generate the MakeMaker params
240244 'all_from' if you prefer) in Makefile.PL.
241245 EOT
242246
243 $DB::single = 1;
244247 if ( $self->tests ) {
245248 my @tests = split ' ', $self->tests;
246249 my %seen;
411414
412415 __END__
413416
414 #line 541
417 #line 544
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '1.00';
8 $VERSION = '1.06';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
150150 sub install_as_vendor { $_[0]->installdirs('vendor') }
151151
152152 sub dynamic_config {
153 my $self = shift;
154 unless ( @_ ) {
155 warn "You MUST provide an explicit true/false value to dynamic_config\n";
156 return $self;
157 }
158 $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
153 my $self = shift;
154 my $value = @_ ? shift : 1;
155 if ( $self->{values}->{dynamic_config} ) {
156 # Once dynamic we never change to static, for safety
157 return 0;
158 }
159 $self->{values}->{dynamic_config} = $value ? 1 : 0;
159160 return 1;
161 }
162
163 # Convenience command
164 sub static_config {
165 shift->dynamic_config(0);
160166 }
161167
162168 sub perl_version {
169175 # Normalize the version
170176 $version = $self->_perl_version($version);
171177
172 # We don't support the reall old versions
178 # We don't support the really old versions
173179 unless ( $version >= 5.005 ) {
174180 die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
175181 }
514520 'GNU Free Documentation license' => 'unrestricted', 1,
515521 'GNU Affero General Public License' => 'open_source', 1,
516522 '(?:Free)?BSD license' => 'bsd', 1,
523 'Artistic license 2\.0' => 'artistic_2', 1,
517524 'Artistic license' => 'artistic', 1,
518525 'Apache (?:Software )?license' => 'apache', 1,
519526 'GPL' => 'gpl', 1,
549556
550557 sub _extract_bugtracker {
551558 my @links = $_[0] =~ m#L<(
552 \Qhttp://rt.cpan.org/\E[^>]+|
553 \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
554 \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
559 https?\Q://rt.cpan.org/\E[^>]+|
560 https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
561 https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
555562 )>#gx;
556563 my %links;
557564 @links{@links}=();
580587 sub requires_from {
581588 my $self = shift;
582589 my $content = Module::Install::_readperl($_[0]);
583 my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
590 my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
584591 while ( @requires ) {
585592 my $module = shift @requires;
586593 my $version = shift @requires;
66 use base qw(Module::Install::Base);
77 use vars qw($VERSION);
88
9 $VERSION = '0.12';
9 $VERSION = '0.20';
1010
1111 sub readme_from {
1212 my $self = shift;
1313 return unless $self->is_admin;
1414
15 my $file = shift || $self->_all_from
15 # Input file
16 my $in_file = shift || $self->_all_from
1617 or die "Can't determine file to make readme_from";
17 my $clean = shift;
1818
19 print "Writing README from $file\n";
19 # Get optional arguments
20 my ($clean, $format, $out_file, $options);
21 my $args = shift;
22 if ( ref $args ) {
23 # Arguments are in a hashref
24 if ( ref($args) ne 'HASH' ) {
25 die "Expected a hashref but got a ".ref($args)."\n";
26 } else {
27 $clean = $args->{'clean'};
28 $format = $args->{'format'};
29 $out_file = $args->{'output_file'};
30 $options = $args->{'options'};
31 }
32 } else {
33 # Arguments are in a list
34 $clean = $args;
35 $format = shift;
36 $out_file = shift;
37 $options = \@_;
38 }
2039
21 require Pod::Text;
22 my $parser = Pod::Text->new();
23 open README, '> README' or die "$!\n";
24 $parser->output_fh( *README );
25 $parser->parse_file( $file );
40 # Default values;
41 $clean ||= 0;
42 $format ||= 'txt';
43
44 # Generate README
45 print "readme_from $in_file to $format\n";
46 if ($format =~ m/te?xt/) {
47 $out_file = $self->_readme_txt($in_file, $out_file, $options);
48 } elsif ($format =~ m/html?/) {
49 $out_file = $self->_readme_htm($in_file, $out_file, $options);
50 } elsif ($format eq 'man') {
51 $out_file = $self->_readme_man($in_file, $out_file, $options);
52 } elsif ($format eq 'pdf') {
53 $out_file = $self->_readme_pdf($in_file, $out_file, $options);
54 }
55
2656 if ($clean) {
27 $self->clean_files('README');
57 $self->clean_files($out_file);
2858 }
59
2960 return 1;
3061 }
62
63
64 sub _readme_txt {
65 my ($self, $in_file, $out_file, $options) = @_;
66 $out_file ||= 'README';
67 require Pod::Text;
68 my $parser = Pod::Text->new( @$options );
69 open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
70 $parser->output_fh( *$out_fh );
71 $parser->parse_file( $in_file );
72 close $out_fh;
73 return $out_file;
74 }
75
76
77 sub _readme_htm {
78 my ($self, $in_file, $out_file, $options) = @_;
79 $out_file ||= 'README.htm';
80 require Pod::Html;
81 Pod::Html::pod2html(
82 "--infile=$in_file",
83 "--outfile=$out_file",
84 @$options,
85 );
86 # Remove temporary files if needed
87 for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
88 if (-e $file) {
89 unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
90 }
91 }
92 return $out_file;
93 }
94
95
96 sub _readme_man {
97 my ($self, $in_file, $out_file, $options) = @_;
98 $out_file ||= 'README.1';
99 require Pod::Man;
100 my $parser = Pod::Man->new( @$options );
101 $parser->parse_from_file($in_file, $out_file);
102 return $out_file;
103 }
104
105
106 sub _readme_pdf {
107 my ($self, $in_file, $out_file, $options) = @_;
108 $out_file ||= 'README.pdf';
109 eval { require App::pod2pdf; }
110 or die "Could not generate $out_file because pod2pdf could not be found\n";
111 my $parser = App::pod2pdf->new( @$options );
112 $parser->parse_from_file($in_file);
113 open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
114 select $out_fh;
115 $parser->output;
116 select STDOUT;
117 close $out_fh;
118 return $out_file;
119 }
120
31121
32122 sub _all_from {
33123 my $self = shift;
43133
44134 __END__
45135
46 #line 112
136 #line 254
47137
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '1.00';
8 $VERSION = '1.06';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '1.00';
8 $VERSION = '1.06';
99 @ISA = 'Module::Install::Base';
1010 $ISCORE = 1;
1111 }
55
66 use vars qw{$VERSION @ISA $ISCORE};
77 BEGIN {
8 $VERSION = '1.00';
8 $VERSION = '1.06';
99 @ISA = qw{Module::Install::Base};
1010 $ISCORE = 1;
1111 }
3030 # This is not enforced yet, but will be some time in the next few
3131 # releases once we can make sure it won't clash with custom
3232 # Module::Install extensions.
33 $VERSION = '1.00';
33 $VERSION = '1.06';
3434
3535 # Storage for the pseudo-singleton
3636 $MAIN = undef;
450450 }
451451
452452 sub _cmp ($$) {
453 _version($_[0]) <=> _version($_[1]);
453 _version($_[1]) <=> _version($_[2]);
454454 }
455455
456456 # Cloned from Params::Util::_CLASS
466466
467467 1;
468468
469 # Copyright 2008 - 2010 Adam Kennedy.
469 # Copyright 2008 - 2012 Adam Kennedy.
00 package Module::Signature;
1 $Module::Signature::VERSION = '0.68';
1 $Module::Signature::VERSION = '0.73';
22
33 use 5.005;
44 use strict;
1717
1818 use ExtUtils::Manifest ();
1919 use Exporter;
20 use File::Spec;
2021
2122 @EXPORT_OK = (
2223 qw(sign verify),
142143 }
143144
144145 sub _has_gpg {
145 `gpg --version` =~ /GnuPG.*?(\S+)\s*$/m or return;
146 my $gpg = _which_gpg() or return;
147 `$gpg --version` =~ /GnuPG.*?(\S+)\s*$/m or return;
146148 return $1;
147149 }
148150
212214 or /~$/ or /\.old$/ or /\#$/ or /^\.#/;
213215 }
214216
217 my $which_gpg;
218 sub _which_gpg {
219 # Cache it so we don't need to keep checking.
220 return $which_gpg if $which_gpg;
221
222 for my $gpg_bin ('gpg', 'gpg2', 'gnupg', 'gnupg2') {
223 my $version = `$gpg_bin --version 2>&1`;
224 if( $version && $version =~ /GnuPG/ ) {
225 $which_gpg = $gpg_bin;
226 return $which_gpg;
227 }
228 }
229 }
230
215231 sub _verify_gpg {
216232 my ($sigtext, $plaintext, $version) = @_;
217233
220236
221237 my $keyserver = _keyserver($version);
222238
239 my $gpg = _which_gpg();
223240 my @quiet = $Verbose ? () : qw(-q --logger-fd=1);
224241 my @cmd = (
225 qw(gpg --verify --batch --no-tty), @quiet, ($KeyServer ? (
242 $gpg, qw(--verify --batch --no-tty), @quiet, ($KeyServer ? (
226243 "--keyserver=$keyserver",
227244 ($AutoKeyRetrieve and $version ge '1.0.7')
228245 ? '--keyserver-options=auto-key-retrieve'
379396 die "Could not write to $sigfile"
380397 if -e $sigfile and (-d $sigfile or not -w $sigfile);
381398
399 my $gpg = _which_gpg();
400
382401 local *D;
383 open D, "| gpg --clearsign >> $sigfile.tmp" or die "Could not call gpg: $!";
402 open D, "| $gpg --clearsign >> $sigfile.tmp" or die "Could not call $gpg: $!";
384403 print D $plaintext;
385404 close D;
386405
409428 # This doesn't work because the output from verify goes to STDERR.
410429 # If I try to redirect it using "--logger-fd 1" it just hangs.
411430 # WTF?
412 my @verify = `gpg --batch --verify $SIGNATURE`;
431 my @verify = `$gpg --batch --verify $SIGNATURE`;
413432 while (@verify) {
414433 if (/key ID ([0-9A-F]+)$/) {
415434 $key_id = $1;
422441 my $found_key;
423442 if (defined $key_id && defined $key_name) {
424443 my $keyserver = _keyserver($version);
425 while (`gpg --batch --keyserver=$keyserver --search-keys '$key_name'`) {
444 while (`$gpg --batch --keyserver=$keyserver --search-keys '$key_name'`) {
426445 if (/^\(\d+\)/) {
427446 $found_name = 0;
428447 } elsif ($found_name) {
513532
514533 sub _digest_object {
515534 my($algorithm) = @_;
535
536 # Avoid loading Digest::* from relative paths in @INC.
537 local @INC = grep { File::Spec->file_name_is_absolute($_) } @INC;
538
539 # Constrain algorithm name to be of form ABC123.
540 my ($base, $variant) = ($algorithm =~ /^([_a-zA-Z]+)([0-9]+)$/g)
541 or die "Malformed algorithm name: $algorithm (should match /\\w+\\d+/)";
542
516543 my $obj = eval { Digest->new($algorithm) } || eval {
517 my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
518544 require "Digest/$base.pm"; "Digest::$base"->new($variant)
519545 } || eval {
520546 require "Digest/$algorithm.pm"; "Digest::$algorithm"->new
521547 } || eval {
522 my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
523548 require "Digest/$base/PurePerl.pm"; "Digest::$base\::PurePerl"->new($variant)
524549 } || eval {
525550 require "Digest/$algorithm/PurePerl.pm"; "Digest::$algorithm\::PurePerl"->new
526551 } or do { eval {
527 my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
528552 warn "Unknown cipher: $algorithm, please install Digest::$base, Digest::$base$variant, or Digest::$base\::PurePerl\n";
529553 } and return } or do {
530554 warn "Unknown cipher: $algorithm, please install Digest::$algorithm\n"; return;
917941
918942 L<Module::Install>, L<ExtUtils::MakeMaker>, L<Module::Build>
919943
944 L<Dist::Zilla::Plugin::Signature>
945
920946 =head1 AUTHORS
921947
922948 唐鳳 E<lt>cpan@audreyt.orgE<gt>