From: Jarkko Hietaniemi Date: Sun, 15 Apr 2001 19:34:09 +0000 (+0000) Subject: Integrate changes #9706,9707 from maintperl into mainline. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=007a26ab2be0b873237f3a61ccecf090ddb56db1;p=p5sagit%2Fp5-mst-13.2.git Integrate changes #9706,9707 from maintperl into mainline. change#7210 broke .packlist generation ExtUtils::Installed doesn't quote regex metacharacters in paths before using them in match; also make it work for dosish platforms p4raw-link: @9707 on //depot/maint-5.6/perl: db42da4c9800ba185697f6472eccf880cdf1ccee p4raw-link: @9706 on //depot/maint-5.6/perl: cb820f7234868a6a8a82c3314f11a1c3d25756a4 p4raw-link: @7210 on //depot/perl: a9d83807f0f0b611a2eea3bda7bb80eac9d5b104 p4raw-id: //depot/perl@9709 p4raw-integrated: from //depot/maint-5.6/perl@9708 'copy in' lib/ExtUtils/Install.pm (@8642..) 'merge in' lib/ExtUtils/Installed.pm (@5902..) --- diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index c496aa0..0a1b549 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -120,7 +120,6 @@ sub install { return unless -f _; return if $_ eq ".exists"; my $targetdir = MY->catdir($targetroot, $File::Find::dir); - my $origfile = $_; my $targetfile = MY->catfile($targetdir, $_); my $diff = 0; @@ -156,7 +155,7 @@ sub install { } else { inc_uninstall($_,$File::Find::dir,$verbose,0); # nonono set to 0 } - $packlist->{$origfile}++; + $packlist->{$targetfile}++; }, "."); chdir($cwd) or Carp::croak("Couldn't chdir to $cwd: $!"); diff --git a/lib/ExtUtils/Installed.pm b/lib/ExtUtils/Installed.pm index b7ff815..12cb5e0 100644 --- a/lib/ExtUtils/Installed.pm +++ b/lib/ExtUtils/Installed.pm @@ -8,7 +8,28 @@ use ExtUtils::MakeMaker; use Config; use File::Find; use File::Basename; -our $VERSION = '0.02'; +our $VERSION = '0.03'; + +my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); + +sub _is_prefix +{ +my ($self, $path, $prefix) = @_; +if (substr($path, 0, length($prefix)) eq $prefix) + { + return(1); + } +if ($DOSISH) + { + $path =~ s|\\|/|g; + $prefix =~ s|\\|/|g; + if ($path =~ m{^\Q$prefix\E}i) + { + return(1); + } + } +return(0); +} sub _is_type($$$) { @@ -16,22 +37,18 @@ my ($self, $path, $type) = @_; return(1) if ($type eq "all"); if ($type eq "doc") { - return(substr($path, 0, length($Config{installman1dir})) - eq $Config{installman1dir} + return($self->_is_prefix($path, $Config{installman1dir}) || - substr($path, 0, length($Config{installman3dir})) - eq $Config{installman3dir} + $self->_is_prefix($path, $Config{installman3dir}) ? 1 : 0) } if ($type eq "prog") { - return(substr($path, 0, length($Config{prefix})) eq $Config{prefix} + return($self->_is_prefix($path, $Config{prefix}) && - substr($path, 0, length($Config{installman1dir})) - ne $Config{installman1dir} + !$self->_is_prefix($path, $Config{installman1dir}) && - substr($path, 0, length($Config{installman3dir})) - ne $Config{installman3dir} + !$self->_is_prefix($path, $Config{installman3dir}) ? 1 : 0); } return(0); @@ -43,7 +60,7 @@ my ($self, $path, @under) = @_; $under[0] = "" if (! @under); foreach my $dir (@under) { - return(1) if (substr($path, 0, length($dir)) eq $dir); + return(1) if ($self->_is_prefix($path, $dir)); } return(0); } @@ -54,21 +71,32 @@ my ($class) = @_; $class = ref($class) || $class; my $self = {}; +my $installarchlib = $Config{installarchlib}; +my $archlib = $Config{archlib}; +my $sitearch = $Config{sitearch}; + +if ($DOSISH) + { + $installarchlib =~ s|\\|/|g; + $archlib =~ s|\\|/|g; + $sitearch =~ s|\\|/|g; + } + # Read the core packlist $self->{Perl}{packlist} = - ExtUtils::Packlist->new("$Config{installarchlib}/.packlist"); + ExtUtils::Packlist->new("$installarchlib/.packlist"); $self->{Perl}{version} = $Config{version}; # Read the module packlists my $sub = sub { # Only process module .packlists - return if ($_) ne ".packlist" || $File::Find::dir eq $Config{installarchlib}; + return if ($_) ne ".packlist" || $File::Find::dir eq $installarchlib; # Hack of the leading bits of the paths & convert to a module name my $module = $File::Find::name; - $module =~ s!$Config{archlib}/auto/(.*)/.packlist!$1!s; - $module =~ s!$Config{sitearch}/auto/(.*)/.packlist!$1!s; + $module =~ s!\Q$archlib\E/auto/(.*)/.packlist!$1!s; + $module =~ s!\Q$sitearch\E/auto/(.*)/.packlist!$1!s; my $modfile = "$module.pm"; $module =~ s!/!::!g; @@ -87,7 +115,7 @@ my $sub = sub # Read the .packlist $self->{$module}{packlist} = ExtUtils::Packlist->new($File::Find::name); }; -find($sub, $Config{archlib}, $Config{sitearch}); +find($sub, $archlib, $sitearch); return(bless($self, $class)); }