#! /usr/bin/perl -w # # This file is part of DisOrder. # Copyright (C) 2005, 2006 Richard Kettlewell # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA # use strict; my $year; my %checked = (); my %removed = (); my $prefix = -e ".src" ? ".src/" : ""; my $what = ""; my $original; my @exceptions; my %exceptions; my %missing = (); open(F, "<${prefix}scripts/copyright.exceptions") or die "$0: scripts/copyright.exceptions: $!"; chomp(@exceptions = ); %exceptions = map(($_, 1), grep !/^\#/, @exceptions); opendir(D, "${prefix}ChangeLog.d") or die "$0: ChangeLog.d: $!\n"; for my $dir (readdir D) { next if $dir =~ /cvs/; open(C, "<${prefix}ChangeLog.d/$dir") or die "$0: ChangeLog.d/$dir: $!\n"; while(defined($_ = )) { if(/^(\d{4})-\d{2}-\d{2}/) { $year = $1; } if(/^\s+(modified|removed|renamed) files:$/) { $what = $1; next; } if(/^\s*$/) { $what = ""; } if($what eq 'modified') { my @files = split(/\s+/, $_); for my $file (@files) { next if exists $checked{"$file-$year"}; next if $file =~ /^ChangeLog\.d/; next if ! -e "$prefix$file"; open(INPUT, "<$prefix$file") or die "$0: $prefix$file: $!\n"; my $good = 0; while(defined(my $line = )) { if($line =~ /Copyright.*$year/i) { $good = 1; last; } } close INPUT; $checked{"$file-$year"} = $good; $missing{"$file: missing $year"} = 1 if !$good && !exists $exceptions{$file}; } } } } print map("$_\n", sort keys %missing);