From 8c57606294f48eb065dff03f7ffefc1e4e2cdce4 Mon Sep 17 00:00:00 2001 From: Jos Boumans Date: Tue, 6 Apr 2010 22:19:08 +0100 Subject: Explicitly set the location of cpanp-run-perl when under PERL_CORE CPANPLUS::Config checks 3 specific scenarios first when looking for cpanp-run-perl: parallel to cpanp, parallel to CPANPLUS.pm, or installed into a custom prefix like /tmp/foo. Only *THEN* does it check the the path. If the perl core is extracted to a directory that has cpanp-run-perl installed the same amount of 'uplevels' as the /tmp/foo prefix, we'll pull in the wrong script by accident. Since we set the path to cpanp-run-perl explicitily at the top of this script, it's best to update the config ourselves with a path lookup, rather than rely on its heuristics. Thanks to David Wheeler, Josh Jore and Vincent Pit for helping to track this down. Effects both CPANPLUS and CPANPLUS-Dist-Build --- cpan/CPANPLUS-Dist-Build/t/inc/conf.pl | 18 ++++++++++++++++++ cpan/CPANPLUS/t/inc/conf.pl | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/cpan/CPANPLUS-Dist-Build/t/inc/conf.pl b/cpan/CPANPLUS-Dist-Build/t/inc/conf.pl index f8268b1167..a104eb91de 100644 --- a/cpan/CPANPLUS-Dist-Build/t/inc/conf.pl +++ b/cpan/CPANPLUS-Dist-Build/t/inc/conf.pl @@ -187,6 +187,24 @@ sub gimme_conf { } } + ### CPANPLUS::Config checks 3 specific scenarios first + ### when looking for cpanp-run-perl: parallel to cpanp, + ### parallel to CPANPLUS.pm, or installed into a custom + ### prefix like /tmp/foo. Only *THEN* does it check the + ### the path. + ### If the perl core is extracted to a directory that has + ### cpanp-run-perl installed the same amount of 'uplevels' + ### as the /tmp/foo prefix, we'll pull in the wrong script + ### by accident. + ### Since we set the path to cpanp-run-perl explicitily + ### at the top of this script, it's best to update the config + ### ourselves with a path lookup, rather than rely on its + ### heuristics. Thanks to David Wheeler, Josh Jore and Vincent + ### Pit for helping to track this down. + if( $ENV{PERL_CORE} ) { + $conf->set_program( "perlwrapper" => IPC::Cmd::can_run('cpanp-run-perl') ); + } + $conf->set_conf( source_engine => $ENV{CPANPLUS_SOURCE_ENGINE} ) if $ENV{CPANPLUS_SOURCE_ENGINE}; diff --git a/cpan/CPANPLUS/t/inc/conf.pl b/cpan/CPANPLUS/t/inc/conf.pl index 1287ec9df9..4f6c3d68ce 100644 --- a/cpan/CPANPLUS/t/inc/conf.pl +++ b/cpan/CPANPLUS/t/inc/conf.pl @@ -150,6 +150,24 @@ sub gimme_conf { } } + ### CPANPLUS::Config checks 3 specific scenarios first + ### when looking for cpanp-run-perl: parallel to cpanp, + ### parallel to CPANPLUS.pm, or installed into a custom + ### prefix like /tmp/foo. Only *THEN* does it check the + ### the path. + ### If the perl core is extracted to a directory that has + ### cpanp-run-perl installed the same amount of 'uplevels' + ### as the /tmp/foo prefix, we'll pull in the wrong script + ### by accident. + ### Since we set the path to cpanp-run-perl explicitily + ### at the top of this script, it's best to update the config + ### ourselves with a path lookup, rather than rely on its + ### heuristics. Thanks to David Wheeler, Josh Jore and Vincent + ### Pit for helping to track this down. + if( $ENV{PERL_CORE} ) { + $conf->set_program( "perlwrapper" => IPC::Cmd::can_run('cpanp-run-perl') ); + } + $conf->set_conf( source_engine => $ENV{CPANPLUS_SOURCE_ENGINE} ) if $ENV{CPANPLUS_SOURCE_ENGINE}; -- cgit v1.2.1