diff options
author | Michael G. Schwern <schwern@pobox.com> | 2003-05-22 19:10:46 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-05-23 13:06:25 +0000 |
commit | 2530b651d288d7db98df4c0991f07a783a1cd32c (patch) | |
tree | 46e6b3c07f57558c3f532f12d621104bc7c9d4c8 /lib/ExtUtils/Manifest.pm | |
parent | a0d8a30e4d6cdcb83a19818856ccc52190cdd95f (diff) | |
download | perl-2530b651d288d7db98df4c0991f07a783a1cd32c.tar.gz |
ExtUtils::MakeMaker 6.10_03 -> 6.10_04
Message-ID: <20030523091046.GB11662@windhund.schwern.org>
p4raw-id: //depot/perl@19594
Diffstat (limited to 'lib/ExtUtils/Manifest.pm')
-rw-r--r-- | lib/ExtUtils/Manifest.pm | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/lib/ExtUtils/Manifest.pm b/lib/ExtUtils/Manifest.pm index 6f8ce1240e..d3d04b67bd 100644 --- a/lib/ExtUtils/Manifest.pm +++ b/lib/ExtUtils/Manifest.pm @@ -309,32 +309,33 @@ sub maniread { my $read = {}; local *M; unless (open M, $mfile){ - warn "$mfile: $!"; - return $read; + warn "$mfile: $!"; + return $read; } + local $_; while (<M>){ - chomp; - next if /^#/; + chomp; + next if /^#/; my($file, $comment) = /^(\S+)\s*(.*)/; next unless $file; - if ($Is_MacOS) { - $file = _macify($file); - $file =~ s/\\([0-3][0-7][0-7])/sprintf("%c", oct($1))/ge; - } - elsif ($Is_VMS) { - require File::Basename; - my($base,$dir) = File::Basename::fileparse($file); - # Resolve illegal file specifications in the same way as tar - $dir =~ tr/./_/; - my(@pieces) = split(/\./,$base); - if (@pieces > 2) { $base = shift(@pieces) . '.' . join('_',@pieces); } - my $okfile = "$dir$base"; - warn "Debug: Illegal name $file changed to $okfile\n" if $Debug; + if ($Is_MacOS) { + $file = _macify($file); + $file =~ s/\\([0-3][0-7][0-7])/sprintf("%c", oct($1))/ge; + } + elsif ($Is_VMS) { + require File::Basename; + my($base,$dir) = File::Basename::fileparse($file); + # Resolve illegal file specifications in the same way as tar + $dir =~ tr/./_/; + my(@pieces) = split(/\./,$base); + if (@pieces > 2) { $base = shift(@pieces) . '.' . join('_',@pieces); } + my $okfile = "$dir$base"; + warn "Debug: Illegal name $file changed to $okfile\n" if $Debug; $file = $okfile; $file = lc($file) unless $file =~ /^MANIFEST(\.SKIP)?$/; - } + } $read->{$file} = $comment; } @@ -346,7 +347,7 @@ sub maniread { sub _maniskip { my @skip ; my $mfile = "$MANIFEST.SKIP"; - local *M; + local(*M,$_); open M, $mfile or open M, $DEFAULT_MSKIP or return sub {0}; while (<M>){ chomp; @@ -417,6 +418,7 @@ sub cp_if_diff { local(*F,*T); open(F,"< $from\0") or die "Can't read $from: $!\n"; if (open(T,"< $to\0")) { + local $_; while (<F>) { $diff++,last if $_ ne <T>; } $diff++ unless eof(T); close T; @@ -534,6 +536,7 @@ sub maniadd { my($additions) = shift; _normalize($additions); + _fix_manifest($MANIFEST); my $manifest = maniread(); open(MANIFEST, ">>$MANIFEST") or die "Could not open $MANIFEST: $!"; @@ -545,6 +548,26 @@ sub maniadd { close MANIFEST; } + +# Sometimes MANIFESTs are missing a trailing newline. Fix this. +sub _fix_manifest { + my $manifest_file = shift; + + open MANIFEST, $MANIFEST or die "Could not open $MANIFEST: $!"; + + # Yes, we should be using seek(), but I'd like to avoid loading POSIX + # to get SEEK_* + my @manifest = <MANIFEST>; + close MANIFEST; + + unless( $manifest[-1] =~ /\n\z/ ) { + open MANIFEST, ">>$MANIFEST" or die "Could not open $MANIFEST: $!"; + print MANIFEST "\n"; + close MANIFEST; + } +} + + # UNIMPLEMENTED sub _normalize { return; |