#!/bin/sh # # Look for cvs log entries with years not in the file's copyright notice. # # Run this in a cvs working directory. # # Bug: All log entries are examined, not just those belonging to the # branch of the working directory. years() { # years in the log file, one only of each cvs log "$1" 2>/dev/null | awk ' # Ignore the change to LGPL 2.1. /^date: 2000\/07\/24 17:04:[0-9][0-9]; author: tege; state: Exp; lines: \+4 -4/ { next } /^date: / { sub(/date: /,"") sub(/\/.*$/,"") if (getline s) { # stop at a rewrite or replacement # FIXME: Not sure if these pick up too much if (s ~ /Rewrite[.,]/ || s ~ /New file/) { exit } # skip log messages consisting solely of any of these if (s == "Add a copyright year." || s == "Update copyright year." || s == "Add missing copyright headers." || s == "Add copyright." || s == "Fix a typo in a comment." || s == "Copyright (C) -> Copyright.") { if (getline s) { if (s == "----------------------------") next } } } if ($0 == 1996) seen1996++ else print } END { # 2 entries for 1996 are taken to be the initial cvs checkin, and not # reported if (seen1996 > 2) print 1996 }' | sort -u # years in the file, duplicated awk ' /Copyright/,/^(#|dnl)?$/ { for (i=1;i<=NF;i++) { if ($i ~ /^[0-9]/) { s = $i sub(/,/,"",s) print s print s } } }' "$1" } one() { # files which by convention don't have copyright notices in them case `basename "$1"` in stamp-vti \ | unix2mac \ | version.texi \ ) return ;; esac # files which aren't distributed, so don't matter case `basename "$1"` in .cvsignore \ ) return ;; esac # files that come from elsewhere and don't have to match the gmp cvs entries case `basename "$1"` in COPYING \ | COPYING.LIB \ | ansi2knr.c \ | ansi2knr.1 \ | config.guess \ | config.sub \ | depcomp \ | INSTALL.autoconf \ | install-sh \ | ltconfig \ | ltmain.sh \ | mdate-sh \ | missing \ | mkinstalldirs \ | texinfo.tex \ ) return ;; esac # generated files that lose their copyright notices case `basename "$1"` in calc.c \ | calc.h \ ) return ;; esac # With the cvs years printed once but the file years printed twice, # the effect of uniq -u here is to print years that are in the cvs # but not in the file. # M=`years "$1" | sort | uniq -u` if [ -n "$M" ] then echo "$1: $M" fi } files() { find -type f | awk ' !/\/CVS\// { print }' } if [ $# = 0 ] then set . fi echo "Processing $*" for d in "$@" do for i in `find "$d" -type f` do one "$i" done done