line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPANPLUS::Module::Signature; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
140
|
use strict; |
|
20
|
|
|
|
|
63
|
|
|
20
|
|
|
|
|
670
|
|
4
|
|
|
|
|
|
|
|
5
|
20
|
|
|
20
|
|
116
|
use Cwd; |
|
20
|
|
|
|
|
48
|
|
|
20
|
|
|
|
|
1334
|
|
6
|
20
|
|
|
20
|
|
138
|
use CPANPLUS::Error; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
1208
|
|
7
|
20
|
|
|
20
|
|
135
|
use Params::Check qw[check]; |
|
20
|
|
|
|
|
45
|
|
|
20
|
|
|
|
|
1035
|
|
8
|
20
|
|
|
20
|
|
129
|
use Module::Load::Conditional qw[can_load]; |
|
20
|
|
|
|
|
55
|
|
|
20
|
|
|
|
|
1117
|
|
9
|
20
|
|
|
20
|
|
150
|
use vars qw[$VERSION]; |
|
20
|
|
|
|
|
97
|
|
|
20
|
|
|
|
|
6285
|
|
10
|
|
|
|
|
|
|
$VERSION = "0.9912"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
### detached sig, not actually used afaik --kane ### |
13
|
|
|
|
|
|
|
#sub get_signature { |
14
|
|
|
|
|
|
|
# my $self = shift; |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# my $clone = $self->clone; |
17
|
|
|
|
|
|
|
# $clone->package( $self->package . '.sig' ); |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# return $clone->fetch; |
20
|
|
|
|
|
|
|
#} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub check_signature { |
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my $cb = $self->parent; |
25
|
0
|
|
|
|
|
|
my $conf = $cb->configure_object; |
26
|
0
|
|
|
|
|
|
my %hash = @_; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $verbose; |
29
|
0
|
|
|
|
|
|
my $tmpl = { |
30
|
|
|
|
|
|
|
verbose => {default => $conf->get_conf('verbose'), store => \$verbose}, |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
check( $tmpl, \%hash ) or return; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
my $dir = $self->status->extract or ( |
36
|
|
|
|
|
|
|
error( loc( "Do not know what dir '%1' was extracted to; ". |
37
|
|
|
|
|
|
|
"Cannot check signature", $self->module ) ), |
38
|
|
|
|
|
|
|
return ); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $cwd = cwd(); |
41
|
0
|
0
|
|
|
|
|
unless( $cb->_chdir( dir => $dir ) ) { |
42
|
0
|
|
|
|
|
|
error(loc( "Could not chdir to '%1', cannot verify distribution '%2'", |
43
|
|
|
|
|
|
|
$dir, $self->module )); |
44
|
0
|
|
|
|
|
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
### check prerequisites |
49
|
0
|
|
|
|
|
|
my $flag; |
50
|
0
|
|
|
|
|
|
my $use_list = { 'Module::Signature' => '0.06' }; |
51
|
0
|
0
|
|
|
|
|
if( can_load( modules => $use_list, verbose => 1 ) ) { |
52
|
0
|
|
|
|
|
|
my $rv = Module::Signature::verify(); |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
|
unless ($rv eq Module::Signature::SIGNATURE_OK() or |
55
|
|
|
|
|
|
|
$rv eq Module::Signature::SIGNATURE_MISSING() |
56
|
|
|
|
|
|
|
) { |
57
|
0
|
|
|
|
|
|
$flag++; # whoops, bad sig |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$cb->_chdir( dir => $cwd ); |
62
|
0
|
0
|
|
|
|
|
return $flag ? 0 : 1; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |