summaryrefslogtreecommitdiff
path: root/Porting/manicheck
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-12-20 23:28:17 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-12-20 23:29:36 +0100
commit4d1e77f96f82d16036b88dca7b4fa2cd3a59bf21 (patch)
tree6bff216dce85efe536096ece109374f220b87064 /Porting/manicheck
parenta21dc152d0bd90f991fd36bbf1eeacf5983636c6 (diff)
downloadperl-4d1e77f96f82d16036b88dca7b4fa2cd3a59bf21.tar.gz
Replace Jarkko's manicheck utility with my own
My manicheck is more crude, but I find its output more readable, and more importantly it handles git-related files and directories. Options can be re-added later.
Diffstat (limited to 'Porting/manicheck')
-rw-r--r--Porting/manicheck97
1 files changed, 17 insertions, 80 deletions
diff --git a/Porting/manicheck b/Porting/manicheck
index 251c7ee5bf..04392921a6 100644
--- a/Porting/manicheck
+++ b/Porting/manicheck
@@ -1,86 +1,23 @@
-#!/usr/bin/perl -ws
-
-#
-# 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 /;
- };
-}
+#!/usr/bin/perl
use strict;
-
-sub help {
- die <<EOF;
-$0: Usage: $0 [-x|-m|-l|-h]
--x show only the extra files
--m show only the missing files
--l show the files one per line instead of one line
--h show only this help
-EOF
-}
-
-use vars qw($x $m $l $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{$_};
-}
-for (sort keys %mani) {
- push @miss, $_ unless $find{$_};
+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;
}
-
-$" = "\n" if $l;
-
-unshift @xtra, "extra:" if @xtra && !$x;
-unshift @miss, "missing:" if @miss && !$m;
-
-print "@xtra\n", if @xtra && !$m;
-print "@miss\n" 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 "$File::Find::name not in MANIFEST\n" if !$files{$x};
+ },
+}, ".";