This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Create inversion list for Assigned code points
[perl5.git] / Porting / manicheck
index e2a33ec..b544a12 100644 (file)
@@ -1,80 +1,27 @@
-#!/usr/bin/perl -ws
+#!/usr/bin/perl
 
-#
-# manicheck - check files against the MANIFEST
-#
-# Without options prints out (possibly) two lines:
-#
-# extra: a b c
-# missing: d
-#
-# With option -x prints out only the missing files (and without the "extra: ")
-# With option -m prints out only the extra files (and without the "missing: ")
-#
-
-BEGIN {
-  $SIG{__WARN__} = sub {
-    help() if $_[0] =~ /"main::\w" used only once: possible typo at /;
-  };
-}
+# output a list of:
+#  a) files listed in MANIFEST which don't exist
+#  b) files which exist but which aren't in MANIFEST
 
 use strict;
-
-sub help {
-  die <<EOF;
-$0: Usage: $0 [-x|-m|-h]
--x show only the extra files
--m show only the missing files
--h show only this help
-EOF
-}
-
-use vars qw($x $m $h);
-
-help() if $h;
-
-open(MANIFEST, "MANIFEST") or die "MANIFEST: $!";
-
-my %mani;
-my %mand = qw(. 1);
-use File::Basename qw(dirname);
-
-while (<MANIFEST>) {
-  if (/^(\S+)\t+(.+)$/) {
-    $mani{$1}++;
-    my $d = dirname($1);
-    while($d ne '.') {
-       $mand{$d}++;
-       $d = dirname($d);
-    }
-  } else {
-    warn "MANIFEST:$.:$_";
-  }
-}
-
-close(MANIFEST);
-
-my %find;
+use warnings;
 use File::Find;
-find(sub {
-       my $n = $File::Find::name;
-       $n =~ s:^\./::;
-       $find{$n}++;
-     }, '.' );
-
-my @xtra;
-my @miss;
 
-for (sort keys %find) {
-  push @xtra, $_ unless $mani{$_} || $mand{$_};
+open my $fh, '<', 'MANIFEST' or die "Can't read MANIFEST: $!\n";
+my @files = map { (split)[0] } <$fh>;
+close $fh;
+for (@files) {
+    print "$_ from MANIFEST doesn't exist\n" if ! -f;
 }
-
-for (sort keys %mani) {
-  push @miss, $_ unless $find{$_};
-}
-
-printf("%s@xtra\n", $x || $m ? "" : "extra: ")   if @xtra && !$m;
-printf("%s@miss\n", $x || $m ? "" : "missing: ") if @miss && !$x;
-
-exit 0;
+my %files = map { $_ => 1 } @files;
+find {
+    wanted => sub {
+        my $x = $File::Find::name; $x =~ s/^..//;
+        return if -d;
+        return if $_ eq '.gitignore';
+        return if $x =~ /^\.git\b/;
+        print "$x\t\tnot in MANIFEST\n" if !$files{$x};
+    },
+}, ".";