perl-carton / carton

Bundler or pip freeze for Perl
http://search.cpan.org/dist/carton
Other
494 stars 96 forks source link

exclude directories vendor_perl from @INC #257

Open nicolasfranck opened 5 years ago

nicolasfranck commented 5 years ago

I'm using carton to package a project together with all its perl dependencies. The package is then installed on another server. Both servers (centos 7) have the same OS.

All goes well until your project needs something like Digest::MD5. The destination server does not have Digest::MD5, because it is not part of the perl distribution. The build server did have that module in the default locations, indirectly by installing something like perl-App-cpanminus.

So the thing is: carton ignores what is already present in the default locations, including those perl modules that were installed by yum. Shouldn't those those directories be excluded?

nicolasfranck commented 5 years ago

Another option: add the module to "local", even if it exists in the default perl locations. A new command line option?

cPWilliamL commented 4 years ago

I am facing this issue as well, but it's hard to place the blame. First, carton uses Menlo(basically cpanm 2.0) as a backend. Carton doesn't fully expose all of the Menlo/cpanm options, one being '--self-contained':

$ cpanm --help|grep self.contained
  --self-contained          Install all non-core modules, even if they're already installed.

So you could adjust Carton::Builder::run_install to add this option; however, notice it says non-core modules.

Digest::MD5 should be included by default in Perl core modules, so it could be the distro to blame. In my case the issue was with Module::Build, which is not actually listed in the core modules at https://perldoc.perl.org/

However, I found that perldoc probably shouldn't be the definitive source for which modules are core. In fact, Menlo uses Module::CoreList, where it shows that Module::Build is a core module:

$ corelist -a Module::Build
Module::Build was first released with perl v5.9.4
  v5.9.4     0.2805
  v5.9.5     0.2808

Which cleared up my confusion about carton/Menlo not including what I believed was a non-core module.

So if you are encountering this issue, it's one of these problems:

HTH

skaji commented 4 years ago

--self-contained option is already enabled because -L option implies it.