Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Copyright update script
@ 2007-01-09 17:50 Daniel Jacobowitz
  2007-01-09 22:12 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-01-09 17:50 UTC (permalink / raw)
  To: gdb-patches

I've checked this in, with Eli's suggested changes and a few more of my own. 
Hopefully my copy-paste approach to lisp has not created anything too
horrid.  This version works on sim, which means it had to refuse to touch
non-FSF copyrights.  I've proofread it pretty thoroughly and am happy with
it.

Thanks a lot for the filling bits, Eli!  Not breaking the FSF name is very
nice, and I wouldn't have been able to figure that out on my own.

I'm going to check in the corresponding updates in a moment (without a
ChangeLog entry, since they touch almost every file and are completely
mechanical).  I've proofread them as best I can.  I'm not going to do the
files that I couldn't automate; we'll do those the old fashioned way, but
this covers 99.9%.

-- 
Daniel Jacobowitz
CodeSourcery

2007-01-09  Daniel Jacobowitz  <dan@codesourcery.com>
	    Eli Zaretskii  <eliz@gnu.org>

	* copyright.sh: New file.

Index: copyright.sh
===================================================================
RCS file: copyright.sh
diff -N copyright.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ copyright.sh	9 Jan 2007 17:06:58 -0000
@@ -0,0 +1,162 @@
+#!/bin/sh
+# Automatically update copyright for GDB, the GNU debugger.
+#
+# Copyright (C) 2007 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# 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., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Usage: cd src/gdb && sh ./copyright.sh
+# To use a different version of emacs, set the EMACS environment
+# variable before running.
+
+# After running, update those files mentioned in $byhand by hand.
+# Always review the output of this script before committing it!
+# A useful command to review the output is:
+#  filterdiff -x \*.c -x \*.cc -x \*.h -x \*.exp updates.diff
+# This removes the bulk of the changes which are most likely
+# to be correct.
+
+####
+# Configuration
+####
+
+# As of Emacs 22.0 (snapshot), wrapping and copyright updating do not
+# handle these file types - all reasonable:
+#  Assembly (weird comment characters, e.g. "!"); .S usually has C
+#            comments, which are fine)
+#  Fortran ("c" comment character)
+#  igen
+#  Autoconf input (dnl)
+#  texinfo (@c)
+#  tex (%)
+#  *.defs as C
+#   man
+# So these need to be done by hand, as needed
+byhand="
+*.s
+*.f
+*.f90
+*.igen
+*.ac
+*.texi
+*.texinfo
+*.tex
+*.defs
+*.1
+"
+
+# Files which should not be modified, either because they are
+# generated, non-FSF, or otherwise special (e.g. license text).
+prunes="
+COPYING
+COPYING.LIB
+CVS
+configure
+copying.c
+gdbarch.c
+gdbarch.h
+fdl.texi
+gpl.texi
+gdbtk
+gdb.gdbtk
+osf-share
+aclocal.m4
+"
+
+####
+# Main program
+####
+
+: ${EMACS:=emacs}
+
+# Disable filename expansion, so that we can get at the glob patterns
+# from $byhand.
+set -f
+
+version=`$EMACS --version | sed 's/GNU Emacs \([0-9]*\)\..*/\1/; 1q'`
+if test "$version" -lt 22; then
+  echo "error: $EMACS is too old; use at least an Emacs 22 snapshot." >&2
+  exit 1
+fi
+
+if test $# -lt 1; then
+  dir=.
+else
+  dir=$1
+fi
+
+if ! test -f doc/gdbint.texinfo; then
+  echo "\"$dir\" is not a GDB source directory."
+  exit 1
+fi
+
+cat > copytmp.el <<EOF
+(load "copyright")
+(setq vc-cvs-stay-local nil
+      message-log-max t)
+(setq fsf-regexp "Free[#; \t\n]+Software[#; \t\n]+Foundation,[#; \t\n]+Inc\."
+      fsf-copyright-regexp (concat copyright-regexp "[#; \t\n]+" fsf-regexp)
+      generated-regexp "THIS FILE IS MACHINE GENERATED WITH CGEN")
+
+(defun gdb-copyright-update (filename)
+  (widen)
+  (goto-char (point-min))
+  (if (and (not (re-search-forward generated-regexp (+ (point) copyright-limit) t))
+	   (re-search-forward fsf-copyright-regexp (+ (point) copyright-limit) t))
+      (progn
+	(setq copyright-update t
+	      copyright-query nil
+	      fill-column 78
+	      start (copy-marker (match-beginning 0))
+	      end (progn
+		    (re-search-backward fsf-regexp)
+		    (re-search-forward fsf-regexp
+		     (+ (point) copyright-limit) t)
+		    (point-marker))
+	      fsf-start (copy-marker (match-beginning 0)))
+	(replace-match "Free_Software_Foundation,_Inc." t t)
+	(copyright-update)
+	(fill-region-as-paragraph start end)
+	(replace-string "_" " " nil fsf-start end))
+    (message (concat "WARNING: No copyright message found in " filename))))
+
+EOF
+
+for f in $prunes $byhand; do
+  prune_opts="$prune_opts -name $f -prune -o"
+done
+
+for f in $(find "$dir" "$dir/../include/gdb" "$dir/../sim" \
+           $prune_opts -type f -print); do
+  cat >> copytmp.el <<EOF
+(switch-to-buffer (find-file "$f"))
+(setq backup-inhibited t)
+(setq write-file-hooks '())
+(gdb-copyright-update "$f")
+(save-buffer)
+(kill-buffer (buffer-name))
+EOF
+done
+
+cat >> copytmp.el <<EOF
+(delete-file "copytmp.el")
+;; Comment out the next line to examine the message buffer.
+(kill-emacs)
+EOF
+
+exec $EMACS --no-site-file -q -l ./copytmp.el


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [commit] Copyright update script
  2007-01-09 17:50 [commit] Copyright update script Daniel Jacobowitz
@ 2007-01-09 22:12 ` Eli Zaretskii
  2007-01-09 22:47   ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2007-01-09 22:12 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> Date: Tue, 9 Jan 2007 12:50:22 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> Thanks a lot for the filling bits, Eli!

No sweat, it was fun.

> I'm going to check in the corresponding updates in a moment (without a
> ChangeLog entry, since they touch almost every file and are completely
> mechanical).

How about at least adding an entry saying that 2007 was added
everywhere?

> +  echo "error: $EMACS is too old; use at least an Emacs 22 snapshot." >&2

Maybe we should say something like "Emacs 22.0.XX snapshot".  A year
from now "Emacs 22" might be ambiguous, if we have 22.1 and 22.2 by
that time.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [commit] Copyright update script
  2007-01-09 22:12 ` Eli Zaretskii
@ 2007-01-09 22:47   ` Daniel Jacobowitz
  2007-01-10  4:02     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-01-09 22:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Wed, Jan 10, 2007 at 12:11:57AM +0200, Eli Zaretskii wrote:
> > I'm going to check in the corresponding updates in a moment (without a
> > ChangeLog entry, since they touch almost every file and are completely
> > mechanical).
> 
> How about at least adding an entry saying that 2007 was added
> everywhere?

I was going to, but there's too many different changelog files,
so I gave up :-)  Roughly thirty.  If you think it's important,
I'll go back and add them, but I don't think it's a big deal.

> > +  echo "error: $EMACS is too old; use at least an Emacs 22 snapshot." >&2
> 
> Maybe we should say something like "Emacs 22.0.XX snapshot".  A year
> from now "Emacs 22" might be ambiguous, if we have 22.1 and 22.2 by
> that time.

Fine with me :-)  I checked it in.

-- 
Daniel Jacobowitz
CodeSourcery

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.8101
diff -u -p -r1.8101 ChangeLog
--- ChangeLog	9 Jan 2007 22:43:08 -0000	1.8101
+++ ChangeLog	9 Jan 2007 22:45:58 -0000
@@ -1,3 +1,7 @@
+2007-01-09  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* copyright.sh: Clarify error.
+
 2007-01-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* symtab.c (matching_bfd_sections): Fix VMA matching for
Index: copyright.sh
===================================================================
RCS file: /cvs/src/src/gdb/copyright.sh,v
retrieving revision 1.2
diff -u -p -r1.2 copyright.sh
--- copyright.sh	9 Jan 2007 21:37:30 -0000	1.2
+++ copyright.sh	9 Jan 2007 22:45:58 -0000
@@ -93,7 +93,7 @@ set -f
 
 version=`$EMACS --version | sed 's/GNU Emacs \([0-9]*\)\..*/\1/; 1q'`
 if test "$version" -lt 22; then
-  echo "error: $EMACS is too old; use at least an Emacs 22 snapshot." >&2
+  echo "error: $EMACS is too old; use at least an Emacs 22.0.XX snapshot." >&2
   exit 1
 fi
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [commit] Copyright update script
  2007-01-09 22:47   ` Daniel Jacobowitz
@ 2007-01-10  4:02     ` Eli Zaretskii
  2007-01-10  4:33       ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2007-01-10  4:02 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> Date: Tue, 9 Jan 2007 17:47:03 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb-patches@sourceware.org
> 
> On Wed, Jan 10, 2007 at 12:11:57AM +0200, Eli Zaretskii wrote:
> > > I'm going to check in the corresponding updates in a moment (without a
> > > ChangeLog entry, since they touch almost every file and are completely
> > > mechanical).
> > 
> > How about at least adding an entry saying that 2007 was added
> > everywhere?
> 
> I was going to, but there's too many different changelog files,
> so I gave up :-)  Roughly thirty.  If you think it's important,
> I'll go back and add them, but I don't think it's a big deal.

Maybe just say that in gdb/ChangeLog, as all the others, or at least
most of them, are its subdirectories.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [commit] Copyright update script
  2007-01-10  4:02     ` Eli Zaretskii
@ 2007-01-10  4:33       ` Daniel Jacobowitz
  2007-01-10 20:25         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-01-10  4:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Wed, Jan 10, 2007 at 06:02:50AM +0200, Eli Zaretskii wrote:
> Maybe just say that in gdb/ChangeLog, as all the others, or at least
> most of them, are its subdirectories.

OK, I did that in gdb/ChangeLog, sim/ChangeLog, and
include/gdb/ChangeLog.  Everything else is under one of those.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [commit] Copyright update script
  2007-01-10  4:33       ` Daniel Jacobowitz
@ 2007-01-10 20:25         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2007-01-10 20:25 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> Date: Tue, 9 Jan 2007 23:33:27 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb-patches@sourceware.org
> 
> OK, I did that in gdb/ChangeLog, sim/ChangeLog, and
> include/gdb/ChangeLog.  Everything else is under one of those.

Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-10 20:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-09 17:50 [commit] Copyright update script Daniel Jacobowitz
2007-01-09 22:12 ` Eli Zaretskii
2007-01-09 22:47   ` Daniel Jacobowitz
2007-01-10  4:02     ` Eli Zaretskii
2007-01-10  4:33       ` Daniel Jacobowitz
2007-01-10 20:25         ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox