public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit 2/3] use gnulib's update-copyright script to update copyright years
  2012-01-04  8:20 New procedure for updating copyright years Joel Brobecker
@ 2012-01-04  8:20 ` Joel Brobecker
  2012-01-04  8:20 ` [RFA/doco 3/3] Document new procedure for updating " Joel Brobecker
  2012-01-04  8:20 ` [commit 1/3] Import gnulib's update-copyright script Joel Brobecker
  2 siblings, 0 replies; 15+ messages in thread
From: Joel Brobecker @ 2012-01-04  8:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

This patch now retires the old copyright.sh script which was using
emacs to perform the copyright update. It also completely rewrite
copyright.py to call update-copyright with the appropriate list
of files.

In addition to calling update-copyright, the new script also performs
a sanity-check on all the files that update-copyright could not update,
and sees whether the file might contain a copyright notice that
the script could not decipher.

gdb/ChangeLog:

        * copyright.sh: Delete.
        * copyright.py: Rewrite.

Checked in.

---
 gdb/ChangeLog    |    5 +
 gdb/copyright.py |  844 +++++++++++++++++-------------------------------------
 gdb/copyright.sh |  170 -----------
 3 files changed, 262 insertions(+), 757 deletions(-)
 delete mode 100644 gdb/copyright.sh

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 834b5be..d011bd9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2012-01-04  Joel Brobecker  <brobecker@adacore.com>
 
+	* copyright.sh: Delete.
+	* copyright.py: Rewrite.
+
+2012-01-04  Joel Brobecker  <brobecker@adacore.com>
+
 	* gnulib/extra/update-copyright: New file, imported from gnulib.
 
 2012-01-04  Joel Brobecker  <brobecker@adacore.com>
diff --git a/gdb/copyright.py b/gdb/copyright.py
index 71f261d..93cfe71 100644
--- a/gdb/copyright.py
+++ b/gdb/copyright.py
@@ -1,608 +1,278 @@
 #! /usr/bin/env python
 
+# Copyright (C) 2011 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 3 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, see <http://www.gnu.org/licenses/>.
+
 """copyright.py
 
-This script updates most of the files that are not already handled
-by copyright.sh.  It must be run from the gdb/ subdirectory of the
-GDB source tree.
+This script updates the list of years in the copyright notices in
+most files maintained by the GDB project.
+
+Usage: cd src/gdb && python copyright.py
 
+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.
 """
 
 import datetime
-import re
 import os
 import os.path
+import subprocess
+
+# A list of prefixes that start a multi-line comment.  These prefixes
+# should not be repeatead when wraping long lines.
+MULTILINE_COMMENT_PREFIXES = (
+    '/*',    # C/C++
+    '<!--',  # XML
+    '{',     # Pascal
+)
 
-class Comment(object):
-    """A class describing comment.
-
-    ATTRIBUTES
-      start:  A string describing how comments are started.
-      stop:   A string describing how comments end.  If None, then
-              a comment ends at the end of the line.
-      start2: Some files accept more than 1 kind of comment.
-              For those that do, this is the alternative form.
-              For now, it is assumed that if start2 is not None,
-              then stop is None (thus no stop2 attribute).
+
+def get_update_list():
+    """Return the list of files to update.
+
+    Assumes that the current working directory when called is the root
+    of the GDB source tree (NOT the gdb/ subdirectory!).  The names of
+    the files are relative to that root directory.
     """
-    def __init__(self, start, stop=None, start2=None, max_lines=30):
-        """The "Copyright" keyword should be within MAX_LINES lines
-        from the start of the file."""
-        self.start = start
-        self.stop = stop
-        self.start2 = start2
-        self.max_lines = max_lines
+    result = []
+    for gdb_dir in ('gdb', 'sim', 'include/gdb'):
+        for root, dirs, files in os.walk(gdb_dir, topdown=True):
+            for dirname in dirs:
+                reldirname = "%s/%s" % (root, dirname)
+                if (dirname in EXCLUDE_ALL_LIST
+                    or reldirname in EXCLUDE_LIST
+                    or reldirname in NOT_FSF_LIST
+                    or reldirname in BY_HAND):
+                    # Prune this directory from our search list.
+                    dirs.remove(dirname)
+            for filename in files:
+                relpath = "%s/%s" % (root, filename)
+                if (filename in EXCLUDE_ALL_LIST
+                    or relpath in EXCLUDE_LIST
+                    or relpath in NOT_FSF_LIST
+                    or relpath in BY_HAND):
+                    # Ignore this file.
+                    pass
+                else:
+                    result.append(relpath)
+    return result
+
+
+def update_files(update_list):
+    """Update the copyright header of the files in the given list.
+
+    We use gnulib's update-copyright script for that.
+    """
+    # Tell the update-copyright script that we do not want it to
+    # repeat the prefixes in MULTILINE_COMMENT_PREFIXES.
+    os.environ['MULTILINE_COMMENT_PREFIXES'] = \
+        '\n'.join(MULTILINE_COMMENT_PREFIXES)
+    # We want to use year intervals in the copyright notices.
+    os.environ['UPDATE_COPYRIGHT_USE_INTERVALS'] = '1'
+
+    # Perform the update, and save the output in a string.
+    update_cmd = ['bash', 'gdb/gnulib/extra/update-copyright'] + update_list
+    p = subprocess.Popen(update_cmd, stdout=subprocess.PIPE,
+                         stderr=subprocess.STDOUT)
+    update_out = p.communicate()[0]
+
+    # Process the output.  Typically, a lot of files do not have
+    # a copyright notice :-(.  The update-copyright script prints
+    # a well defined warning when it did not find the copyright notice.
+    # For each of those, do a sanity check and see if they may in fact
+    # have one.  For the files that are found not to have one, we filter
+    # the line out from the output, since there is nothing more to do,
+    # short of looking at each file and seeing which notice is appropriate.
+    # Too much work! (~4,000 files listed as of 2012-01-03).
+    update_out = update_out.splitlines()
+    warning_string = ': warning: copyright statement not found'
+    warning_len = len(warning_string)
+
+    for line in update_out:
+        if line.endswith('\n'):
+            line = line[:-1]
+        if line.endswith(warning_string):
+            filename = line[:-warning_len]
+            if may_have_copyright_notice(filename):
+                print line
+        else:
+            # Unrecognized file format. !?!
+            print "*** " + line
+
+
+def may_have_copyright_notice(filename):
+    """Check that the given file does not seem to have a copyright notice.
+
+    The filename is relative to the root directory.
+    This function assumes that the current working directory is that root
+    directory.
 
-# The Comment object for Ada code (and GPR files).
-ADA_COMMENT = Comment(start="--")
+    The algorigthm is fairly crude, meaning that it might return
+    some false positives.  I do not think it will return any false
+    negatives...  We might improve this function to handle more
+    complex cases later...
+    """
+    # For now, it may have a copyright notice if we find the word
+    # "Copyright" at the (reasonable) start of the given file, say
+    # 50 lines...
+    MAX_LINES = 50
+
+    fd = open(filename)
+
+    lineno = 1
+    for line in fd:
+        if 'Copyright' in line:
+            return True
+        lineno += 1
+        if lineno > 50:
+            return False
+    return False
+
+
+def main ():
+    """The main subprogram."""
+    if not os.path.isfile("gnulib/extra/update-copyright"):
+        print "Error: This script must be called from the gdb directory."
+    root_dir = os.path.dirname(os.getcwd())
+    os.chdir(root_dir)
+
+    update_list = get_update_list()
+    update_files (update_list)
+
+    # Remind the user that some files need to be updated by HAND...
+    if BY_HAND:
+        print
+        print "\033[31mREMINDER: The following files must be updated by hand." \
+              "\033[0m"
+        for filename in BY_HAND:
+            print "  ", filename
+
+############################################################################
+#
+# Some constants, placed at the end because they take up a lot of room.
+# The actual value of these constants is not significant to the understanding
+# of the script.
+#
+############################################################################
 
-THIS_YEAR = str(datetime.date.today().year)
+# Files which should not be modified, either because they are
+# generated, non-FSF, or otherwise special (e.g. license text,
+# or test cases which must be sensitive to line numbering).
+#
+# Filenames are relative to the root directory.
+EXCLUDE_LIST = (
+    'gdb/gdbarch.c', 'gdb/gdbarch.h',
+    'gdb/gnulib'
+)
 
 # Files which should not be modified, either because they are
 # generated, non-FSF, or otherwise special (e.g. license text,
 # or test cases which must be sensitive to line numbering).
-EXCLUSION_LIST = (
-  "COPYING", "COPYING.LIB", "CVS", "configure", "copying.c", "gdbarch.c",
-  "gdbarch.h", "fdl.texi", "gpl.texi", "gdbtk", "gdb.gdbtk", "osf-share",
-  "aclocal.m4", "step-line.inp", "step-line.c",
-  )
-
-# Files that are too different from the rest to be processed automatically.
-BY_HAND = ['../sim/ppc/psim.texinfo']
-
-# Files for which we know that they do not have a copyright header.
-# Ideally, this list should be empty (but it may not be possible to
-# add a copyright header in some of them).
-NO_COPYRIGHT = (
-   # Configure files.  We should fix those, one day.
-   "testsuite/gdb.cell/configure.ac", "testsuite/gdb.hp/configure.ac",
-   "testsuite/gdb.hp/gdb.aCC/configure.ac",
-   "testsuite/gdb.hp/gdb.base-hp/configure.ac",
-   "testsuite/gdb.hp/gdb.compat/configure.ac",
-   "testsuite/gdb.hp/gdb.defects/configure.ac",
-   "testsuite/gdb.hp/gdb.objdbg/configure.ac",
-   "testsuite/gdb.stabs/configure.ac",
-   "../sim/arm/configure.ac", "../sim/avr/configure.ac",
-   "../sim/common/configure.ac", "../sim/configure.ac",
-   "../sim/cr16/configure.ac", "../sim/cris/configure.ac",
-   "../sim/d10v/configure.ac", "../sim/erc32/configure.ac",
-   "../sim/frv/configure.ac", "../sim/h8300/configure.ac",
-   "../sim/igen/configure.ac", "../sim/iq2000/configure.ac",
-   "../sim/lm32/configure.ac", "../sim/m32r/configure.ac",
-   "../sim/m68hc11/configure.ac", "../sim/mcore/configure.ac",
-   "../sim/microblaze/configure.ac", "../sim/mips/configure.ac",
-   "../sim/mn10300/configure.ac", "../sim/moxie/configure.ac",
-   "../sim/ppc/configure.ac", "../sim/sh/configure.ac",
-   "../sim/sh64/configure.ac", "../sim/testsuite/configure.ac",
-   "../sim/testsuite/d10v-elf/configure.ac",
-   "../sim/testsuite/frv-elf/configure.ac",
-   "../sim/testsuite/m32r-elf/configure.ac",
-   "../sim/testsuite/mips64el-elf/configure.ac", "../sim/v850/configure.ac",
-   # Assembly files.  It's not certain that we can add a copyright
-   # header in a way that works for all platforms supported by the
-   # testcase...
-   "testsuite/gdb.arch/pa-nullify.s", "testsuite/gdb.arch/pa64-nullify.s",
-   "testsuite/gdb.asm/asmsrc1.s", "testsuite/gdb.asm/asmsrc2.s",
-   "testsuite/gdb.disasm/am33.s", "testsuite/gdb.disasm/h8300s.s",
-   "testsuite/gdb.disasm/hppa.s", "testsuite/gdb.disasm/mn10200.s",
-   "testsuite/gdb.disasm/mn10300.s", "testsuite/gdb.disasm/sh3.s",
-   "testsuite/gdb.disasm/t01_mov.s", "testsuite/gdb.disasm/t02_mova.s",
-   "testsuite/gdb.disasm/t03_add.s", "testsuite/gdb.disasm/t04_sub.s",
-   "testsuite/gdb.disasm/t05_cmp.s", "testsuite/gdb.disasm/t06_ari2.s",
-   "testsuite/gdb.disasm/t07_ari3.s", "testsuite/gdb.disasm/t08_or.s",
-   "testsuite/gdb.disasm/t09_xor.s", "testsuite/gdb.disasm/t10_and.s",
-   "testsuite/gdb.disasm/t11_logs.s", "testsuite/gdb.disasm/t12_bit.s",
-   "testsuite/gdb.disasm/t13_otr.s", "testsuite/gdb.hp/gdb.base-hp/reg-pa64.s",
-   "testsuite/gdb.hp/gdb.base-hp/reg.s",
-   "../sim/testsuite/d10v-elf/exit47.s",
-   "../sim/testsuite/d10v-elf/hello.s",
-   "../sim/testsuite/d10v-elf/loop.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld-d.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld-i.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld-id.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld-im.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld-ip.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld2w-d.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld2w-i.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld2w-id.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld2w-im.s",
-   "../sim/testsuite/d10v-elf/t-ae-ld2w-ip.s",
-   "../sim/testsuite/d10v-elf/t-ae-st-d.s",
-   "../sim/testsuite/d10v-elf/t-ae-st-i.s",
-   "../sim/testsuite/d10v-elf/t-ae-st-id.s",
-   "../sim/testsuite/d10v-elf/t-ae-st-im.s",
-   "../sim/testsuite/d10v-elf/t-ae-st-ip.s",
-   "../sim/testsuite/d10v-elf/t-ae-st-is.s",
-   "../sim/testsuite/d10v-elf/t-ae-st2w-d.s",
-   "../sim/testsuite/d10v-elf/t-ae-st2w-i.s",
-   "../sim/testsuite/d10v-elf/t-ae-st2w-id.s",
-   "../sim/testsuite/d10v-elf/t-ae-st2w-im.s",
-   "../sim/testsuite/d10v-elf/t-ae-st2w-ip.s",
-   "../sim/testsuite/d10v-elf/t-ae-st2w-is.s",
-   "../sim/testsuite/d10v-elf/t-dbt.s",
-   "../sim/testsuite/d10v-elf/t-ld-st.s",
-   "../sim/testsuite/d10v-elf/t-mac.s",
-   "../sim/testsuite/d10v-elf/t-mod-ld-pre.s",
-   "../sim/testsuite/d10v-elf/t-msbu.s",
-   "../sim/testsuite/d10v-elf/t-mulxu.s",
-   "../sim/testsuite/d10v-elf/t-mvtac.s",
-   "../sim/testsuite/d10v-elf/t-mvtc.s",
-   "../sim/testsuite/d10v-elf/t-rac.s",
-   "../sim/testsuite/d10v-elf/t-rachi.s",
-   "../sim/testsuite/d10v-elf/t-rdt.s",
-   "../sim/testsuite/d10v-elf/t-rep.s",
-   "../sim/testsuite/d10v-elf/t-rie-xx.s",
-   "../sim/testsuite/d10v-elf/t-rte.s",
-   "../sim/testsuite/d10v-elf/t-sac.s",
-   "../sim/testsuite/d10v-elf/t-sachi.s",
-   "../sim/testsuite/d10v-elf/t-sadd.s",
-   "../sim/testsuite/d10v-elf/t-slae.s",
-   "../sim/testsuite/d10v-elf/t-sp.s",
-   "../sim/testsuite/d10v-elf/t-sub.s",
-   "../sim/testsuite/d10v-elf/t-sub2w.s",
-   "../sim/testsuite/d10v-elf/t-subi.s",
-   "../sim/testsuite/d10v-elf/t-trap.s",
-   "../sim/testsuite/frv-elf/cache.s",
-   "../sim/testsuite/frv-elf/exit47.s",
-   "../sim/testsuite/frv-elf/grloop.s",
-   "../sim/testsuite/frv-elf/hello.s",
-   "../sim/testsuite/frv-elf/loop.s",
-   "../sim/testsuite/m32r-elf/exit47.s",
-   "../sim/testsuite/m32r-elf/hello.s",
-   "../sim/testsuite/m32r-elf/loop.s",
-   "../sim/testsuite/sim/cris/hw/rv-n-cris/quit.s",
-   "../sim/testsuite/sim/h8300/addb.s",
-   "../sim/testsuite/sim/h8300/addl.s",
-   "../sim/testsuite/sim/h8300/adds.s",
-   "../sim/testsuite/sim/h8300/addw.s",
-   "../sim/testsuite/sim/h8300/addx.s",
-   "../sim/testsuite/sim/h8300/andb.s",
-   "../sim/testsuite/sim/h8300/andl.s",
-   "../sim/testsuite/sim/h8300/andw.s",
-   "../sim/testsuite/sim/h8300/band.s",
-   "../sim/testsuite/sim/h8300/bfld.s",
-   "../sim/testsuite/sim/h8300/biand.s",
-   "../sim/testsuite/sim/h8300/bra.s",
-   "../sim/testsuite/sim/h8300/brabc.s",
-   "../sim/testsuite/sim/h8300/bset.s",
-   "../sim/testsuite/sim/h8300/cmpb.s",
-   "../sim/testsuite/sim/h8300/cmpl.s",
-   "../sim/testsuite/sim/h8300/cmpw.s",
-   "../sim/testsuite/sim/h8300/daa.s",
-   "../sim/testsuite/sim/h8300/das.s",
-   "../sim/testsuite/sim/h8300/dec.s",
-   "../sim/testsuite/sim/h8300/div.s",
-   "../sim/testsuite/sim/h8300/extl.s",
-   "../sim/testsuite/sim/h8300/extw.s",
-   "../sim/testsuite/sim/h8300/inc.s",
-   "../sim/testsuite/sim/h8300/jmp.s",
-   "../sim/testsuite/sim/h8300/ldc.s",
-   "../sim/testsuite/sim/h8300/ldm.s",
-   "../sim/testsuite/sim/h8300/mac.s",
-   "../sim/testsuite/sim/h8300/mova.s",
-   "../sim/testsuite/sim/h8300/movb.s",
-   "../sim/testsuite/sim/h8300/movl.s",
-   "../sim/testsuite/sim/h8300/movmd.s",
-   "../sim/testsuite/sim/h8300/movsd.s",
-   "../sim/testsuite/sim/h8300/movw.s",
-   "../sim/testsuite/sim/h8300/mul.s",
-   "../sim/testsuite/sim/h8300/neg.s",
-   "../sim/testsuite/sim/h8300/nop.s",
-   "../sim/testsuite/sim/h8300/not.s",
-   "../sim/testsuite/sim/h8300/orb.s",
-   "../sim/testsuite/sim/h8300/orl.s",
-   "../sim/testsuite/sim/h8300/orw.s",
-   "../sim/testsuite/sim/h8300/rotl.s",
-   "../sim/testsuite/sim/h8300/rotr.s",
-   "../sim/testsuite/sim/h8300/rotxl.s",
-   "../sim/testsuite/sim/h8300/rotxr.s",
-   "../sim/testsuite/sim/h8300/shal.s",
-   "../sim/testsuite/sim/h8300/shar.s",
-   "../sim/testsuite/sim/h8300/shll.s",
-   "../sim/testsuite/sim/h8300/shlr.s",
-   "../sim/testsuite/sim/h8300/stack.s",
-   "../sim/testsuite/sim/h8300/stc.s",
-   "../sim/testsuite/sim/h8300/subb.s",
-   "../sim/testsuite/sim/h8300/subl.s",
-   "../sim/testsuite/sim/h8300/subs.s",
-   "../sim/testsuite/sim/h8300/subw.s",
-   "../sim/testsuite/sim/h8300/subx.s",
-   "../sim/testsuite/sim/h8300/tas.s",
-   "../sim/testsuite/sim/h8300/xorb.s",
-   "../sim/testsuite/sim/h8300/xorl.s",
-   "../sim/testsuite/sim/h8300/xorw.s",
-   "../sim/testsuite/sim/mips/fpu64-ps-sb1.s",
-   "../sim/testsuite/sim/mips/fpu64-ps.s",
-   "../sim/testsuite/sim/mips/hilo-hazard-1.s",
-   "../sim/testsuite/sim/mips/hilo-hazard-2.s",
-   "../sim/testsuite/sim/mips/hilo-hazard-3.s",
-   "../sim/testsuite/sim/mips/mdmx-ob-sb1.s",
-   "../sim/testsuite/sim/mips/mdmx-ob.s",
-   "../sim/testsuite/sim/mips/mips32-dsp.s",
-   "../sim/testsuite/sim/mips/mips32-dsp2.s",
-   "../sim/testsuite/sim/mips/sanity.s",
-   "../sim/testsuite/sim/sh/add.s",
-   "../sim/testsuite/sim/sh/and.s",
-   "../sim/testsuite/sim/sh/bandor.s",
-   "../sim/testsuite/sim/sh/bandornot.s",
-   "../sim/testsuite/sim/sh/bclr.s",
-   "../sim/testsuite/sim/sh/bld.s",
-   "../sim/testsuite/sim/sh/bldnot.s",
-   "../sim/testsuite/sim/sh/bset.s",
-   "../sim/testsuite/sim/sh/bst.s",
-   "../sim/testsuite/sim/sh/bxor.s",
-   "../sim/testsuite/sim/sh/clip.s",
-   "../sim/testsuite/sim/sh/div.s",
-   "../sim/testsuite/sim/sh/dmxy.s",
-   "../sim/testsuite/sim/sh/fabs.s",
-   "../sim/testsuite/sim/sh/fadd.s",
-   "../sim/testsuite/sim/sh/fail.s",
-   "../sim/testsuite/sim/sh/fcmpeq.s",
-   "../sim/testsuite/sim/sh/fcmpgt.s",
-   "../sim/testsuite/sim/sh/fcnvds.s",
-   "../sim/testsuite/sim/sh/fcnvsd.s",
-   "../sim/testsuite/sim/sh/fdiv.s",
-   "../sim/testsuite/sim/sh/fipr.s",
-   "../sim/testsuite/sim/sh/fldi0.s",
-   "../sim/testsuite/sim/sh/fldi1.s",
-   "../sim/testsuite/sim/sh/flds.s",
-   "../sim/testsuite/sim/sh/float.s",
-   "../sim/testsuite/sim/sh/fmac.s",
-   "../sim/testsuite/sim/sh/fmov.s",
-   "../sim/testsuite/sim/sh/fmul.s",
-   "../sim/testsuite/sim/sh/fneg.s",
-   "../sim/testsuite/sim/sh/fpchg.s",
-   "../sim/testsuite/sim/sh/frchg.s",
-   "../sim/testsuite/sim/sh/fsca.s",
-   "../sim/testsuite/sim/sh/fschg.s",
-   "../sim/testsuite/sim/sh/fsqrt.s",
-   "../sim/testsuite/sim/sh/fsrra.s",
-   "../sim/testsuite/sim/sh/fsub.s",
-   "../sim/testsuite/sim/sh/ftrc.s",
-   "../sim/testsuite/sim/sh/ldrc.s",
-   "../sim/testsuite/sim/sh/loop.s",
-   "../sim/testsuite/sim/sh/macl.s",
-   "../sim/testsuite/sim/sh/macw.s",
-   "../sim/testsuite/sim/sh/mov.s",
-   "../sim/testsuite/sim/sh/movi.s",
-   "../sim/testsuite/sim/sh/movli.s",
-   "../sim/testsuite/sim/sh/movua.s",
-   "../sim/testsuite/sim/sh/movxy.s",
-   "../sim/testsuite/sim/sh/mulr.s",
-   "../sim/testsuite/sim/sh/pabs.s",
-   "../sim/testsuite/sim/sh/padd.s",
-   "../sim/testsuite/sim/sh/paddc.s",
-   "../sim/testsuite/sim/sh/pand.s",
-   "../sim/testsuite/sim/sh/pass.s",
-   "../sim/testsuite/sim/sh/pclr.s",
-   "../sim/testsuite/sim/sh/pdec.s",
-   "../sim/testsuite/sim/sh/pdmsb.s",
-   "../sim/testsuite/sim/sh/pinc.s",
-   "../sim/testsuite/sim/sh/pmuls.s",
-   "../sim/testsuite/sim/sh/prnd.s",
-   "../sim/testsuite/sim/sh/pshai.s",
-   "../sim/testsuite/sim/sh/pshar.s",
-   "../sim/testsuite/sim/sh/pshli.s",
-   "../sim/testsuite/sim/sh/pshlr.s",
-   "../sim/testsuite/sim/sh/psub.s",
-   "../sim/testsuite/sim/sh/pswap.s",
-   "../sim/testsuite/sim/sh/pushpop.s",
-   "../sim/testsuite/sim/sh/resbank.s",
-   "../sim/testsuite/sim/sh/sett.s",
-   "../sim/testsuite/sim/sh/shll.s",
-   "../sim/testsuite/sim/sh/shll16.s",
-   "../sim/testsuite/sim/sh/shll2.s",
-   "../sim/testsuite/sim/sh/shll8.s",
-   "../sim/testsuite/sim/sh/shlr.s",
-   "../sim/testsuite/sim/sh/shlr16.s",
-   "../sim/testsuite/sim/sh/shlr2.s",
-   "../sim/testsuite/sim/sh/shlr8.s",
-   "../sim/testsuite/sim/sh/swap.s",
-   "../sim/testsuite/sim/sh64/misc/fr-dr.s",
-   # .inc files.  These are usually assembly or C files...
-   "testsuite/gdb.asm/alpha.inc",
-   "testsuite/gdb.asm/arm.inc",
-   "testsuite/gdb.asm/common.inc",
-   "testsuite/gdb.asm/empty.inc",
-   "testsuite/gdb.asm/frv.inc",
-   "testsuite/gdb.asm/h8300.inc",
-   "testsuite/gdb.asm/i386.inc",
-   "testsuite/gdb.asm/ia64.inc",
-   "testsuite/gdb.asm/iq2000.inc",
-   "testsuite/gdb.asm/m32c.inc",
-   "testsuite/gdb.asm/m32r-linux.inc",
-   "testsuite/gdb.asm/m32r.inc",
-   "testsuite/gdb.asm/m68hc11.inc",
-   "testsuite/gdb.asm/m68k.inc",
-   "testsuite/gdb.asm/mips.inc",
-   "testsuite/gdb.asm/netbsd.inc",
-   "testsuite/gdb.asm/openbsd.inc",
-   "testsuite/gdb.asm/pa.inc",
-   "testsuite/gdb.asm/pa64.inc",
-   "testsuite/gdb.asm/powerpc.inc",
-   "testsuite/gdb.asm/powerpc64.inc",
-   "testsuite/gdb.asm/s390.inc",
-   "testsuite/gdb.asm/s390x.inc",
-   "testsuite/gdb.asm/sh.inc",
-   "testsuite/gdb.asm/sparc.inc",
-   "testsuite/gdb.asm/sparc64.inc",
-   "testsuite/gdb.asm/spu.inc",
-   "testsuite/gdb.asm/v850.inc",
-   "testsuite/gdb.asm/x86_64.inc",
-   "testsuite/gdb.asm/xstormy16.inc",
-   "../sim/testsuite/sim/arm/iwmmxt/testutils.inc",
-   "../sim/testsuite/sim/arm/testutils.inc",
-   "../sim/testsuite/sim/arm/thumb/testutils.inc",
-   "../sim/testsuite/sim/arm/xscale/testutils.inc",
-   "../sim/testsuite/sim/cr16/testutils.inc",
-   "../sim/testsuite/sim/cris/asm/testutils.inc",
-   "../sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc",
-   "../sim/testsuite/sim/fr30/testutils.inc",
-   "../sim/testsuite/sim/frv/testutils.inc",
-   "../sim/testsuite/sim/h8300/testutils.inc",
-   "../sim/testsuite/sim/m32r/testutils.inc",
-   "../sim/testsuite/sim/sh/testutils.inc",
-   "../sim/testsuite/sim/sh64/compact/testutils.inc",
-   "../sim/testsuite/sim/sh64/media/testutils.inc",
-   "../sim/testsuite/sim/v850/testutils.inc",
-   )
-
-# A mapping between file extensions to their associated Comment object.
-# This dictionary also contains a number of exceptions, based on
-# filename.
-COMMENT_MAP = \
-  {".1" : Comment(start=r'.\"'),
-   ".ac" : Comment(start="dnl", start2="#"),
-   ".ads" : ADA_COMMENT,
-   ".adb" : ADA_COMMENT,
-   ".f" : Comment(start="c"),
-   ".f90" : Comment(start="!"),
-   ".gpr" : ADA_COMMENT,
-   ".inc" : Comment(start="#", start2=";"),
-   ".s" : Comment(start="!"),
-   ".tex" : Comment(start="%"),
-   ".texi" : Comment(start="@c"),
-   ".texinfo" : Comment(start="@c"),
-
-   # Files that use a different way of including the copyright
-   # header...
-   "ada-operator.inc" : Comment(start="/*", stop="*/"),
-   "gdbint.texinfo" : Comment(start='@copying', stop="@end copying"),
-   "annotate.texinfo" : Comment(start='@copying', stop="@end copying",
-                                max_lines=50),
-   "stabs.texinfo" : Comment(start='@copying', stop="@end copying"),
-  }
-
-class NotFound(Exception):
-    pass
-
-class AlreadyDone(Exception):
-    pass
-
-def process_header(src, dst, cdescr):
-    """Read from SRC for up to CDESCR.MAX_LINES until we find a copyright
-    notice.  If found, then write the entire file, with the copyright
-    noticed updated with the current year added.
-
-    Raises NotFound if the copyright notice could not be found or has
-    some inconsistencies.
-
-    Raises AlreadyDone if the copyright notice already includes the current
-    year.
-    """
-    line_count = 0
-    # The start-of-comment marker used for this file.  Only really useful
-    # in the case where comments ends at the end of the line, as this
-    # allows us to know which comment marker to use when breaking long
-    # lines (in the cases where there are more than one.
-    cdescr_start = ""
-
-    while True:
-        # If we still haven't found a copyright line within a certain
-        # number of lines, then give up.
-        if line_count > cdescr.max_lines:
-            raise NotFound("start of Copyright not found")
-
-        line = src.readline()
-        line_count += 1
-        if not line:
-            raise NotFound("start of Copyright not found (EOF)")
-
-        # Is this a copyright line?  If not, then no transformation is
-        # needed.  Write it as is, and continue.
-        if not re.search(r"Copyright\b.*\b(199\d|20\d\d)\b", line):
-            dst.write(line)
-            continue
-
-        # If a start-of-comment marker is needed for every line, try to
-        # figure out which one it is that is being used in this file (most
-        # files only accept one, in which case it's easy - but some accept
-        # two or more...).
-        if cdescr.stop is None:
-            stripped_line = line.lstrip()
-            if stripped_line.startswith(cdescr.start):
-                cdescr_start = cdescr.start
-            elif (cdescr.start2 is not None
-                  and stripped_line.startswith(cdescr.start2)):
-                cdescr_start = cdescr.start2
-            elif cdescr.start in stripped_line:
-                cdescr_start = cdescr.start
-            elif (cdescr.start2 is not None
-                  and cdescr.start2 in stripped_line):
-                cdescr_start = cdescr.start2
-            else:
-                # This can't be a line with a comment, so not the copyright
-                # line we were looking for.  Ignore.
-                continue
-
-        comment = line
-        break
-
-    while not re.search(r"Free\s+Software\s+Foundation", comment):
-        line = src.readline()
-        line_count += 1
-        if not line:
-            raise NotFound("Copyright owner not found (EOF)")
-
-        if cdescr.stop is None:
-            # Expect a new comment marker at the start of each line
-            line = line.lstrip()
-            if not line.startswith(cdescr_start):
-                raise NotFound("Copyright owner not found "
-                               "(end of comment)")
-            comment += " " + line[len(cdescr_start):]
-        else:
-            if cdescr.stop in comment:
-                raise NotFound("Copyright owner not found "
-                               "(end of comment)")
-            comment += line
-
-    # Normalize a bit the copyright string (we preserve the string
-    # up until "Copyright", in order to help preserve any original
-    # alignment.
-    (before, after) = comment.split("Copyright", 1)
-    after = after.replace("\n", " ")
-    after = re.sub("\s+", " ", after)
-    after = after.rstrip()
-
-    # If the copyright year has already been added, the nothing else
-    # to do.
-    if THIS_YEAR in after:
-        raise AlreadyDone
-
-    m = re.match("(.*[0-9]+)(.*)", after)
-    if m is None:
-        raise NotFound("Internal error - cannot split copyright line: "
-                       "`%s'" % comment)
-
-    # Reconstruct the comment line
-    comment = before + "Copyright" + m.group(1) + ', %s' % THIS_YEAR
-    owner_part = m.group(2).lstrip()
-
-    # Max comment len...
-    max_len = 76
-
-    # If we have to break the copyright line into multiple lines,
-    # we want to align all the lines on the "Copyright" keyword.
-    # Create a small "indent" string that we can use for that.
-    if cdescr.stop is None:
-        # The comment marker is needed on every line, so put it at the
-        # start of our "indent" string.
-        indent = cdescr_start + ' ' * (len(before) - len(cdescr_start))
-    else:
-        indent = ' ' * len(before)
-
-    # If the line is too long...
-    while len(comment) > max_len:
-        # Split the line at the first space before max_len.
-        space_index = comment[0:max_len].rfind(' ')
-        if space_index < 0:  # No space in the first max_len characters???
-            # Split at the first space, then...
-            space_index = comment.find(' ')
-        if space_index < 0:
-            # Still no space found.  This is extremely unlikely, but
-            # just pretend there is one at the end of the string.
-            space_index = len(comment)
-
-        # Write the first part of the string up until the space
-        # we selected to break our line.
-        dst.write(comment[:space_index] + '\n')
-
-        # Strip the part of comment that we have finished printing.
-        if space_index < len(comment):
-            comment = comment[space_index + 1:]
-        else:
-            comment = ""
-
-        # Prepend the "indent" string to make sure that we remain
-        # aligned on the "Copyright" word.
-        comment = indent + comment
-
-    # And finally, write the rest of the last line...  We want to write
-    # "Free Software Foundation, Inc" on the same line, so handle this
-    # with extra care.
-    dst.write(comment)
-    if len(comment) + 1 + len (owner_part) > max_len:
-        dst.write('\n' + indent)
-    else:
-        dst.write(' ')
-    dst.write(owner_part + '\n')
-
-def comment_for_filename(filename):
-    """Return the Comment object that best describes the given file.
-    This a smart lookup of the COMMENT_MAP dictionary where we check
-    for filename-based exceptions first, before looking up the comment
-    by filename extension.  """
-    # First, consult the COMMENT_MAP using the filename, in case this
-    # file needs special treatment.
-    basename = os.path.basename(filename)
-    if basename in COMMENT_MAP:
-        return COMMENT_MAP[basename]
-    # Not a special file.  Check the file extension.
-    ext = os.path.splitext(filename)[1]
-    if ext in COMMENT_MAP:
-        return COMMENT_MAP[ext]
-    # Not a know extension either, return None.
-    return None
-
-def process_file(filename):
-    """Processes the given file.
-    """
-    cdescr = comment_for_filename(filename)
-    if cdescr is None:
-        # Either no filename extension, or not an extension that we
-        # know how to handle.
-        return
-
-    dst_filename = filename + '.new'
-    src = open(filename)
-    dst = open(dst_filename, 'w')
-    try:
-        process_header(src, dst, cdescr)
-    except AlreadyDone:
-        print "+++ Already up to date: `%s'." % filename
-        dst.close()
-        os.unlink(dst_filename)
-        if filename in NO_COPYRIGHT:
-            # We expect the search for a copyright header to fail, and
-            # yet we found one...
-            print "Warning: `%s' should not be in NO_COPYRIGHT" % filename
-        return
-    except NotFound as inst:
-        dst.close()
-        os.unlink(dst_filename)
-        if not filename in NO_COPYRIGHT:
-            print "*** \033[31m%s\033[0m: %s" % (filename, inst)
-        return
-
-    if filename in NO_COPYRIGHT:
-        # We expect the search for a copyright header to fail, and
-        # yet we found one...
-        print "Warning: `%s' should not be in NO_COPYRIGHT" % filename
-
-    for line in src:
-        dst.write(line)
-    src.close()
-    dst.close()
-    os.rename(dst_filename, filename)
+#
+# Matches any file or directory name anywhere.  Use with caution.
+# This is mostly for files that can be found in multiple directories.
+# Eg: We want all files named COPYING to be left untouched.
+
+EXCLUDE_ALL_LIST = (
+    "COPYING", "COPYING.LIB", "CVS", "configure", "copying.c",
+    "fdl.texi", "gpl.texi", "aclocal.m4",
+)
+
+# The list of files to update by hand.
+BY_HAND = (
+    # These files are sensitive to line numbering.
+    "gdb/testsuite/gdb.base/step-line.inp",
+    "gdb/testsuite/gdb.base/step-line.c",
+)
+
+# The list of file which have a copyright, but not head by the FSF.
+# Filenames are relative to the root directory.
+NOT_FSF_LIST = (
+    "gdb/exc_request.defs",
+    "gdb/osf-share",
+    "gdb/gdbtk",
+    "gdb/testsuite/gdb.gdbtk/",
+    "sim/arm/armemu.h", "sim/arm/armos.c", "sim/arm/gdbhost.c",
+    "sim/arm/dbg_hif.h", "sim/arm/dbg_conf.h", "sim/arm/communicate.h",
+    "sim/arm/armos.h", "sim/arm/armcopro.c", "sim/arm/armemu.c",
+    "sim/arm/kid.c", "sim/arm/thumbemu.c", "sim/arm/armdefs.h",
+    "sim/arm/armopts.h", "sim/arm/dbg_cp.h", "sim/arm/dbg_rdi.h",
+    "sim/arm/parent.c", "sim/arm/armsupp.c", "sim/arm/armrdi.c",
+    "sim/arm/bag.c", "sim/arm/armvirt.c", "sim/arm/main.c", "sim/arm/bag.h",
+    "sim/arm/communicate.c", "sim/arm/gdbhost.h", "sim/arm/armfpe.h",
+    "sim/arm/arminit.c",
+    "sim/common/cgen-fpu.c", "sim/common/cgen-fpu.h", "sim/common/cgen-fpu.h",
+    "sim/common/cgen-accfp.c", "sim/common/sim-fpu.c",
+    "sim/erc32/sis.h", "sim/erc32/erc32.c", "sim/erc32/func.c",
+    "sim/erc32/float.c", "sim/erc32/interf.c", "sim/erc32/sis.c",
+    "sim/erc32/exec.c",
+    "sim/mips/m16run.c", "sim/mips/sim-main.c",
+    "sim/mn10300/sim-main.h",
+    "sim/moxie/moxie-gdb.dts",
+    # Not a single file in sim/ppc/ appears to be copyright FSF :-(.
+    "sim/ppc/filter.h", "sim/ppc/gen-support.h", "sim/ppc/ld-insn.h",
+    "sim/ppc/hw_sem.c", "sim/ppc/hw_disk.c", "sim/ppc/idecode_branch.h",
+    "sim/ppc/sim-endian.h", "sim/ppc/table.c", "sim/ppc/hw_core.c",
+    "sim/ppc/gen-support.c", "sim/ppc/gen-semantics.h", "sim/ppc/cpu.h",
+    "sim/ppc/sim_callbacks.h", "sim/ppc/RUN", "sim/ppc/Makefile.in",
+    "sim/ppc/emul_chirp.c", "sim/ppc/hw_nvram.c", "sim/ppc/dc-test.01",
+    "sim/ppc/hw_phb.c", "sim/ppc/hw_eeprom.c", "sim/ppc/bits.h",
+    "sim/ppc/hw_vm.c", "sim/ppc/cap.h", "sim/ppc/os_emul.h",
+    "sim/ppc/options.h", "sim/ppc/gen-idecode.c", "sim/ppc/filter.c",
+    "sim/ppc/corefile-n.h", "sim/ppc/std-config.h", "sim/ppc/ld-decode.h",
+    "sim/ppc/filter_filename.h", "sim/ppc/hw_shm.c",
+    "sim/ppc/pk_disklabel.c", "sim/ppc/dc-simple", "sim/ppc/misc.h",
+    "sim/ppc/device_table.h", "sim/ppc/ld-insn.c", "sim/ppc/inline.c",
+    "sim/ppc/emul_bugapi.h", "sim/ppc/hw_cpu.h", "sim/ppc/debug.h",
+    "sim/ppc/hw_ide.c", "sim/ppc/debug.c", "sim/ppc/gen-itable.h",
+    "sim/ppc/interrupts.c", "sim/ppc/hw_glue.c", "sim/ppc/emul_unix.c",
+    "sim/ppc/sim_calls.c", "sim/ppc/dc-complex", "sim/ppc/ld-cache.c",
+    "sim/ppc/registers.h", "sim/ppc/dc-test.02", "sim/ppc/options.c",
+    "sim/ppc/igen.h", "sim/ppc/registers.c", "sim/ppc/device.h",
+    "sim/ppc/emul_chirp.h", "sim/ppc/hw_register.c", "sim/ppc/hw_init.c",
+    "sim/ppc/sim-endian-n.h", "sim/ppc/filter_filename.c",
+    "sim/ppc/bits.c", "sim/ppc/idecode_fields.h", "sim/ppc/hw_memory.c",
+    "sim/ppc/misc.c", "sim/ppc/double.c", "sim/ppc/psim.h",
+    "sim/ppc/hw_trace.c", "sim/ppc/emul_netbsd.h", "sim/ppc/psim.c",
+    "sim/ppc/ppc-instructions", "sim/ppc/tree.h", "sim/ppc/README",
+    "sim/ppc/gen-icache.h", "sim/ppc/gen-model.h", "sim/ppc/ld-cache.h",
+    "sim/ppc/mon.c", "sim/ppc/corefile.h", "sim/ppc/vm.c",
+    "sim/ppc/INSTALL", "sim/ppc/gen-model.c", "sim/ppc/hw_cpu.c",
+    "sim/ppc/corefile.c", "sim/ppc/hw_opic.c", "sim/ppc/gen-icache.c",
+    "sim/ppc/events.h", "sim/ppc/os_emul.c", "sim/ppc/emul_generic.c",
+    "sim/ppc/main.c", "sim/ppc/hw_com.c", "sim/ppc/gen-semantics.c",
+    "sim/ppc/emul_bugapi.c", "sim/ppc/device.c", "sim/ppc/emul_generic.h",
+    "sim/ppc/tree.c", "sim/ppc/mon.h", "sim/ppc/interrupts.h",
+    "sim/ppc/cap.c", "sim/ppc/cpu.c", "sim/ppc/hw_phb.h",
+    "sim/ppc/device_table.c", "sim/ppc/lf.c", "sim/ppc/lf.c",
+    "sim/ppc/dc-stupid", "sim/ppc/hw_pal.c", "sim/ppc/ppc-spr-table",
+    "sim/ppc/emul_unix.h", "sim/ppc/words.h", "sim/ppc/basics.h",
+    "sim/ppc/hw_htab.c", "sim/ppc/lf.h", "sim/ppc/ld-decode.c",
+    "sim/ppc/sim-endian.c", "sim/ppc/gen-itable.c",
+    "sim/ppc/idecode_expression.h", "sim/ppc/table.h", "sim/ppc/dgen.c",
+    "sim/ppc/events.c", "sim/ppc/gen-idecode.h", "sim/ppc/emul_netbsd.c",
+    "sim/ppc/igen.c", "sim/ppc/vm_n.h", "sim/ppc/vm.h",
+    "sim/ppc/hw_iobus.c", "sim/ppc/inline.h",
+    "sim/testsuite/sim/bfin/s21.s", "sim/testsuite/sim/mips/mips32-dsp2.s",
+)
 
 if __name__ == "__main__":
-    if not os.path.isfile("doc/gdb.texinfo"):
-        print "Error: This script must be called from the gdb directory."
-    for gdb_dir in ('.', '../sim', '../include/gdb'):
-        for root, dirs, files in os.walk(gdb_dir):
-            for filename in files:
-                fullpath = os.path.join(root, filename)
-                if fullpath.startswith('./'):
-                    fullpath = fullpath[2:]
-                if filename not in EXCLUSION_LIST and fullpath not in BY_HAND:
-                    # Paths that start with './' are ugly, so strip that.
-                    # This also allows us to omit them in the NO_COPYRIGHT
-                    # list...
-                    process_file(fullpath)
-    print
-    print "\033[32mREMINDER: The following files must be updated by hand." \
-          "\033[0m"
-    for filename in BY_HAND:
-        print "  ", filename
+    main()
 
diff --git a/gdb/copyright.sh b/gdb/copyright.sh
deleted file mode 100644
index 13f860a..0000000
--- a/gdb/copyright.sh
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/bin/sh
-# Automatically update copyright for GDB, the GNU debugger.
-#
-# Copyright (C) 2007, 2008, 2009, 2010, 2011 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 3 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, see <http://www.gnu.org/licenses/>.
-
-# 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 either by hand, as needed, or by the copyright.py
-# script.
-byhand="
-*.s
-*.f
-*.f90
-*.igen
-*.ac
-*.texi
-*.texinfo
-*.tex
-*.defs
-*.1
-*.ads
-*.adb
-*.gpr
-*.inc
-"
-
-# Files which should not be modified, either because they are
-# generated, non-FSF, or otherwise special (e.g. license text,
-# or test cases which must be sensitive to line numbering).
-prunes="
-COPYING
-COPYING.LIB
-CVS
-configure
-copying.c
-gdbarch.c
-gdbarch.h
-fdl.texi
-gpl.texi
-gdbtk
-gdb.gdbtk
-osf-share
-aclocal.m4
-step-line.inp
-step-line.c
-"
-
-####
-# 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.0.XX 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
-
-$EMACS --no-site-file -q -l ./copytmp.el
-
-python $dir/copyright.py
-- 
1.7.1

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

* [RFA/doco 3/3] Document new procedure for updating copyright years
  2012-01-04  8:20 New procedure for updating copyright years Joel Brobecker
  2012-01-04  8:20 ` [commit 2/3] use gnulib's update-copyright script to update " Joel Brobecker
@ 2012-01-04  8:20 ` Joel Brobecker
  2012-01-04 18:24   ` Eli Zaretskii
  2012-01-04  8:20 ` [commit 1/3] Import gnulib's update-copyright script Joel Brobecker
  2 siblings, 1 reply; 15+ messages in thread
From: Joel Brobecker @ 2012-01-04  8:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

We now use a different script to perform the update.  This patch
updates the procedure in our documentation

gdb/doc/ChangeLog:

        * gdbint.texinfo (Start of New Year Procedure): Update
        to replace use of copyright.sh by use of copyright.py.

OK to commit?

Thanks,

---
 gdb/doc/gdbint.texinfo |   31 ++-----------------------------
 1 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 34eee91..bd5626b 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -6799,35 +6799,8 @@ Update the copyright year in:
 @end itemize
 
 @item
-Run the @file{copyright.sh} script to add the new year in the copyright
-notices of most source files.  This script requires Emacs 22 or later to
-be installed.
-
-@item
-The new year also needs to be added manually in all other files that
-are not already taken care of by the @file{copyright.sh} script:
-@itemize @bullet
-  @item
-  @file{*.s}
-  @item
-  @file{*.f}
-  @item
-  @file{*.f90}
-  @item
-  @file{*.igen}
-  @item
-  @file{*.ac}
-  @item
-  @file{*.texi}
-  @item
-  @file{*.texinfo}
-  @item
-  @file{*.tex}
-  @item
-  @file{*.defs}
-  @item
-  @file{*.1}
-@end itemize
+Run the @file{copyright.py} Python script to add the new year in the copyright
+notices of most source files.
 
 @end itemize
 
-- 
1.7.1

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

* New procedure for updating copyright years...
@ 2012-01-04  8:20 Joel Brobecker
  2012-01-04  8:20 ` [commit 2/3] use gnulib's update-copyright script to update " Joel Brobecker
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Joel Brobecker @ 2012-01-04  8:20 UTC (permalink / raw)
  To: gdb-patches

Hello,

this patch series enhanced our procedures for updating the copyright
years by switching away from an emacs lisp program to a script that's
part of gnulib.

There are several parts to this series:

  1. Importing the update-copyright script from gnulib

  2. Write a new script that uses it. Since I had never used it before,
     I spent a lot of time double-checking the output.

     gnulib's update-copyright script is more general than the
     emacs-based approach, and it allows us to lift the limitation
     about several categories of files that previously had to be updated
     by hand. It is also worth mentioning that update-copyright gets
     the job done in 2 seconds where the emacs would take, IIRC, a good
     10-15 minutes.

     update-copyright, however, is a little more sensitive to incorrect
     formatting of the copyright notice. As a result, it failed to
     find the copyright notice in several files.

     But the good news is that it does generate a warning when not finding
     the copyright notice in a file.  So I enhance our new script to catch
     them and process them.  For each file that that update-copyright
     cannot update, I perform a crude sanity check, and let the warning
     through if there is any chance that the file might have, in fact,
     a copyright notice.

     The script does not let through warning about files where the word
     "Copyright" does not appear within the first 50 lines (arbitrary
     but seemed like a good number), because there are a LOT (and I mean
     A LOT) of those, and so these warnings would drown the rest.  We
     should probably fix those, but this is not the job of the guy
     simply updating the existing copyright notices.

     Finally, I should say that the new script was written in Python,
     compatible with Python 2.6 and 2.7 at least. This is simply because
     it was so much harder for me to write the same sanity checks in
     bourne shell.

  3. The last patch updates our documentation.

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

* [commit 1/3] Import gnulib's update-copyright script
  2012-01-04  8:20 New procedure for updating copyright years Joel Brobecker
  2012-01-04  8:20 ` [commit 2/3] use gnulib's update-copyright script to update " Joel Brobecker
  2012-01-04  8:20 ` [RFA/doco 3/3] Document new procedure for updating " Joel Brobecker
@ 2012-01-04  8:20 ` Joel Brobecker
  2012-04-18 12:41   ` Pedro Alves
  2 siblings, 1 reply; 15+ messages in thread
From: Joel Brobecker @ 2012-01-04  8:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

gdb/ChangeLog:

        * gnulib/extra/update-copyright: New file, imported from gnulib.

Checked in.
---
 gdb/ChangeLog                     |    4 +
 gdb/gnulib/extra/update-copyright |  267 +++++++++++++++++++++++++++++++++++++
 2 files changed, 271 insertions(+), 0 deletions(-)
 create mode 100755 gdb/gnulib/extra/update-copyright

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b68d64c..834b5be 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2012-01-04  Joel Brobecker  <brobecker@adacore.com>
 
+	* gnulib/extra/update-copyright: New file, imported from gnulib.
+
+2012-01-04  Joel Brobecker  <brobecker@adacore.com>
+
 	* README (Copyright and License Notices): New section.
 
 2012-01-03  Tom Tromey  <tromey@redhat.com>
diff --git a/gdb/gnulib/extra/update-copyright b/gdb/gnulib/extra/update-copyright
new file mode 100755
index 0000000..d86a12b
--- /dev/null
+++ b/gdb/gnulib/extra/update-copyright
@@ -0,0 +1,267 @@
+eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
+  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
+    if 0;
+# Update an FSF copyright year list to include the current year.
+
+my $VERSION = '2011-01-02.20:59'; # UTC
+
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+#
+# 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 3, 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, see <http://www.gnu.org/licenses/>.
+
+# Written by Jim Meyering and Joel E. Denny
+
+# The arguments to this script should be names of files that contain
+# copyright statements to be updated.  The copyright holder's name
+# defaults to "Free Softward Foundation, Inc." but may be changed to
+# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
+# variable.
+#
+# For example, you might wish to use the update-copyright target rule
+# in maint.mk from gnulib's maintainer-makefile module.
+#
+# Iff a copyright statement is recognized in a file and the final
+# year is not the current year, then the statement is updated for the
+# new year and it is reformatted to:
+#
+#   1. Fit within 72 columns.
+#   2. Convert 2-digit years to 4-digit years by prepending "19".
+#   3. Expand copyright year intervals.  (See "Environment variables"
+#      below.)
+#
+# A warning is printed for every file for which no copyright
+# statement is recognized.
+#
+# Each file's copyright statement must be formated correctly in
+# order to be recognized.  For example, each of these is fine:
+#
+#   Copyright @copyright{} 1990-2005, 2007-2009 Free Software
+#   Foundation, Inc.
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#    * Copyright &copy; 90,2005,2007-2009
+#    * Free Software Foundation, Inc.
+#    */
+#
+# However, the following format is not recognized because the line
+# prefix changes after the first line:
+#
+#   ## Copyright (C) 1990-2005, 2007-2009 Free Software
+#   #  Foundation, Inc.
+#
+# However, any correctly formatted copyright statement following
+# a non-matching copyright statements would be recognized.
+#
+# The exact conditions that a file's copyright statement must meet
+# to be recognized are:
+#
+#   1. It is the first copyright statement that meets all of the
+#      following conditions.  Subsequent copyright statements are
+#      ignored.
+#   2. Its format is "Copyright (C)", then a list of copyright years,
+#      and then the name of the copyright holder.
+#   3. The "(C)" takes one of the following forms or is omitted
+#      entirely:
+#
+#        A. (C)
+#        B. (c)
+#        C. @copyright{}
+#        D. &copy;
+#
+#   4. The "Copyright" appears at the beginning of a line, except that it
+#      may be prefixed by any sequence (e.g., a comment) of no more than
+#      5 characters -- including white space.
+#   5. Iff such a prefix is present, the same prefix appears at the
+#      beginning of each remaining line within the FSF copyright
+#      statement.  There is one exception in order to support C-style
+#      comments: if the first line's prefix contains nothing but
+#      whitespace surrounding a "/*", then the prefix for all subsequent
+#      lines is the same as the first line's prefix except with each of
+#      "/" and possibly "*" replaced by a " ".  The replacement of "*"
+#      by " " is consistent throughout all subsequent lines.
+#   6. Blank lines, even if preceded by the prefix, do not appear
+#      within the FSF copyright statement.
+#   7. Each copyright year is 2 or 4 digits, and years are separated by
+#      commas or dashes.  Whitespace may appear after commas.
+#
+# Environment variables:
+#
+#   1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
+#      is reformatted even if it does not need updating for the new
+#      year.  If unset or set to 0, only updated FSF copyright
+#      statements are reformatted.
+#   2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
+#      copyright years (such as 90, 1991, 1992-2007, 2008) in a
+#      reformatted FSF copyright statement is collapsed to a single
+#      interval (such as 1990-2008).  If unset or set to 0, all existing
+#      copyright year intervals in a reformatted FSF copyright statement
+#      are expanded instead.
+#   3. For testing purposes, you can set the assumed current year in
+#      UPDATE_COPYRIGHT_YEAR.
+#   4. The default maximum line length for a copyright line is 72.
+#      Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
+#   5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
+#      than "Free Software Foundation, Inc.".
+
+use strict;
+use warnings;
+
+my $copyright_re = 'Copyright';
+my $circle_c_re = '(?:\([cC]\)|@copyright{}|&copy;)';
+my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
+$holder ||= 'Free Software Foundation, Inc.';
+my $prefix_max = 5;
+my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
+!$margin || $margin !~ m/^\d+$/
+  and $margin = 72;
+
+my $tab_width = 8;
+
+my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
+if (!$this_year || $this_year !~ m/^\d{4}$/)
+  {
+    my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
+    $this_year = $year + 1900;
+  }
+
+# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
+my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
+
+my $leading;
+my $prefix;
+my $ws_re;
+my $stmt_re;
+while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
+  {
+    $leading = "$1$2";
+    $prefix = $2;
+    if ($prefix =~ /^(\s*\/)\*(\s*)$/)
+      {
+        $prefix =~ s,/, ,;
+        my $prefix_ws = $prefix;
+        $prefix_ws =~ s/\*/ /; # Only whitespace.
+        if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
+          {
+            $prefix = $prefix_ws;
+          }
+      }
+    $ws_re = '[ \t\r\f]'; # \s without \n
+    $ws_re =
+      "(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
+    my $holder_re = $holder;
+    $holder_re =~ s/\s/$ws_re/g;
+    my $stmt_remainder_re =
+      "(?:$ws_re$circle_c_re)?"
+      . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*"
+      . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
+    if (/\G$stmt_remainder_re/)
+      {
+        $stmt_re =
+          quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
+        last;
+      }
+  }
+if (defined $stmt_re)
+  {
+    /$stmt_re/ or die; # Should never die.
+    my $stmt = $1;
+    my $final_year_orig = $2;
+
+    # Handle two-digit year numbers like "98" and "99".
+    my $final_year = $final_year_orig;
+    $final_year <= 99
+      and $final_year += 1900;
+
+    if ($final_year != $this_year)
+      {
+        # Update the year.
+        $stmt =~ s/$final_year_orig/$final_year, $this_year/;
+      }
+    if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
+      {
+        # Normalize all whitespace including newline-prefix sequences.
+        $stmt =~ s/$ws_re/ /g;
+
+        # Put spaces after commas.
+        $stmt =~ s/, ?/, /g;
+
+        # Convert 2-digit to 4-digit years.
+        $stmt =~ s/(\b\d\d\b)/19$1/g;
+
+        # Make the use of intervals consistent.
+        if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
+          {
+            $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg;
+          }
+        else
+          {
+            $stmt =~
+              s/
+                (\d{4})
+                (?:
+                  (,\ |-)
+                  ((??{
+                    if    ($2 eq '-') { '\d{4}'; }
+                    elsif (!$3)       { $1 + 1;  }
+                    else              { $3 + 1;  }
+                  }))
+                )+
+              /$1-$3/gx;
+          }
+
+        # Format within margin.
+        my $stmt_wrapped;
+        my $text_margin = $margin - length($prefix);
+        if ($prefix =~ /^(\t+)/)
+          {
+            $text_margin -= length($1) * ($tab_width - 1);
+          }
+        while (length $stmt)
+          {
+            if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
+                || ($stmt =~ s/^([\S]+)(?: |$)//))
+              {
+                my $line = $1;
+                $stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
+                $stmt_wrapped .= $line;
+              }
+            else
+              {
+                # Should be unreachable, but we don't want an infinite
+                # loop if it can be reached.
+                die;
+              }
+          }
+
+        # Replace the old copyright statement.
+        s/$stmt_re/$stmt_wrapped/;
+      }
+  }
+else
+  {
+    print STDERR "$ARGV: warning: copyright statement not found\n";
+  }
+
+# Local variables:
+# mode: perl
+# indent-tabs-mode: nil
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "my $VERSION = '"
+# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "'; # UTC"
+# End:
-- 
1.7.1

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

* Re: [RFA/doco 3/3] Document new procedure for updating copyright years
  2012-01-04  8:20 ` [RFA/doco 3/3] Document new procedure for updating " Joel Brobecker
@ 2012-01-04 18:24   ` Eli Zaretskii
  2012-01-05  3:34     ` Joel Brobecker
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2012-01-04 18:24 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches, brobecker

> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Joel Brobecker <brobecker@adacore.com>
> Date: Wed,  4 Jan 2012 12:19:06 +0400
> 
> We now use a different script to perform the update.  This patch
> updates the procedure in our documentation
> 
> gdb/doc/ChangeLog:
> 
>         * gdbint.texinfo (Start of New Year Procedure): Update
>         to replace use of copyright.sh by use of copyright.py.
> 
> OK to commit?

Yes, with one comment:

> -Run the @file{copyright.sh} script to add the new year in the copyright
> -notices of most source files.  This script requires Emacs 22 or later to
> -be installed.
> ...
> +Run the @file{copyright.py} Python script to add the new year in the copyright
> +notices of most source files.

Should we tell which versions of Python are required to run the
script, like the old text said about Emacs?

Thanks.

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

* Re: [RFA/doco 3/3] Document new procedure for updating copyright years
  2012-01-04 18:24   ` Eli Zaretskii
@ 2012-01-05  3:34     ` Joel Brobecker
  2012-01-05  5:44       ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Joel Brobecker @ 2012-01-05  3:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

> > gdb/doc/ChangeLog:
> > 
> >         * gdbint.texinfo (Start of New Year Procedure): Update
> >         to replace use of copyright.sh by use of copyright.py.
> > 
> > OK to commit?
[...]
> Should we tell which versions of Python are required to run the
> script, like the old text said about Emacs?

Ah, yes. I had intended to provide that piece of information as well.
How is this version?

Thanks,
-- 
Joel

[-- Attachment #2: copyright-update-doco-2.diff --]
[-- Type: text/x-diff, Size: 1477 bytes --]

commit 8d1049fbf448557887daa7497e3c60b103ecedee
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Wed Jan 4 11:50:00 2012 +0400

    Document new procedure for updating copyright years
    
    We now use a different script to perform the update.  This patch
    updates the procedure in our documentation
    
    gdb/doc/ChangeLog:
    
            * gdbint.texinfo (Start of New Year Procedure): Update
            to replace use of copyright.sh by use of copyright.py.

diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index ddc4015..136f77f 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -6798,35 +6798,9 @@ Update the copyright year in:
 @end itemize
 
 @item
-Run the @file{copyright.sh} script to add the new year in the copyright
-notices of most source files.  This script requires Emacs 22 or later to
-be installed.
-
-@item
-The new year also needs to be added manually in all other files that
-are not already taken care of by the @file{copyright.sh} script:
-@itemize @bullet
-  @item
-  @file{*.s}
-  @item
-  @file{*.f}
-  @item
-  @file{*.f90}
-  @item
-  @file{*.igen}
-  @item
-  @file{*.ac}
-  @item
-  @file{*.texi}
-  @item
-  @file{*.texinfo}
-  @item
-  @file{*.tex}
-  @item
-  @file{*.defs}
-  @item
-  @file{*.1}
-@end itemize
+Run the @file{copyright.py} Python script to add the new year in the copyright
+notices of most source files.  This script has been tested with Python
+2.6 and 2.7.
 
 @end itemize
 

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

* Re: [RFA/doco 3/3] Document new procedure for updating copyright years
  2012-01-05  3:34     ` Joel Brobecker
@ 2012-01-05  5:44       ` Eli Zaretskii
  2012-01-05  9:42         ` Joel Brobecker
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2012-01-05  5:44 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Thu, 5 Jan 2012 07:34:01 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> > Should we tell which versions of Python are required to run the
> > script, like the old text said about Emacs?
> 
> Ah, yes. I had intended to provide that piece of information as well.
> How is this version?

Fine, thank you.

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

* Re: [RFA/doco 3/3] Document new procedure for updating copyright years
  2012-01-05  5:44       ` Eli Zaretskii
@ 2012-01-05  9:42         ` Joel Brobecker
  0 siblings, 0 replies; 15+ messages in thread
From: Joel Brobecker @ 2012-01-05  9:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> > > Should we tell which versions of Python are required to run the
> > > script, like the old text said about Emacs?
> > 
> > Ah, yes. I had intended to provide that piece of information as well.
> > How is this version?
> 
> Fine, thank you.

Yay! This patch is now in.

Thank you,
-- 
Joel

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

* Re: [commit 1/3] Import gnulib's update-copyright script
  2012-01-04  8:20 ` [commit 1/3] Import gnulib's update-copyright script Joel Brobecker
@ 2012-04-18 12:41   ` Pedro Alves
  2012-04-18 14:37     ` Joel Brobecker
  2012-04-18 20:52     ` Import gnulib's update-copyright whole module Pedro Alves
  0 siblings, 2 replies; 15+ messages in thread
From: Pedro Alves @ 2012-04-18 12:41 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 01/04/2012 08:19 AM, Joel Brobecker wrote:

> gdb/ChangeLog:
> 
>         * gnulib/extra/update-copyright: New file, imported from gnulib.


It looks like this file was simply copied over instead of imported with
gnulib-tool?  If I reimport the gnulib/ directory from scratch, we lose it:

[pedro@brno][~/gdb/mygit/src/gdb]
>mv gnulib/ gnulib.org
[pedro@brno][~/gdb/mygit/src/gdb]
>~/src/gnulib/gnulib/gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem
...
[pedro@brno][~/gdb/mygit/src/gdb]
>git status
# On branch gnulib_fixes
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    gnulib/Makefile.in
#       deleted:    gnulib/extra/update-copyright
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If I pull the "update-copyright" gnulib module in addition, with:

[pedro@brno][~/gdb/mygit/src/gdb]
>~/src/gnulib/gnulib/gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright

then we get it back, but, we get an older 2010 version, thus we end up with a non-empty diff, see below.

It doesn't look like we miss anything important for us.  I think I'll apply this,
and then update gnulib (using gnulib-tool) to the current upstream version.
Even if we do miss something with the rollback, we're not going to be running
the script in the middle of the year anyway.  :-)

Okay in principle?

[pedro@brno][~/gdb/mygit/src/gdb]
>git status
...
#
#       modified:   gnulib/Makefile.am
#       deleted:    gnulib/Makefile.in
#       modified:   gnulib/extra/update-copyright
#       modified:   gnulib/m4/gnulib-cache.m4
#       modified:   gnulib/m4/gnulib-comp.m4

diff --git i/gdb/gnulib/Makefile.am w/gdb/gnulib/Makefile.am
index 1296c01..e14ea74 100644
--- i/gdb/gnulib/Makefile.am
+++ w/gdb/gnulib/Makefile.am
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright

 AUTOMAKE_OPTIONS = 1.5 gnits

@@ -299,6 +299,13 @@ EXTRA_DIST += string.in.h

 ## end   gnulib module string

+## begin gnulib module update-copyright
+
+
+EXTRA_DIST += $(top_srcdir)/gnulib/extra/update-copyright
+
+## end   gnulib module update-copyright
+
 ## begin gnulib module warn-on-use

 BUILT_SOURCES += warn-on-use.h
diff --git i/gdb/gnulib/extra/update-copyright w/gdb/gnulib/extra/update-copyright
index 082b749..28ff441 100755
--- i/gdb/gnulib/extra/update-copyright
+++ w/gdb/gnulib/extra/update-copyright
@@ -3,9 +3,9 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
     if 0;
 # Update an FSF copyright year list to include the current year.

-my $VERSION = '2012-02-05.21:39'; # UTC
+my $VERSION = '2009-12-28.11:09'; # UTC

-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# Copyright (C) 2009-2010 Free Software Foundation, Inc.
 #
 # 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
@@ -22,16 +22,12 @@ my $VERSION = '2012-02-05.21:39'; # UTC

 # Written by Jim Meyering and Joel E. Denny

-# The arguments to this script should be names of files that contain
-# copyright statements to be updated.  The copyright holder's name
-# defaults to "Free Software Foundation, Inc." but may be changed to
-# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
-# variable.
+# The arguments to this script should be names of files that contain FSF
+# copyright statements to be updated.  For example, you might wish to
+# use the update-copyright target rule in maint.mk from gnulib's
+# maintainer-makefile module.
 #
-# For example, you might wish to use the update-copyright target rule
-# in maint.mk from gnulib's maintainer-makefile module.
-#
-# Iff a copyright statement is recognized in a file and the final
+# Iff an FSF copyright statement is recognized in a file and the final
 # year is not the current year, then the statement is updated for the
 # new year and it is reformatted to:
 #
@@ -40,10 +36,10 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #   3. Expand copyright year intervals.  (See "Environment variables"
 #      below.)
 #
-# A warning is printed for every file for which no copyright
+# A warning is printed for every file for which no FSF copyright
 # statement is recognized.
 #
-# Each file's copyright statement must be formatted correctly in
+# Each file's FSF copyright statement must be formated correctly in
 # order to be recognized.  For example, each of these is fine:
 #
 #   Copyright @copyright{} 1990-2005, 2007-2009 Free Software
@@ -63,17 +59,23 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #   ## Copyright (C) 1990-2005, 2007-2009 Free Software
 #   #  Foundation, Inc.
 #
-# However, any correctly formatted copyright statement following
-# a non-matching copyright statements would be recognized.
+# The following copyright statement is not recognized because the
+# copyright holder is not the FSF:
+#
+#   Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 #
-# The exact conditions that a file's copyright statement must meet
+# However, any correctly formatted FSF copyright statement following
+# either of the previous two copyright statements would be recognized.
+#
+# The exact conditions that a file's FSF copyright statement must meet
 # to be recognized are:
 #
-#   1. It is the first copyright statement that meets all of the
-#      following conditions.  Subsequent copyright statements are
+#   1. It is the first FSF copyright statement that meets all of the
+#      following conditions.  Subsequent FSF copyright statements are
 #      ignored.
 #   2. Its format is "Copyright (C)", then a list of copyright years,
-#      and then the name of the copyright holder.
+#      and then the name of the copyright holder, which is "Free
+#      Software Foundation, Inc.".
 #   3. The "(C)" takes one of the following forms or is omitted
 #      entirely:
 #
@@ -82,9 +84,9 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #        C. @copyright{}
 #        D. &copy;
 #
-#   4. The "Copyright" appears at the beginning of a line, except that it
+#   4. The "Copyright" appears at the beginning of a line except that it
 #      may be prefixed by any sequence (e.g., a comment) of no more than
-#      5 characters -- including white space.
+#      5 characters.
 #   5. Iff such a prefix is present, the same prefix appears at the
 #      beginning of each remaining line within the FSF copyright
 #      statement.  There is one exception in order to support C-style
@@ -110,23 +112,17 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #      interval (such as 1990-2008).  If unset or set to 0, all existing
 #      copyright year intervals in a reformatted FSF copyright statement
 #      are expanded instead.
-#      If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
-#      to the minimal containing range.  For example, convert
-#      2000, 2004-2007, 2009 to 2000-2009.
 #   3. For testing purposes, you can set the assumed current year in
 #      UPDATE_COPYRIGHT_YEAR.
 #   4. The default maximum line length for a copyright line is 72.
 #      Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
-#   5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
-#      than "Free Software Foundation, Inc.".

 use strict;
 use warnings;

 my $copyright_re = 'Copyright';
 my $circle_c_re = '(?:\([cC]\)|@copyright{}|&copy;)';
-my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
-$holder ||= 'Free Software Foundation, Inc.';
+my $holder = 'Free Software Foundation, Inc.';
 my $prefix_max = 5;
 my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
 !$margin || $margin !~ m/^\d+$/
@@ -224,10 +220,6 @@ if (defined $stmt_re)
                   }))
                 )+
               /$1-$3/gx;
-
-            # When it's 2, emit a single range encompassing all year numbers.
-            $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
-              and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
           }

         # Format within margin.
@@ -260,7 +252,7 @@ if (defined $stmt_re)
   }
 else
   {
-    print STDERR "$ARGV: warning: copyright statement not found\n";
+    print STDERR "$ARGV: warning: FSF copyright statement not found\n";
   }

 # Local variables:
diff --git i/gdb/gnulib/m4/gnulib-cache.m4 w/gdb/gnulib/m4/gnulib-cache.m4
index de1c994..e557bb7 100644
--- i/gdb/gnulib/m4/gnulib-cache.m4
+++ w/gdb/gnulib/m4/gnulib-cache.m4
@@ -15,13 +15,14 @@


 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright

 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   inttypes
   memmem
+  update-copyright
 ])
 gl_AVOID([])
 gl_SOURCE_BASE([gnulib])
diff --git i/gdb/gnulib/m4/gnulib-comp.m4 w/gdb/gnulib/m4/gnulib-comp.m4
index abde4aa..582e35d 100644
--- i/gdb/gnulib/m4/gnulib-comp.m4
+++ w/gdb/gnulib/m4/gnulib-comp.m4
@@ -38,6 +38,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module stddef:
   # Code from module stdint:
   # Code from module string:
+  # Code from module update-copyright:
   # Code from module warn-on-use:
   # Code from module wchar:
 ])
@@ -80,6 +81,7 @@ AC_DEFUN([gl_INIT],
   gl_STDINT_H
   # Code from module string:
   gl_HEADER_STRING_H
+  # Code from module update-copyright:
   # Code from module warn-on-use:
   # Code from module wchar:
   gl_WCHAR_H
@@ -226,6 +228,7 @@ AC_DEFUN([gltests_LIBSOURCES], [
 AC_DEFUN([gl_FILE_LIST], [
   build-aux/arg-nonnull.h
   build-aux/c++defs.h
+  build-aux/update-copyright
   build-aux/warn-on-use.h
   lib/dummy.c
   lib/inttypes.in.h

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

* Re: [commit 1/3] Import gnulib's update-copyright script
  2012-04-18 12:41   ` Pedro Alves
@ 2012-04-18 14:37     ` Joel Brobecker
  2012-04-18 14:52       ` Pedro Alves
  2012-04-18 20:52     ` Import gnulib's update-copyright whole module Pedro Alves
  1 sibling, 1 reply; 15+ messages in thread
From: Joel Brobecker @ 2012-04-18 14:37 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> > gdb/ChangeLog:
> > 
> >         * gnulib/extra/update-copyright: New file, imported from gnulib.
> 
> 
> It looks like this file was simply copied over instead of imported with
> gnulib-tool?  If I reimport the gnulib/ directory from scratch, we lose it:

I am pretty sure I pulled it using gnulib tool... But I think
I then just selectively checked the script in only, to avoid
bringing in more changes than necessary.

This business of maintaining our gnulib import is getting a little
silly, because we cannot determine for sure how people might have
imported stuff. Perhaps we should just go ahead with the script
I wrote to import/update our gnulib import, and make sure people
use that? It might not be the perfect way of doing it, but at least
it would be consistent.

> If I pull the "update-copyright" gnulib module in addition, with:
[...]
> then we get it back, but, we get an older 2010 version, thus we end up
> with a non-empty diff, see below.

Do you know why? I thought that it would just import whatever version
you have checked out. Did you do the import using the exact same
version that you used during the last import?

When I did this, I just pulled the latest gnulib from git, and then
called gnulib tool. That's why I am a little confused by you saying
that you'll update gnulib using gnulib-tool.

> It doesn't look like we miss anything important for us.  I think I'll
> apply this,

We'll need the latest version by the end of the year. There are two
things that it brings which we use: warnings when an FSF copyright
isn't found, and also merging all copyright years together into
one single range.

> Okay in principle?

Sure! I think you know how to use gnulib way better than I do.

-- 
Joel

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

* Re: [commit 1/3] Import gnulib's update-copyright script
  2012-04-18 14:37     ` Joel Brobecker
@ 2012-04-18 14:52       ` Pedro Alves
  2012-04-18 14:54         ` Joel Brobecker
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2012-04-18 14:52 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 04/18/2012 03:36 PM, Joel Brobecker wrote:

>>> gdb/ChangeLog:
>>>
>>>         * gnulib/extra/update-copyright: New file, imported from gnulib.
>>
>>
>> It looks like this file was simply copied over instead of imported with
>> gnulib-tool?  If I reimport the gnulib/ directory from scratch, we lose it:
> 
> I am pretty sure I pulled it using gnulib tool... But I think
> I then just selectively checked the script in only, to avoid
> bringing in more changes than necessary.
> 
> This business of maintaining our gnulib import is getting a little
> silly, because we cannot determine for sure how people might have
> imported stuff. Perhaps we should just go ahead with the script
> I wrote to import/update our gnulib import, and make sure people
> use that? It might not be the perfect way of doing it, but at least
> it would be consistent.


I don't see how that scripts would have prevented the selective
check-in.  :-)  It may help by keeping the git version in some
script variable, that the script checks, instead of having to fetch
the version from the ChangeLog?  The new gnulib/ parent directory
seems like a good place for this stuff.

> 
>> If I pull the "update-copyright" gnulib module in addition, with:
> [...]
>> then we get it back, but, we get an older 2010 version, thus we end up
>> with a non-empty diff, see below.
> 
> Do you know why? I thought that it would just import whatever version
> you have checked out. Did you do the import using the exact same
> version that you used during the last import?


Yes, exactly.  The last import was:

2010-05-23  Pedro Alves  <pedro@codesourcery.com>

        Update gnulib from latest git.
        (250b80067c1e1d8faa0c42fb572f721975b929c5)

That's the git hash.  So I'm picking up that date's version.

> 
> When I did this, I just pulled the latest gnulib from git, and then
> called gnulib tool. That's why I am a little confused by you saying
> that you'll update gnulib using gnulib-tool.
> 
>> It doesn't look like we miss anything important for us.  I think I'll
>> apply this,
> 
> We'll need the latest version by the end of the year. There are two
> things that it brings which we use: warnings when an FSF copyright
> isn't found, and also merging all copyright years together into
> one single range.
> 
>> Okay in principle?
> 
> Sure! I think you know how to use gnulib way better than I do.

Okay.  :-)

-- 
Pedro Alves

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

* Re: [commit 1/3] Import gnulib's update-copyright script
  2012-04-18 14:52       ` Pedro Alves
@ 2012-04-18 14:54         ` Joel Brobecker
  2012-04-18 15:10           ` Pedro Alves
  2012-04-18 15:12           ` Tom Tromey
  0 siblings, 2 replies; 15+ messages in thread
From: Joel Brobecker @ 2012-04-18 14:54 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> I don't see how that scripts would have prevented the selective
> check-in.  :-)

Perhaps not, but what I would have done was doing an update first,
check that in, and then add the new module. WDYT?

> It may help by keeping the git version in some script variable, that
> the script checks, instead of having to fetch the version from the
> ChangeLog?  The new gnulib/ parent directory seems like a good place
> for this stuff.

Sure. Since there does not appear to be gnulib releases, I was
under the impression that we'd always go with the current head,
somehow. Having the hash in the script is a good idea, makes
things completely reproduceable...

-- 
Joel

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

* Re: [commit 1/3] Import gnulib's update-copyright script
  2012-04-18 14:54         ` Joel Brobecker
@ 2012-04-18 15:10           ` Pedro Alves
  2012-04-18 15:12           ` Tom Tromey
  1 sibling, 0 replies; 15+ messages in thread
From: Pedro Alves @ 2012-04-18 15:10 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 04/18/2012 03:52 PM, Joel Brobecker wrote:

>> I don't see how that scripts would have prevented the selective
>> check-in.  :-)
> 
> Perhaps not, but what I would have done was doing an update first,
> check that in, and then add the new module. WDYT?


Yes, that or the other way around, is the right way to do update gnulib.
We should never end up with a mix of files from different versions,
as that gets messy and undone with the next import.  See how Yao imported
inttypes recently -- he imported it from that same 2010 version.

> 
>> It may help by keeping the git version in some script variable, that
>> the script checks, instead of having to fetch the version from the
>> ChangeLog?  The new gnulib/ parent directory seems like a good place
>> for this stuff.
> 
> Sure. Since there does not appear to be gnulib releases, I was
> under the impression that we'd always go with the current head,
> somehow. 


Yeah, but of the whole gnulib as a unit.  There's a lot of dependencies
between the modules.  And there's no telling if some random import
would break some host, due to some gnulib, so it's best if we know
exactly which version was used.

> Having the hash in the script is a good idea, makes
> things completely reproduceable...


Exactly.

Okay, we're in violent agreement at this point.  :-)

I'll go update gnulib to the current version.

-- 
Pedro Alves

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

* Re: [commit 1/3] Import gnulib's update-copyright script
  2012-04-18 14:54         ` Joel Brobecker
  2012-04-18 15:10           ` Pedro Alves
@ 2012-04-18 15:12           ` Tom Tromey
  1 sibling, 0 replies; 15+ messages in thread
From: Tom Tromey @ 2012-04-18 15:12 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pedro Alves, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> Sure. Since there does not appear to be gnulib releases, I was
Joel> under the impression that we'd always go with the current head,
Joel> somehow. Having the hash in the script is a good idea, makes
Joel> things completely reproduceable...

Yes, I think most gnulib users just update it using gnulib master.

Last time we discussed this, Mark K. said that our approach was to
update it based on need.

Recording the revision somewhere obvious (not ChangeLog perhaps but
maybe a file in the "wrapping" directory, whatever it is called?) seems
ok to me.

Tom

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

* Import gnulib's update-copyright whole module
  2012-04-18 12:41   ` Pedro Alves
  2012-04-18 14:37     ` Joel Brobecker
@ 2012-04-18 20:52     ` Pedro Alves
  1 sibling, 0 replies; 15+ messages in thread
From: Pedro Alves @ 2012-04-18 20:52 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Joel Brobecker, gdb-patches

On 04/18/2012 01:33 PM, Pedro Alves wrote:

> If I pull the "update-copyright" gnulib module in addition, with:
> 
> [pedro@brno][~/gdb/mygit/src/gdb]
>> >~/src/gnulib/gnulib/gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright
> then we get it back, but, we get an older 2010 version, thus we end up with a non-empty diff, see below.


Okay, I've now checked this in.

2012-04-18  Pedro Alves  <palves@redhat.com>

	Reimport the update-copyright module from gnulib
	(250b80067c1e1d8faa0c42fb572f721975b929c5).

	* configure: Regenerate.
	* gnulib/Makefile.am: Update.
	* gnulib/Makefile.in: Regenerate.
	* gnulib/extra/update-copyright: Update.
	* gnulib/m4/gnulib-cache.m4: Update.
	* gnulib/m4/gnulib-comp.m4: Update.
---
 gdb/configure                     |    2 +
 gdb/gnulib/Makefile.am            |    9 +++++-
 gdb/gnulib/Makefile.in            |   11 ++++---
 gdb/gnulib/extra/update-copyright |   58 ++++++++++++++++---------------------
 gdb/gnulib/m4/gnulib-cache.m4     |    3 +-
 gdb/gnulib/m4/gnulib-comp.m4      |    3 ++
 6 files changed, 46 insertions(+), 40 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index 60652d6..55b0ce2 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -4319,6 +4319,7 @@ fi
   # Code from module stddef:
   # Code from module stdint:
   # Code from module string:
+  # Code from module update-copyright:
   # Code from module warn-on-use:
   # Code from module wchar:

@@ -8372,6 +8373,7 @@ _ACEOF



+  # Code from module update-copyright:
   # Code from module warn-on-use:
   # Code from module wchar:

diff --git a/gdb/gnulib/Makefile.am b/gdb/gnulib/Makefile.am
index 1296c01..e14ea74 100644
--- a/gdb/gnulib/Makefile.am
+++ b/gdb/gnulib/Makefile.am
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright

 AUTOMAKE_OPTIONS = 1.5 gnits

@@ -299,6 +299,13 @@ EXTRA_DIST += string.in.h

 ## end   gnulib module string

+## begin gnulib module update-copyright
+
+
+EXTRA_DIST += $(top_srcdir)/gnulib/extra/update-copyright
+
+## end   gnulib module update-copyright
+
 ## begin gnulib module warn-on-use

 BUILT_SOURCES += warn-on-use.h
diff --git a/gdb/gnulib/Makefile.in b/gdb/gnulib/Makefile.in
index 4e1b1d8..4024b0d 100644
--- a/gdb/gnulib/Makefile.in
+++ b/gdb/gnulib/Makefile.in
@@ -1,8 +1,9 @@
 # Makefile.in generated by automake 1.11 from Makefile.am.
 # @configure_input@

-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -23,7 +24,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright



@@ -522,8 +523,8 @@ EXTRA_DIST = m4/gnulib-cache.m4 \
 	$(top_srcdir)/gnulib/extra/arg-nonnull.h \
 	$(top_srcdir)/gnulib/extra/c++defs.h inttypes.in.h memchr.c \
 	memchr.valgrind memmem.c str-two-way.h stddef.in.h stdint.in.h \
-	string.in.h $(top_srcdir)/gnulib/extra/warn-on-use.h \
-	wchar.in.h
+	string.in.h $(top_srcdir)/gnulib/extra/update-copyright \
+	$(top_srcdir)/gnulib/extra/warn-on-use.h wchar.in.h

 # The BUILT_SOURCES created by this Makefile snippet are not used via #include
 # statements but through direct file reference. Therefore this snippet must be
diff --git a/gdb/gnulib/extra/update-copyright b/gdb/gnulib/extra/update-copyright
index 082b749..28ff441 100755
--- a/gdb/gnulib/extra/update-copyright
+++ b/gdb/gnulib/extra/update-copyright
@@ -3,9 +3,9 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
     if 0;
 # Update an FSF copyright year list to include the current year.

-my $VERSION = '2012-02-05.21:39'; # UTC
+my $VERSION = '2009-12-28.11:09'; # UTC

-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# Copyright (C) 2009-2010 Free Software Foundation, Inc.
 #
 # 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
@@ -22,16 +22,12 @@ my $VERSION = '2012-02-05.21:39'; # UTC

 # Written by Jim Meyering and Joel E. Denny

-# The arguments to this script should be names of files that contain
-# copyright statements to be updated.  The copyright holder's name
-# defaults to "Free Software Foundation, Inc." but may be changed to
-# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
-# variable.
+# The arguments to this script should be names of files that contain FSF
+# copyright statements to be updated.  For example, you might wish to
+# use the update-copyright target rule in maint.mk from gnulib's
+# maintainer-makefile module.
 #
-# For example, you might wish to use the update-copyright target rule
-# in maint.mk from gnulib's maintainer-makefile module.
-#
-# Iff a copyright statement is recognized in a file and the final
+# Iff an FSF copyright statement is recognized in a file and the final
 # year is not the current year, then the statement is updated for the
 # new year and it is reformatted to:
 #
@@ -40,10 +36,10 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #   3. Expand copyright year intervals.  (See "Environment variables"
 #      below.)
 #
-# A warning is printed for every file for which no copyright
+# A warning is printed for every file for which no FSF copyright
 # statement is recognized.
 #
-# Each file's copyright statement must be formatted correctly in
+# Each file's FSF copyright statement must be formated correctly in
 # order to be recognized.  For example, each of these is fine:
 #
 #   Copyright @copyright{} 1990-2005, 2007-2009 Free Software
@@ -63,17 +59,23 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #   ## Copyright (C) 1990-2005, 2007-2009 Free Software
 #   #  Foundation, Inc.
 #
-# However, any correctly formatted copyright statement following
-# a non-matching copyright statements would be recognized.
+# The following copyright statement is not recognized because the
+# copyright holder is not the FSF:
+#
+#   Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 #
-# The exact conditions that a file's copyright statement must meet
+# However, any correctly formatted FSF copyright statement following
+# either of the previous two copyright statements would be recognized.
+#
+# The exact conditions that a file's FSF copyright statement must meet
 # to be recognized are:
 #
-#   1. It is the first copyright statement that meets all of the
-#      following conditions.  Subsequent copyright statements are
+#   1. It is the first FSF copyright statement that meets all of the
+#      following conditions.  Subsequent FSF copyright statements are
 #      ignored.
 #   2. Its format is "Copyright (C)", then a list of copyright years,
-#      and then the name of the copyright holder.
+#      and then the name of the copyright holder, which is "Free
+#      Software Foundation, Inc.".
 #   3. The "(C)" takes one of the following forms or is omitted
 #      entirely:
 #
@@ -82,9 +84,9 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #        C. @copyright{}
 #        D. &copy;
 #
-#   4. The "Copyright" appears at the beginning of a line, except that it
+#   4. The "Copyright" appears at the beginning of a line except that it
 #      may be prefixed by any sequence (e.g., a comment) of no more than
-#      5 characters -- including white space.
+#      5 characters.
 #   5. Iff such a prefix is present, the same prefix appears at the
 #      beginning of each remaining line within the FSF copyright
 #      statement.  There is one exception in order to support C-style
@@ -110,23 +112,17 @@ my $VERSION = '2012-02-05.21:39'; # UTC
 #      interval (such as 1990-2008).  If unset or set to 0, all existing
 #      copyright year intervals in a reformatted FSF copyright statement
 #      are expanded instead.
-#      If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
-#      to the minimal containing range.  For example, convert
-#      2000, 2004-2007, 2009 to 2000-2009.
 #   3. For testing purposes, you can set the assumed current year in
 #      UPDATE_COPYRIGHT_YEAR.
 #   4. The default maximum line length for a copyright line is 72.
 #      Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
-#   5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
-#      than "Free Software Foundation, Inc.".

 use strict;
 use warnings;

 my $copyright_re = 'Copyright';
 my $circle_c_re = '(?:\([cC]\)|@copyright{}|&copy;)';
-my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
-$holder ||= 'Free Software Foundation, Inc.';
+my $holder = 'Free Software Foundation, Inc.';
 my $prefix_max = 5;
 my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
 !$margin || $margin !~ m/^\d+$/
@@ -224,10 +220,6 @@ if (defined $stmt_re)
                   }))
                 )+
               /$1-$3/gx;
-
-            # When it's 2, emit a single range encompassing all year numbers.
-            $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
-              and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
           }

         # Format within margin.
@@ -260,7 +252,7 @@ if (defined $stmt_re)
   }
 else
   {
-    print STDERR "$ARGV: warning: copyright statement not found\n";
+    print STDERR "$ARGV: warning: FSF copyright statement not found\n";
   }

 # Local variables:
diff --git a/gdb/gnulib/m4/gnulib-cache.m4 b/gdb/gnulib/m4/gnulib-cache.m4
index de1c994..e557bb7 100644
--- a/gdb/gnulib/m4/gnulib-cache.m4
+++ b/gdb/gnulib/m4/gnulib-cache.m4
@@ -15,13 +15,14 @@


 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl --no-vc-files inttypes memmem update-copyright

 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   inttypes
   memmem
+  update-copyright
 ])
 gl_AVOID([])
 gl_SOURCE_BASE([gnulib])
diff --git a/gdb/gnulib/m4/gnulib-comp.m4 b/gdb/gnulib/m4/gnulib-comp.m4
index abde4aa..582e35d 100644
--- a/gdb/gnulib/m4/gnulib-comp.m4
+++ b/gdb/gnulib/m4/gnulib-comp.m4
@@ -38,6 +38,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module stddef:
   # Code from module stdint:
   # Code from module string:
+  # Code from module update-copyright:
   # Code from module warn-on-use:
   # Code from module wchar:
 ])
@@ -80,6 +81,7 @@ AC_DEFUN([gl_INIT],
   gl_STDINT_H
   # Code from module string:
   gl_HEADER_STRING_H
+  # Code from module update-copyright:
   # Code from module warn-on-use:
   # Code from module wchar:
   gl_WCHAR_H
@@ -226,6 +228,7 @@ AC_DEFUN([gltests_LIBSOURCES], [
 AC_DEFUN([gl_FILE_LIST], [
   build-aux/arg-nonnull.h
   build-aux/c++defs.h
+  build-aux/update-copyright
   build-aux/warn-on-use.h
   lib/dummy.c
   lib/inttypes.in.h

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

end of thread, other threads:[~2012-04-18 20:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04  8:20 New procedure for updating copyright years Joel Brobecker
2012-01-04  8:20 ` [commit 2/3] use gnulib's update-copyright script to update " Joel Brobecker
2012-01-04  8:20 ` [RFA/doco 3/3] Document new procedure for updating " Joel Brobecker
2012-01-04 18:24   ` Eli Zaretskii
2012-01-05  3:34     ` Joel Brobecker
2012-01-05  5:44       ` Eli Zaretskii
2012-01-05  9:42         ` Joel Brobecker
2012-01-04  8:20 ` [commit 1/3] Import gnulib's update-copyright script Joel Brobecker
2012-04-18 12:41   ` Pedro Alves
2012-04-18 14:37     ` Joel Brobecker
2012-04-18 14:52       ` Pedro Alves
2012-04-18 14:54         ` Joel Brobecker
2012-04-18 15:10           ` Pedro Alves
2012-04-18 15:12           ` Tom Tromey
2012-04-18 20:52     ` Import gnulib's update-copyright whole module Pedro Alves

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).