perl-CPAN/CPAN-2.14-For-cpan-j-make-t...

53 lines
1.6 KiB
Diff

From 8b3473d00f9490f8ee07425ef44b23c6f72a8938 Mon Sep 17 00:00:00 2001
From: brian d foy <brian.d.foy@gmail.com>
Date: Tue, 18 Oct 2016 16:02:51 -0400
Subject: [PATCH] For cpan -j, make the file an absolute path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is an additional fix for rt.cpan.org #116507.
Since . will not be in @INC, we can't assume we are
loading from the current directory (although that's
a very likely situation for -j). Take whatever
argument we get and expand it to an absolute path.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/App/Cpan.pm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/App/Cpan.pm b/lib/App/Cpan.pm
index 6561bd4..a9e73cd 100644
--- a/lib/App/Cpan.pm
+++ b/lib/App/Cpan.pm
@@ -291,7 +291,7 @@ use CPAN 1.80 (); # needs no test
use Config;
use autouse Cwd => qw(cwd);
use autouse 'Data::Dumper' => qw(Dumper);
-use File::Spec::Functions;
+use File::Spec::Functions qw(catfile file_name_is_absolute rel2abs);
use File::Basename;
use Getopt::Std;
@@ -1095,12 +1095,14 @@ sub _shell
sub _load_config # -j
{
- my $file = shift || '';
+ my $argument = shift;
+
+ my $file = file_name_is_absolute( $argument ) ? $argument : rel2abs( $argument );
+ croak( "cpan config file [$file] for -j does not exist!\n" ) unless -e $file;
# should I clear out any existing config here?
$CPAN::Config = {};
delete $INC{'CPAN/Config.pm'};
- croak( "Config file [$file] does not exist!\n" ) unless -e $file;
my $rc = eval "require '$file'";
--
2.7.4