/usr/share/perl5/Module/CPANTS/Kwalitee/Manifest.pm is in libmodule-cpants-analyse-perl 0.95-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | package Module::CPANTS::Kwalitee::Manifest;
use warnings;
use strict;
use File::Spec::Functions qw(catfile);
use Array::Diff;
our $VERSION = '0.95';
$VERSION = eval $VERSION; ## no critic
sub order { 100 }
##################################################################
# Analyse
##################################################################
sub analyse {
my $class=shift;
my $me=shift;
my $distdir=$me->distdir;
my $manifest_file=catfile($distdir,'MANIFEST');
if (-e $manifest_file) {
# read manifest
open(my $fh, '<', $manifest_file) || die "cannot read MANIFEST $manifest_file: $!";
my @manifest;
while (<$fh>) {
chomp;
next if /^\s*#/; # discard pure comments
if (s/^'(\\[\\']|.+)+'\s*.*/$1/) {
s/\\([\\'])/$1/g;
} else {
s/\s.*$//;
} # strip quotes and comments
next unless $_; # discard blank lines
push(@manifest,$_);
}
close $fh;
@manifest=sort @manifest;
my @files=sort keys %{$me->d->{files_hash} || {}};
my $diff=Array::Diff->diff(\@manifest,\@files);
if ($diff->count == 0) {
$me->d->{manifest_matches_dist}=1;
}
else {
$me->d->{manifest_matches_dist}=0;
my @error = (
'MANIFEST ('.@manifest.') does not match dist ('.@files."):",
"Missing in MANIFEST: ".join(', ',@{$diff->added}),
"Missing in Dist: " . join(', ',@{$diff->deleted}));
$me->d->{error}{manifest_matches_dist} = \@error;
}
# Tweak symlinks error for a local distribution (RT #97858)
if ($me->d->{is_local_distribution} && $me->d->{error}{symlinks}) {
my %manifested = map {$_ => 1} @manifest;
my @symlinks = grep {$manifested{$_}} split ',', $me->d->{error}{symlinks};
if (@symlinks) {
$me->d->{error}{symlinks} = join ',', @symlinks;
} else {
delete $me->d->{error}{symlinks};
}
}
}
else {
$me->d->{manifest_matches_dist}=0;
$me->d->{error}{manifest_matches_dist}=q{Cannot find MANIFEST in dist.};
}
}
##################################################################
# Kwalitee Indicators
##################################################################
sub kwalitee_indicators {
return [
{
name=>'manifest_matches_dist',
error=>q{MANIFEST does not match the contents of this distribution.},
remedy=>q{Run a proper command ("make manifest" or "./Build manifest", maybe with a force option), or use a distribution builder to generate the MANIFEST. Or update MANIFEST manually.},
code=>sub { shift->{manifest_matches_dist} ? 1 : 0 },
details=>sub {
my $d = shift;
my $error = $d->{error}{manifest_matches_dist};
return $error unless ref $error;
return join "\n", @$error;
},
}
];
}
q{Listening to: YAPC::Europe 2007};
__END__
=encoding UTF-8
=head1 NAME
Module::CPANTS::Kwalitee::Manifest - Check MANIFEST
=head1 SYNOPSIS
Check if MANIFEST and dist contents match.
=head1 DESCRIPTION
=head2 Methods
=head3 order
Defines the order in which Kwalitee tests should be run.
Returns C<100>.
=head3 analyse
Check if MANIFEST and dist contents match.
=head3 kwalitee_indicators
Returns the Kwalitee Indicators datastructure.
=over
=item * manifest_matches_dist
=back
=head1 SEE ALSO
L<Module::CPANTS::Analyse>
=head1 AUTHOR
Thomas Klausner, <domm@cpan.org>, http://domm.plix.at
=head1 COPYRIGHT AND LICENSE
Copyright © 2003–2006, 2009 L<Thomas Klausner|https://metacpan.org/author/domm>
You may use and distribute this module according to the same terms
that Perl is distributed under.
|