robrwo / Dist-Zilla-Plugin-Generate-ManifestSkip

0 stars 0 forks source link

Module::Manifest::Skip fails as a dependency in some environments #1

Open robrwo opened 5 years ago

robrwo commented 5 years ago

Module::Manifest::Skip is unable to find it's default MANIFEST.SKIP file in some environments. It's not clear if this is an issue with File::ShareDir or Module::Manifest::Skip.

eserte commented 5 years ago

The failure can be reproduced with the following Dockerfile:

# docker build -t perl-test . && docker run perl-test
FROM debian:stretch
RUN echo "cache invalidation #20181026"
RUN apt-get -y update
RUN apt-get -y install perl-modules
RUN apt-get -y install make

# Speed up installation
RUN apt-get -y --no-install-recommends install libdist-zilla-perl libmoose-perl libmoosex-mungehas-perl libmodule-build-perl libtype-tiny-xs-perl libtest-warnings-perl libtest-leaktrace-perl libhash-fieldhash-perl build-essential
RUN perl -MCPAN -e 'CPAN::Index->reload'
RUN perl -i -pe 's{.*index_expire.*}{index_expire=>1,}' /root/.cpan/CPAN/MyConfig.pm

RUN cpan Module::Manifest::Skip
# Must be installed in /usr/local/lib for the failure, not in /usr/local/share/perl or so
RUN mkdir -p /usr/local/lib/site_perl/Module/Manifest
RUN mv /usr/local/share/perl/5.24.1/Module/Manifest/Skip.pm /usr/local/lib/site_perl/Module/Manifest/Skip.pm
# The actual failure happens because next to /usr/local/lib exists a "share" directory

CMD cpan -t RRWO/Dist-Zilla-Plugin-Generate-ManifestSkip-v0.1.3.tar.gz

The problem seems to be caused by this line in Module::Manifest::Skip (@ingy FYI)

77:         elsif ($path =~ s!(\S.*?)[\\/]?\blib\b.*!$1! and -e "$path/share") {

If Module::Manifest::Skip is installed in a path which has a "lib" component, and if there's a "share" directory next to it, then this share directory will be used. This is often the wrong directory. For example, in my installations the Module::Manifest::Skip path looks like /usr/perl5.24.1p/lib/site_perl/5.24.1/Module/Manifest/Skip.pm. So if there's a /usr/perl5.24.1p/share directory (which is created by some CPAN distributions, e.g. spamassassin), then things fail.

robrwo commented 2 years ago

By default it adds a rule ^\w$. Presumably that means it skips one-letter filenames as junk.

Unfortunately, that causes Module::CPANTS::Analyse to think the distribution is missing a "t/" directory, see https://rt.cpan.org/Ticket/Display.html?id=141565 and https://github.com/ingydotnet/module-manifest-skip-pm/issues/9

I am thinking it may be better to use a different module for managing MANFIFEST.SKIP files.

(Ideally I'd not bother with it at all, but my experience with Dist::Zilla tools is that they tend to include a lot of files they shouldn't.)