Skip to content

Commit

Permalink
tweaked handling of symlinks not listed in MANIFEST (RT #97858)
Browse files Browse the repository at this point in the history
- they should be skipped for a local distribution (Test::Kwalitee)
- they should not be skipped for a non-local distribution (CPANTS site)

https://rt.cpan.org/Ticket/Display.html?id=97858
  • Loading branch information
charsbar committed Aug 9, 2014
1 parent 9b3ea1f commit 05407ee
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Module/CPANTS/Kwalitee/Manifest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ sub analyse {
"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;
Expand Down
35 changes: 35 additions & 0 deletions t/analyse/manifest.t
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,39 @@ EOF
ok grep /^Missing in Dist: eg\/demo\.pl/, @errors;
};

# should hide symlink errors not in MANIFEST for a local distribution

test_distribution {
my ($mca, $dir) = @_;
write_file("$dir/MANIFEST", <<"EOF");
MANIFEST
EOF

eval { symlink "$dir/MANIFEST", "$dir/MANIFEST.lnk" };
if ($@) {
diag "symlink is not supported";
return;
}

my $stash = $mca->run;
ok !$stash->{error}{symlinks}, "symlinks not listed in MANIFEST is ignored for a local distribution";
};

test_distribution {
my ($mca, $dir) = @_;
write_file("$dir/MANIFEST", <<"EOF");
MANIFEST
EOF

eval { symlink "$dir/MANIFEST", "$dir/MANIFEST.lnk" };
if ($@) {
diag "symlink is not supported";
return;
}

my $stash = archive_and_analyse($dir, "Module-CPANTS-Analyse-Test-0.01.tar.gz");

ok $stash->{error}{symlinks}, "symlinks not listed in MANIFEST is not ignored for a non-local distribution";
};

done_testing;

0 comments on commit 05407ee

Please sign in to comment.