On Wednesday, February 20, 2002, at 03:03 PM, Michael G Schwern wrote:
> Patch against the current CPAN alpha, please.  bleadperl is a little
> behind.  Send the patches to [EMAIL PROTECTED] and I'll see them.
> http://www.cpan.org/authors/id/M/MS/MSCHWERN/ExtUtils-
> MakeMaker-5.49_01.tar.gz

Okey doke, here's the patch.  It's tested, too - much easier to test 
when EU::MM is in its own tarball! =)

=======================================================================
--- lib/ExtUtils/Manifest-old.pm        Fri Jan 18 01:22:37 2002
+++ lib/ExtUtils/Manifest.pm    Thu Feb 21 01:18:18 2002
@@ -10,7 +10,7 @@

  our ($VERSION,@ISA,@EXPORT_OK,
            $Is_MacOS,$Is_VMS,
-           $Debug,$Verbose,$Quiet,$MANIFEST,$found,$DEFAULT_MSKIP);
+           $Debug,$Verbose,$Quiet,$MANIFEST,$DEFAULT_MSKIP);

  $VERSION = 1.35_00;
  @ISA=('Exporter');
@@ -40,14 +40,19 @@
      local *M;
      rename $MANIFEST, "$MANIFEST.bak" unless $manimiss;
      open M, ">$MANIFEST" or die "Could not open $MANIFEST: $!";
-    my $matches = _maniskip();
+    my $skip = _maniskip();
      my $found = manifind();
      my($key,$val,$file,%all);
      %all = (%$found, %$read);
      $all{$MANIFEST} = ($Is_VMS ? "$MANIFEST\t\t" : '') . 'This list of 
files'
          if $manimiss; # add new MANIFEST to known file list
      foreach $file (sort keys %all) {
-       next if &$matches($file);
+       if ($skip->($file)) {
+           # Policy: only remove files if they're listed in MANIFEST.SKIP.
+           # Don't remove files just because they don't exist.
+           warn "Removed from $MANIFEST: $file\n" if $Verbose and exists 
$read->{$file};
+           next;
+       }
        if ($Verbose){
            warn "Added to $MANIFEST: $file\n" unless exists $read->{$file};
        }
@@ -63,15 +68,27 @@
  }

  sub manifind {
-    local $found = {};
-    find(sub {return if -d $_;
-             (my $name = $File::Find::name) =~ s|^\./||;
-             $name =~ s/^:([^:]+)$/$1/ if $Is_MacOS;
-             warn "Debug: diskfile $name\n" if $Debug;
-             $name =~ s#(.*)\.$#\L$1# if $Is_VMS;
-             $name = uc($name) if /^MANIFEST/i && $Is_VMS;
-             $found->{$name} = "";}, $Is_MacOS ? ":" : ".");
-    $found;
+    my $p = shift || {};
+    my $skip = _maniskip(warn => $p->{warn_on_skip});
+    my $found = {};
+
+    my $wanted = sub {
+       return if $skip->($_) or -d $_;
+       
+       (my $name = $File::Find::name) =~ s|^\./||;
+       $name =~ s/^:([^:]+)$/$1/ if $Is_MacOS;
+       warn "Debug: diskfile $name\n" if $Debug;
+       $name =~ s#(.*)\.$#\L$1# if $Is_VMS;
+       $name = uc($name) if /^MANIFEST/i && $Is_VMS;
+       $found->{$name} = "";
+    };
+
+    find({wanted => $wanted,
+         preprocess => sub {grep {!$skip->($_)} @_},
+        },
+        $Is_MacOS ? ":" : ".");
+
+    return $found;
  }

  sub fullcheck {
@@ -93,7 +110,8 @@
  sub _manicheck {
      my($p) = @_;
      my $read = maniread();
-    my $found = manifind();
+    my $found = manifind($p);
+
      my $file;
      my $dosnames=(defined(&Dos::UseLFN) && Dos::UseLFN()==0);
      my(@missfile,@missentry);
@@ -170,12 +188,11 @@

  # returns an anonymous sub that decides if an argument matches
  sub _maniskip {
-    my ($mfile) = @_;
-    my $matches = sub {0};
+    my (%args) = @_;
      my @skip ;
-    $mfile ||= "$MANIFEST.SKIP";
+    my $mfile = "$MANIFEST.SKIP";
      local *M;
-    open M, $mfile or open M, $DEFAULT_MSKIP or return $matches;
+    open M, $mfile or open M, $DEFAULT_MSKIP or return(sub {0});
      while (<M>){
        chomp;
        next if /^#/;
@@ -183,14 +200,16 @@
        push @skip, _macify($_);
      }
      close M;
-    my $opts = $Is_VMS ? 'oi ' : 'o ';
-    my $sub = "\$matches = "
-       . "sub { my(\$arg)=\@_; return 1 if "
-       . join (" || ",  (map {s!/!\\/!g; "\$arg =~ m/$_/$opts"} @skip), 0)
-       . " }";
-    eval $sub;
-    print "Debug: $sub\n" if $Debug;
-    $matches;
+    my $opts = $Is_VMS ? 'oi' : 'o';
+
+    # Make sure each entry is isolated in its own parentheses, in case
+    # any of them contain alternations
+    my $regex = join '|', map "(?:$_)", @skip;
+
+    return ($args{warn}
+           ? sub { $_[0] =~ qr{(?$opts)$regex} && warn "Skipping $_[0]\n" }
+           : sub { $_[0] =~ qr{(?$opts)$regex} }
+          );
  }

  sub manicopy {
=======================================================================



BTW, you've got MANIFEST.SKIP in the MANIFEST for that tarball, it 
should probably be removed?

  -Ken

Reply via email to