[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installing perl dependencies using Makefile.PL



Hi David,



On Thu, Jan 14, 2016 at 7:16 AM, David G <..hidden..> wrote:
Hi Guys,

Some musings here.

Currently in Makefile.PL we use a method of installing perl dependencies
that triggers cpan to do the actual work.

Yes.

Unfortunately if it is the first time cpan has been run (by that user)
on that system it bothers the user with questions that may cause either
confusion or lead to incorrect choices being made.
This could result in the new modules being installed in the system perl
instead of local perl libs which, at least on debian based systems, is
considered a bad thing.

Yes.
 
Even worse, after this first run, and installation of the needed
modules. A Logout and Login is required before Makefile.PL will complete
properly due to the Environment Variables needing to be correctly set.
(yes you can just run "exec bash --login" to fix it for a specific
terminal, but you need to do that for every terminal you may want to run
LedgerSMB or it's associated tools in.

cpanm on the other hand seems to *just work* as far as it asks the user
no questions.
Also it may not need the logout/in for the script to complete (not tested)

I created a completely empty and fresh Debian install and added the 'git', 'make', 'gcc' and 'cpanminus' (cpanm) packages to that. After cloning the LedgerSMB repo the process was definitely not straight forward. I had to:

cpanm --install Module::Install
cpanm --installdeps .

Without separately installing Module::Install, cpanm can't transform our Makefile.PL into a Makefile, because it's written using Module::Install which isn't a Core module. cpanm doesn't know about this fact nor depends on Module::Install itself, so that the module isn't on the system in advance.

The next step (cpanm --installdeps .) fails on multiple counts:

 * If 'make' or 'gcc' isn't installed, no warnings are shown (but dependency installation fails)
 * If the postgresql client/development libraries aren't installed, the build fails
  (I wasn't able to build DBD::Pg from CPAN; instead I installed the Debian libbdb-pg-perl package to work around that)
 * TeX::Encode won't test succesfully at all: it doesn't list the fact that it wants Test::Pod::Coverage to be installed, which it needs to complete testing succesfully
 * In an attempt to get TeX::Encode to install correctly, I also installed texlive; I'm not sure what would have happened if I hadn't done that.

I wonder if we should list Starman as required these days. If we do, then we need a change to our Makefile.PL: it's listed as recommendation.

Because I didn't want to install everything into the system directories (I want to have the opportunity to clear out all installed deps and start over again), I also had to install and configure local::lib, which requires a few additional steps to set up. (also complicating)

An alternative to both of these that has been suggested and may work
well for us is Carton.

From its description, it tries to solve a different problem: installation of *exactly* the same dependencies in all environments. However, that's not the same as listing correct requirements and downloading the latest of those into your system. I don't think we should restrict requirements to exactly one version; we haven't in the past and that has worked pretty well for us.

If we want to make installation simple, I think we could have a script which runs the right sequence of commands in order to pull the correct dependencies into a local directory. e.g. installing Module::Install, installing *without testing* TeX::Encode and from there, installing the other dependencies through cpanm --installdeps. Maybe that script could try to inspect the system for availability of required programs and libraries in the various (default) paths, such as the libraries that DBD::Pg wants to link against and the programs TeX::Encode wants to use -- and warn if those are missing.

It doesn't feel to me like Carton will (ever) address that functionality.
 
Carton is a manager that uses that cpanfile to install things locally
(to a project) in a deployment-manageable way
https://metacpan.org/pod/Carton and
https://metacpan.org/pod/distribution/Carton/lib/Carton/Doc/FAQ.pod

According to https://github.com/perl-carton/carton/issues/197
you don't actually have to use "carton exec", it's just a convenient way
to load only the local lib

Does anyone have thought or experience with any of these that suggests
any issues or benefits?

I'm thinking that most people are best off with a good list of instructions and "cpanm --installdeps ." in the LedgerSMB directory, possibly in combination with local::lib. What could help is if we provided clear instructions on how to set up such an environment.

Hope this is an answer of the type you were looking for!

--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel