1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
From: Niko Tyni <ntyni@debian.org>
Date: Fri, 19 Sep 2014 00:00:51 +0300
Subject: [PATCH] Allow loading from system path when running under autopkgtest
Forwarded: not-needed
When re-using the build time test suite as a runtime as-installed one,
we explicitly want to load Module::Build from the system paths. This
situation is detected by the AUTOPKGTEST_TMP environment variable, set by the
autopkgtest tool. See http://dep.debian.net/deps/dep8/
Rewiring check_compiler() to return early is to avoid a call
to M::B->current(), which needs a 'build_params' file remaining
from its own build.
--- a/t/lib/MBTest.pm
+++ b/t/lib/MBTest.pm
@@ -221,7 +221,7 @@ sub find_in_path {
}
sub check_compiler {
- if ($ENV{PERL_CORE}) {
+ if ($ENV{PERL_CORE} || $ENV{AUTOPKGTEST_TMP}) {
require IPC::Cmd;
if ( $Config{usecrosscompile} && !IPC::Cmd::can_run($Config{cc}) ) {
return;
@@ -272,7 +272,7 @@ sub blib_load {
(my $path = $mod) =~ s{::}{/}g;
$path .= ".pm";
my ($pkg, $file, $line) = caller;
- unless($ENV{PERL_CORE}) {
+ unless($ENV{PERL_CORE} || $ENV{AUTOPKGTEST_TMP}) {
unless($INC{$path} =~ m/\bblib\b/) {
(my $load_from = $INC{$path}) =~ s{$path$}{};
die "$mod loaded from '$load_from'\nIt should have been loaded from blib. \@INC contains:\n ",
|