bazel-contrib / rules_perl

Perl rules for Bazel
Apache License 2.0
26 stars 37 forks source link

perl_rules: Fix runfiles lookup in sandbox #11

Closed pziggo closed 4 years ago

pziggo commented 4 years ago

With the command line flag --nobuild_runfile_links, the tool wrapper for perl cannot find the runfiles anymore. It searches outside the sandbox due to the resolution of the symlinks. But with the flag applied, the runfiles tree is not created outside the sandbox.

With this change, the wrapper scripts also works if the runfiles tree is omitted.

pziggo commented 4 years ago
//examples/env:env_test       FAILED in 3 out of 3 in 0.1s

This one should be fixed once PR https://github.com/bazelbuild/rules_perl/pull/7 is merged.

pziggo commented 4 years ago
//examples/fibonacci:fibonacci_test    FAILED in 0.1s

Is a bit tricky, it fails locally on Ubuntu 19.04 with perl 5.28 as well but with the following error message:

Can't locate examples/fibonacci/fibonacci.pm in @INC (you may need to install the examples::fibonacci::fibonacci module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base)

The current directory (".") has been removed from @INC in version >= 5.26. As far as I understand this breaks with how rules_perl includes perl_library in general?

In any case, bazelci is configured to use Ubuntu 16.04 only which ships with an older version of perl. Thus I'm unsure if bazel CI runs into the same issue. Adding the flag --test_output=errors might be a good thing to do in order to help contributors understanding the results.

qiwzhang commented 4 years ago

@pziggo could you fix the test failure?

pziggo commented 4 years ago

Rebasing the change on top of PR #7 also fixed the second issue.