From: Kevin Ryde <user42@zip.com.au>
Subject: Re: Years in copyright notices
Date: Thu, 24 Jun 2004 08:39:33 +1000 [thread overview]
Message-ID: <87pt7p6gre.fsf@zip.com.au> (raw)
In-Reply-To: <m3vfhiu25y.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "23 Jun 2004 10:08:41 +0200")
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
storm@cua.dk (Kim F. Storm) writes:
>
> (and automate)
In the past I used the script below on the gmp cvs, grepping the
output of cvs log. It's probably bit rotted somewhat, but may give
some ideas. The output from cvs log is normally big so you either
need to be on the repo machine or somewhere close.
I never wanted it to actually change files, just report apparently
missing years, to be checked manually. Because eg. something later
reverted doesn't need to appear, an initial checkin from an external
source isn't a change, a complete rewrite restarts the years, etc.
[-- Attachment #2: copyrightyears --]
[-- Type: text/plain, Size: 2734 bytes --]
#!/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
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
prev parent reply other threads:[~2004-06-23 22:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-17 5:08 Years in copyright notices Richard Stallman
2004-06-17 13:13 ` Kim F. Storm
2004-06-18 2:42 ` Miles Bader
2004-06-18 21:51 ` Richard Stallman
2004-06-21 20:46 ` Luc Teirlinck
2004-06-22 5:18 ` Eli Zaretskii
2004-06-22 23:17 ` Richard Stallman
2004-06-23 7:09 ` Jan D.
2004-06-24 23:48 ` Richard Stallman
2004-06-23 8:08 ` Kim F. Storm
2004-06-23 8:22 ` Miles Bader
2004-06-23 9:58 ` Kim F. Storm
2004-06-24 23:48 ` Richard Stallman
2004-06-25 0:03 ` Miles Bader
2004-06-23 22:39 ` Kevin Ryde [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pt7p6gre.fsf@zip.com.au \
--to=user42@zip.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).