AFS-Command
view release on metacpan or search on metacpan
util/bin/check_copyright view on Meta::CPAN
#!/ms/dist/perl5/bin/perl
#
# $Id: check_copyright,v 7.1 2004/01/13 19:01:52 wpm Exp $
#
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#
# This hack is just to sanity check that my copyright is found
# everywhere....
#
# To run this, from the top level source directory,
# ./util/check_copyright
#
use Getopt::Long;
use File::Basename;
GetOptions( \%args, qw( update ) ) || die;
%skip = map { $_ => 1 }
qw(
.options/rcsMajor
.msbaseline
.exclude
MANIFEST
Changes.html
README.html
ToDo.html
);
warn "Searching source tree for files...\n";
open(FIND,"find . -type f -print |") ||
die "Unable to fork find: $!\n";
while ( <FIND> ) {
chomp;
s|^\./||;
next if $skip{$_};
next if /~$/;
push(@file,$_);
}
close(FIND) ||
die "Error running find: $!\n";
$thisyear = (localtime())[5] + 1900;
foreach my $file ( sort @file ) {
open(FILE,$file) || die "Unable to open $file: $!\n";
my $found = 0;
my $old = 0;
while ( <FILE> ) {
#
# OK, if I wasn't so damn lazy, I'd parse the COPYRIGHT file,
# but I'm lazy...
#
next unless /\(c\) ([\d\-\s,]+) Morgan Stanley and Co\./;
$found = 1;
my $year = $1;
$old = 1 if $year !~ /\b$thisyear$/;
last;
}
close(FILE);
push(@missing,$file) unless $found;
push(@old,$file) if $old;
}
unless ( @missing || @old ) {
warn "Everythings OK.... don't panic.\n";
exit 0;
}
if ( @missing ) {
warn("The following files have no copyright notice:\n\t" .
join("\n\t",@missing) . "\n");
}
( run in 1.163 second using v1.01-cache-2.11-cpan-140bd7fdf52 )