thaljef / Pinto

Curate your own repository of Perl modules
https://metacpan.org/module/Pinto::Manual
66 stars 49 forks source link

Big problem with Perlbrew #197

Open akarelas opened 9 years ago

akarelas commented 9 years ago

I'm writing here the reproducible steps that lead to disaster.

On Ubuntu server 14.04 (trusty) 64-bit. I installed perlbrew with the curl installer, and installed pinto with the curl installer, both as simple user (not root).

Added these lines to my ~/.bashrc source ~/perl5/perlbrew/etc/bashrc source /home/karjala/opt/local/pinto/etc/bashrc

I brewed perl 5.20.2 as user karjala, switched to it, did perlbrew lib create athenspm, and perlbrew switch to athenspm. Then I did pinto new --default p520

Then I did pinto pull <thisfile, where thisfile contains these lines:

XML::RSS
Mojolicious
Mojolicious::Plugin::RenderFile

Throwable
# for throwable
indirect
multidimensional
bareword::filehandles

Rose::DB::Object
# For Rose::DB::Object
Package::Stash::XS

aliased
DateTime::Format::ISO8601
EV
IO::Socket::SSL
TYEMQ/Algorithm-Diff-1.1902.tar.gz
#Algorithm::Diff
JSON
JSON::XS
App::cpanminus
XML::Atom
Mozilla::CA
Mojolicious::Plugin::OAuth2
Session::Token
DateTime::Format::RFC3339
URI::Escape
XML::MyXML
Mojolicious::Plugin::AccessLog
Perl::Critic
List::MoreUtils

App::Cronjob
Redis
experimental

Net::Twitter::Lite
Net::OAuth

Then I did pinto install <thisfile twice.

First time it worked (with installation failures, but worked).

Second time this error was output, and pinto didn't even run.

DBIx::Class::Schema::throw_exception(): Parse::CPAN::Meta version 1.4414 required--this is only version 1.4404 at /home/karjala/.perlbrew/libs/perl-5.20.2@athenspm/lib/perl5/CPAN/Meta.pm line 61, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/.perlbrew/libs/perl-5.20.2@athenspm/lib/perl5/CPAN/Meta.pm line 61, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Schema/Result/Distribution.pm line 75, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Schema/Result/Distribution.pm line 75, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Class/C3/Componentised.pm line 150, <STDIN> line 40. at /home/karjala/opt/local/pinto/lib/perl5/Class/C3/Componentised.pm line 155
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Database.pm line 13, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Database.pm line 13, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Repository.pm line 17, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Repository.pm line 17, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Pinto.pm line 13, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/opt/local/pinto/lib/perl5/Pinto.pm line 13, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Module/Runtime.pm line 317, <STDIN> line 40. at /home/karjala/opt/local/pinto/lib/perl5/App/Cmd.pm line 282.

I know I didn't set my stack's props of target perl version to 5.20, but still, pinto should be able to run, shouldn't it? I tried these steps on two separate Ubuntu servers VMs.

thaljef commented 9 years ago

I think I've figured this out. Basically, the core versions of some dual-life modules have gotten ahead of the versions provided by Stratopan (such as CPAN::Meta) so cpanm is choosing not to install them. This creates trouble later on when you install something into your brewed perl that conflicts with the stuff inside $PINTO_HOME/lib/perl5.

I thought the installer script would have insulated you from all this mess. But as usual, Perl is never so simple. It seems I need to keep updating Pinto's dependencies to ensure you always have a complete set in $PINTO_HOME. Grr. I'll let you know when that is done.

thaljef commented 9 years ago

For now, I think your workaround might be this:

cpanm -L $PINTO_HOME Parse::CPAN::Meta CPAN::Meta
thaljef commented 9 years ago

Well, I probably got different failures when installing those modules, but so far I haven't been able to reproduce the bug (at least not on this Mac). Will try again tomorrow.

akarelas commented 9 years ago

You should be able to reproduce it if working on a VM. When you finish updating the Pinto modules, let me know so I can re-test and tell you whether it's fixed.

akarelas commented 9 years ago

Has this bug been fixed? I don't know about Perl 5.20 (the version of Perl this bug initially referred to), but with 5.22 it's not ocurring anymore.

akarelas commented 9 years ago

I'm testing it now...

akarelas commented 9 years ago

I think 5.20.2 doesn't work well with pinto, now... I don't care at all to be honest, I just want to report it, nothing more.

I installed pinto from the beginning, after perlbrew switching to perl 5.20. And I get this:

karjala@test-vm:~$ pinto log
Class::MOP::load_class is deprecated at /home/karjala/opt/local/pinto/lib/perl5/x86_64-linux/Class/MOP.pm line 69.
        Class::MOP::load_class("DBIx::Class::Core", HASH(0x4aa0fe0)) called at /home/karjala/opt/local/pinto/lib/perl5/MooseX/NonMoose/Meta/Role/Class.pm line 247
etc
thaljef commented 9 years ago

You'll probably get the same warning on 5.22. But I just upgraded MooseX::NonMoose in the Stratopan repository, which should fix both 5.20 and 5.22.

akarelas commented 9 years ago

Ok. The original problem (see top of this page) is still there, on Perl 5.20. If I follow the steps exactly as described on the top message, I get:

karjala@dummy-vm:~$ pinto install <modules_list
{UNKNOWN}: Parse::CPAN::Meta version 1.4414 required--this is only version 1.4404 at /home/karjala/.perlbrew/libs/perl-5.20.2@athenspm/lib/perl5/CPAN/Meta.pm line 61, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/.perlbrew/libs/perl-5.20.2@athenspm/lib/perl5/CPAN/Meta.pm line 61, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Schema/Result/Distribution.pm line 75, <STDIN> line 40.
BEGIN failed--compilation aborted at /home/karjala/opt/local/pinto/lib/perl5/Pinto/Schema/Result/Distribution.pm line 75, <STDIN> line 40.
Compilation failed in require at /home/karjala/opt/local/pinto/lib/perl5/Class/C3/Componentised.pm line 150, <STDIN> line 40. at /home/karjala/opt/local/pinto/lib/perl5/Class/C3/Componentised.pm line 155
etc

However I now believe that the steps I described to reproduce the problem are flawed. Because I installed pinto while perlbrew was switched off, yet used pinto when perlbrew was switched to 5.20.

I tried installing pinto when perlbrew was switched to 5.20, and the problem disappeared.

Maybe we're just supposed to install and use pinto under the same version of perl.

Should I close this bug?

thaljef commented 9 years ago

I think I understand the problem now: perlbrew modifies PERL5LIB which puts additional paths at the front of @INC. So even though the shebang line in pinto points to the perl you used to install it, @INC could include directories of modules for a different perl and those will be searched first. This is problematic for core modules that aren't installed into PINTO_HOME.

I'm not sure how to solve this. Let me think on it.