#!/usr/bin/perl
my
$exitstatus
;
GetOptions(
'exitstatus!'
, \
$exitstatus
)
or
die
"$0 [--exitstatus]"
;
my
%files
;
my
$missing
= 0;
my
$bonus
= 0;
open
my
$fh
,
'<'
,
'MANIFEST'
or
die
"Can't read MANIFEST: $!\n"
;
for
my
$line
(<
$fh
>) {
my
(
$file
) =
$line
=~ /^(\S+)/;
++
$files
{
$file
};
next
if
-f
$file
;
++
$missing
;
print
"$file from MANIFEST doesn't exist\n"
;
}
close
$fh
;
find {
wanted
=>
sub
{
return
if
-d;
return
if
$_
eq
'.mailmap'
;
return
if
$_
eq
'.gitignore'
;
return
if
$_
eq
'.gitattributes'
;
return
if
$_
eq
'.git_patch'
;
my
$x
=
$File::Find::name
=~ s!^\./!!r;
return
if
$x
=~ /^\.git\b/;
return
if
$x
=~ m{^\.github/};
return
if
$files
{
$x
};
++
$bonus
;
print
"$x\t\tnot in MANIFEST\n"
;
},
},
"."
;
my
$exitcode
=
$exitstatus
?
$missing
+
$bonus
: 0;
$exitcode
= SKIP - 1
if
$exitcode
> SKIP;
exit
$exitcode
;