RexOps / Rex

Rex, the friendly automation framework
https://www.rexify.org
716 stars 223 forks source link

include project lib before system directories #1108

Closed ferki closed 7 years ago

ferki commented 7 years ago

@wiktor-b had a strange issue with a project which has PerlRequires described in meta.yml, and those dependencies are installed via rexify --resolve-deps into the projects local lib/perl directory. Otherwise his setup relies on system perl on Gentoo.

One of those dependency modules was also installed as part of the system setup, but with an older version than needed by the project, and rex failed to pick the one installed by the above rexify command.

By running rex -e 'say join "\n", @INC', we saw that the system libraries are included before the local lib directory, which makes rex pick up the system perl, despite we expected that the newer one being used from the local lib (as described as part of the project).

We think the projectd lib directory should always come before the system libs, probably by using unshift instead of push in push_lib_to_inc in Rex.pm.

ps.: there seems to be two coderefs pushed into @INC as well, which seems bogus, but we're unsure if it's related to the same issue or not.

wikkyk commented 7 years ago

I've managed to work around this by setting PERLLIB=$project_dir/lib/perl/lib/perl5/x86_64-linux, which pushed the relevant dependency near the top of the list, so this is definitely down to the load order.

krimdomu commented 7 years ago

hi @ferki and @wiktor-b thanks for the report.

Before we change things with @INC we need to write tests for it, so that we can be sure that we don't break other things.