From 8bdcd91ffad455b1d5f181de6cbee943d6d93683 Mon Sep 17 00:00:00 2001 From: Ed J Date: Sun, 10 May 2015 22:00:25 +0100 Subject: [PATCH] Doc, implement #!include_default as memory-only, not changing file. --- Changes | 1 + lib/ExtUtils/Manifest.pm | 48 ++++++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Changes b/Changes index fbcd1c3..e9036a0 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - #!include_default now memory-only, not changing MANIFEST.SKIP file. 1.70 2014-12-31 - also skip _eumm, an artifact of ExtUtils::MakeMaker 7.05* diff --git a/lib/ExtUtils/Manifest.pm b/lib/ExtUtils/Manifest.pm index c9f44a1..0b5effe 100644 --- a/lib/ExtUtils/Manifest.pm +++ b/lib/ExtUtils/Manifest.pm @@ -404,6 +404,20 @@ a given filename should be skipped. =cut +sub _process_skipline { + local $_ = shift; + chomp; + s/\r//; + $_ =~ qr{^\s*(?:(?:'([^\\']*(?:\\.[^\\']*)*)')|([^#\s]\S*))?(?:(?:\s*)|(?:\s+(.*?)\s*))$}; + #my $comment = $3; + my $filename = $2; + if ( defined($1) ) { + $filename = $1; + $filename =~ s/\\(['\\])/$1/g; + } + $filename; +} + # returns an anonymous sub that decides if an argument matches sub maniskip { my @skip ; @@ -412,16 +426,14 @@ sub maniskip { local(*M, $_); open M, "< $mfile" or open M, "< $DEFAULT_MSKIP" or return sub {0}; while (){ - chomp; - s/\r//; - $_ =~ qr{^\s*(?:(?:'([^\\']*(?:\\.[^\\']*)*)')|([^#\s]\S*))?(?:(?:\s*)|(?:\s+(.*?)\s*))$}; - #my $comment = $3; - my $filename = $2; - if ( defined($1) ) { - $filename = $1; - $filename =~ s/\\(['\\])/$1/g; + if (/^#!include_default\s*$/) { + if (my @default = _include_mskip_file()) { + warn "Debug: Including default MANIFEST.SKIP\n" if $Debug; + push @skip, grep $_, map _process_skipline($_), @default; + } + next; } - next if (not defined($filename) or not $filename); + next unless my $filename = _process_skipline($_); push @skip, _macify($filename); } close M; @@ -452,14 +464,6 @@ sub _check_mskip_directives { return; } while () { - if (/^#!include_default\s*$/) { - if (my @default = _include_mskip_file()) { - push @lines, @default; - warn "Debug: Including default MANIFEST.SKIP\n" if $Debug; - $flag++; - } - next; - } if (/^#!include\s+(.*)\s*$/) { my $external_file = $1; if (my @external = _include_mskip_file($external_file)) { @@ -812,11 +816,17 @@ files. At present two such directives are recognized. =item #!include_default -This inserts the contents of the default MANIFEST.SKIP file +This tells ExtUtils::Manifest to read the default F +file and skip files accordingly, but I to include it in the local +F. This is intended to skip files according to a system +default, which can change over time without requiring further changes +to the distribution's F. =item #!include /Path/to/another/manifest.skip -This inserts the contents of the specified external file +This inserts the contents of the specified external file in the local +F. This is intended for authors to have a central +F file, and to include it with their various distributions. =back