Skip to content

Commit f175035

Browse files
committed
Revert commit 59c2e8, add test for PM_FILTER, fix RT-144085
1 parent 3966577 commit f175035

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

lib/ExtUtils/MM_Unix.pm

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,11 +2151,6 @@ sub init_PERL {
21512151
# already escaped spaces.
21522152
$self->{FULLPERL} =~ tr/"//d if $Is{VMS};
21532153

2154-
# `dmake` can fail for image (aka, executable) names which start with double-quotes
2155-
# * push quote inward by at least one character (or the drive prefix, if present)
2156-
# * including any initial directory separator preserves the `file_name_is_absolute` property
2157-
$self->{FULLPERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake');
2158-
21592154
# Little hack to get around VMS's find_perl putting "MCR" in front
21602155
# sometimes.
21612156
$self->{ABSPERL} = $self->{PERL};
@@ -2178,11 +2173,6 @@ sub init_PERL {
21782173
# already escaped spaces.
21792174
$self->{PERL} =~ tr/"//d if $Is{VMS};
21802175

2181-
# `dmake` can fail for image (aka, executable) names which start with double-quotes
2182-
# * push quote inward by at least one character (or the drive prefix, if present)
2183-
# * including any initial directory separator preserves the `file_name_is_absolute` property
2184-
$self->{PERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake');
2185-
21862176
# Are we building the core?
21872177
$self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE};
21882178
$self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE};
@@ -3201,11 +3191,17 @@ pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
32013191

32023192
# VMS will swallow '' and PM_FILTER is often empty. So use q[]
32033193
my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
3204-
pm_to_blib({\@ARGV}, '$autodir', q[\$(PM_FILTER)], '\$(PERM_DIR)')
3194+
\$i=0; \$i++ until \$i > \$#ARGV or \$ARGV[\$i] eq "--";
3195+
die "Failed to find -- in ".join("|",\@ARGV) if \$i > \$#ARGV;
3196+
\@parts=splice \@ARGV,0,\$i+1;
3197+
pop \@parts; \$filter=join " ", map qq{"\$_"}, \@parts;
3198+
pm_to_blib({\@ARGV}, '$autodir', \$filter, '\$(PERM_DIR)')
32053199
CODE
3200+
$pm_to_blib .= q[ $(PM_FILTER) --];
32063201

32073202
my @cmds = $self->split_command($pm_to_blib,
3208-
map { ($self->quote_literal($_) => $self->quote_literal($self->{PM}->{$_})) } sort keys %{$self->{PM}});
3203+
map +($self->quote_literal($_) => $self->quote_literal($self->{PM}{$_})),
3204+
sort keys %{$self->{PM}});
32093205

32103206
$r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds;
32113207
$r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n};

lib/ExtUtils/MakeMaker.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,6 @@ END
693693
} else {
694694
my $value = $self->{$key};
695695
# not going to test in FS so only stripping start
696-
$value =~ s/"// if $key =~ /PERL$/ and $self->is_make_type('dmake');
697696
$value =~ s/^"// if $key =~ /PERL$/;
698697
$value = $self->catdir("..", $value)
699698
unless $self->file_name_is_absolute($value);

t/basic.t

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use ExtUtils::MM;
2525
use Test::More
2626
!MM->can_run(make()) && $ENV{PERL_CORE} && $Config{'usecrosscompile'}
2727
? (skip_all => "cross-compiling and make not available")
28-
: (tests => 195);
28+
: (tests => 198);
2929
use File::Find;
3030
use File::Spec;
3131
use File::Path;
@@ -472,6 +472,18 @@ $realclean_out = run("$make realclean");
472472
rmtree 'Liar';
473473
rmtree $DUMMYINST;
474474

475+
# test PM_FILTER - RT#144085
476+
$text = $preserve_MPL;
477+
ok(($text =~ s:\);: PM_FILTER => '\$(ABSPERLRUN) -ne "print unless /^\\#/"',\n$&:), 'successful M.PL edit');
478+
write_file($file, $text);
479+
@mpl_out = run(qq{$perl Makefile.PL});
480+
$test_out = run("$make test NOECHO=");
481+
like( $test_out, qr/All tests successful/, 'make test' );
482+
is( $?, 0, ' exited normally' ) ||
483+
diag $test_out;
484+
write_file($file, $preserve_MPL); # restore Makefile.PL
485+
$realclean_out = run("$make realclean");
486+
475487
sub _normalize {
476488
my $hash = shift;
477489
%$hash= map { lc($_) => $hash->{$_} } keys %$hash;

0 commit comments

Comments
 (0)