line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # hide |
2
|
|
|
|
|
|
|
Test::Dist::Manifest; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# Copypast from Module::CPANTS::Kwalitee::Manifest with only change: |
5
|
|
|
|
|
|
|
# ignore files, ignored by ExtUtils::Manifest |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Test::Dist::Manifest |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Copypast from L with only change: |
14
|
|
|
|
|
|
|
ignore files, ignored by ExtUtils::Manifest, since we're running under source, not unpacked distribution |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
For internal use by L |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 FUNCTIONS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 order |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 analyse |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 kwalitee_indicators |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
67
|
|
29
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
53
|
|
30
|
2
|
|
|
2
|
|
1948
|
use ExtUtils::Manifest; |
|
2
|
|
|
|
|
40609
|
|
|
2
|
|
|
|
|
161
|
|
31
|
2
|
|
|
2
|
|
2893
|
use File::Spec::Functions qw(catfile); |
|
2
|
|
|
|
|
2328
|
|
|
2
|
|
|
|
|
298
|
|
32
|
2
|
|
|
2
|
|
15519
|
use Array::Diff; |
|
2
|
|
|
|
|
48766
|
|
|
2
|
|
|
|
|
18
|
|
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
0
|
sub order { 100 } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
################################################################## |
37
|
|
|
|
|
|
|
# Analyse |
38
|
|
|
|
|
|
|
################################################################## |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub analyse { |
41
|
1
|
|
|
1
|
1
|
4
|
my $class=shift; |
42
|
1
|
|
|
|
|
3
|
my $me=shift; |
43
|
1
|
|
|
|
|
8
|
my $skip = ExtUtils::Manifest::maniskip(); |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
589
|
my @files=@{$me->d->{files_array}}; |
|
1
|
|
|
|
|
6
|
|
46
|
1
|
50
|
|
|
|
22
|
if (my $ignore = $me->d->{ignored_files_array}) { |
47
|
1
|
|
|
|
|
18
|
push @files, @$ignore; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
6
|
@files = grep !$skip->($_), @files; # skip files, ignored by make manifest |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
883
|
my $distdir=$me->distdir; |
53
|
1
|
|
|
|
|
18
|
my $manifest_file=catfile($distdir,'MANIFEST'); |
54
|
|
|
|
|
|
|
|
55
|
1
|
50
|
|
|
|
29
|
if (-e $manifest_file) { |
56
|
|
|
|
|
|
|
# read manifest |
57
|
1
|
50
|
|
|
|
42
|
open(my $fh, '<', $manifest_file) || die "cannot read MANIFEST $manifest_file: $!"; |
58
|
1
|
|
|
|
|
3
|
my @manifest; |
59
|
1
|
|
|
|
|
23
|
while (<$fh>) { |
60
|
26
|
|
|
|
|
31
|
chomp; |
61
|
26
|
50
|
|
|
|
56
|
next if /^\s*#/; # discard pure comments |
62
|
|
|
|
|
|
|
|
63
|
26
|
|
|
|
|
46
|
s/\s.*$//; # strip file comments |
64
|
26
|
50
|
|
|
|
48
|
next unless $_; # discard blank lines |
65
|
26
|
|
|
|
|
94
|
push(@manifest,$_); |
66
|
|
|
|
|
|
|
} |
67
|
1
|
|
|
|
|
13
|
close $fh; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
15
|
@manifest=sort @manifest; |
70
|
1
|
|
|
|
|
15
|
my @files=sort @files; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
14
|
my $diff=Array::Diff->diff(\@manifest,\@files); |
73
|
1
|
50
|
|
|
|
641
|
if ($diff->count == 0) { |
74
|
0
|
|
|
|
|
0
|
$me->d->{manifest_matches_dist}=1; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
else { |
77
|
1
|
|
|
|
|
11
|
$me->d->{manifest_matches_dist}=0; |
78
|
1
|
|
|
|
|
4
|
my @error = ( |
79
|
|
|
|
|
|
|
'MANIFEST ('.@manifest.') does not match dist ('.@files."):", |
80
|
1
|
|
|
|
|
12
|
"Missing in MANIFEST: ".join(', ',@{$diff->added}), |
81
|
1
|
|
|
|
|
15
|
"Missing in Dist: " . join(', ',@{$diff->deleted})); |
82
|
1
|
|
|
|
|
10
|
$me->d->{error}{manifest_matches_dist} = \@error; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
else { |
86
|
0
|
|
|
|
|
0
|
$me->d->{manifest_matches_dist}=0; |
87
|
0
|
|
|
|
|
0
|
$me->d->{error}{manifest_matches_dist}=q{Cannot find MANIFEST in dist.}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
################################################################## |
92
|
|
|
|
|
|
|
# Kwalitee Indicators |
93
|
|
|
|
|
|
|
################################################################## |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub kwalitee_indicators { |
96
|
|
|
|
|
|
|
return [ |
97
|
|
|
|
|
|
|
{ |
98
|
|
|
|
|
|
|
name=>'manifest_matches_dist', |
99
|
|
|
|
|
|
|
error=>q{MANIFEST does not match the contents of this distribution. See 'error_manifest_matches_dist' in the dist view for more info.}, |
100
|
|
|
|
|
|
|
remedy=>q{Use a buildtool to generate the MANIFEST. Or update MANIFEST manually.}, |
101
|
1
|
50
|
|
1
|
|
6
|
code=>sub { shift->{manifest_matches_dist} ? 1 : 0 }, |
102
|
|
|
|
|
|
|
} |
103
|
1
|
|
|
1
|
1
|
8
|
]; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |