1

I'm trying to install quite a few modules from CPAN into a temporary directory.

This is purely to place quite a few of them into a directory that I can then create a custom RPM out of. The rpm will then later be used on new installs as a bootstrap type thing on top of a custom perl install. They won't be run from this temporary location.

In CPAN I have tried

o conf mbuildpl_arg "--install_base /tmp/perl"
o conf makepl_arg "PREFIX=/tmp/perl"

But this seems to install them into /root/.cpan/build/somename/tmp/perl (where 'somename' varies each time), or the usual location. I was hoping to capture them all into a temporary buildroot type folder, that I can rpm them into the correct folder later.

Is there any way to do this, or am I doing something that isn't a good idea ?

I've looked into fpm and cpan2rpm but couldn't see a way to do lots of Perl modules into one RPM, so happy for any better thoughts on how to go from lots of modules to one custom RPM.

Ian
  • 13,724
  • 4
  • 52
  • 75
  • I use `perlbrew` to get my own copy of Perl. When I switch to its Perl, the `cpan` automatically switches so anything I load will only be local. See http://perlbrew.pl/ – shawnhcorey May 20 '15 at 18:19
  • Thanks, I'm trying to avoid cpan entirely though (other than for first time around, every time after that would be via rpm) – Ian May 20 '15 at 20:03

1 Answers1

2

No, that will install them in /tmp/perl (unless you override the arguments from cpan with an environment variables). They're not installed in ~/.cpan/build. That is where the modules are built (by make or Build) before they are installed (by make install or Build install). You can wipe that directory whenever you want.


By the way, you're telling ExtUtils::MakeMaker and Module::Build to use two different conventions. That's bad.

o conf mbuildpl_arg "--install_base /tmp/perl"
o conf makepl_arg "PREFIX=/tmp/perl"

should be

o conf mbuildpl_arg "--install_base /tmp/perl"
o conf makepl_arg "INSTALL_BASE=/tmp/perl"

or

o conf mbuildpl_arg "--prefix /tmp/perl"
o conf makepl_arg "PREFIX=/tmp/perl"

Personally, when I used local modules before I used local builds of Perl, I used

o conf mbuildpl_arg "--prefix /tmp/perl --lib /tmp/perl/lib/perl5"
o conf makepl_arg "PREFIX=/tmp/perl LIB=/tmp/perl/lib/perl5"

I dislike INSTALL_BASE as it makes it hard to upgrade your perl smoothly.

ikegami
  • 367,544
  • 15
  • 269
  • 518
  • Yes, I want them installed into /tmp/perl, this is what I want, but its not doing that currently. I just want a directory for with the newly installed modules and any depencies. I will try your suggestion thanks. – Ian May 20 '15 at 20:02
  • 1
    Either you didn't ask to install anything, the installation is failing, or you are overriding the parameters passed by `cpan` using env vars `PERL_MM_OPT` and/or `PERL_MB_OPT` – ikegami May 20 '15 at 20:07
  • Thanks, I think maybe some installs are failing. Eg install ExtUtils::XSBuilder::ParseSource says GRICHTER/ExtUtils-XSBuilder-0.28.tar.gz : make_test NO 2 dependencies missing (Tie::IxHash,Parse::RecDescent). But install Tie::IxHash says already installed. Do these methods conflict somehow with how they look for existing dependencies ? – Ian May 21 '15 at 10:46
  • Did you tell Perl where to look for the modules by setting env var `PERL5LIB`? – ikegami May 21 '15 at 10:56
  • Thanks for persisting, I was trying export PERL5LIB=/tmp/perl/lib/5.14.2/:/tmp/perl/lib/site_perl/:/opt/perl/lib/5.14.2/:/opt/perl/lib/site_perl/ but I get that dependency error or 'already built but the result looks suspicious. Skipping another build attempt' (not on all modules, some do install ok, but a fair portion of them) – Ian May 21 '15 at 13:04
  • I'm accepting this answer, as I still have some problems, but I think probably unrelated to the original question. Thanks ikegami – Ian May 21 '15 at 13:14
  • (Probably should be `export PERL5LIB=/tmp/perl/lib`) I've never seen that message. Make sure `build_dir_reuse` is still false (`0`)? – ikegami May 21 '15 at 13:27