]> Savannah Git Hosting - gnulib.git/commitdiff
update-copyright: also work with two or more updatable lines in a file
authorJim Meyering <meyering@fb.com>
Tue, 3 Jan 2023 06:52:08 +0000 (22:52 -0800)
committerJim Meyering <meyering@meta.com>
Wed, 11 Jan 2023 04:32:45 +0000 (20:32 -0800)
* build-aux/update-copyright: Replace every occurrence of the copyright
line, not just the first one.
* tests/test-update-copyright.sh: Add a test case for this.

ChangeLog
build-aux/update-copyright
tests/test-update-copyright.sh

index 673da843c151c73c039e70168bd71902b7942cfe..7868d312bfe411a9865d5e1bda9a14f4b6b2d902 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-01-10  Jim Meyering  <meyering@fb.com>
+
+       update-copyright: also work with two or more updatable lines in a file
+       * build-aux/update-copyright: Replace every occurrence of the copyright
+       line, not just the first one.
+       * tests/test-update-copyright.sh: Add a test case for this.
+
 2023-01-10  Bruno Haible  <bruno@clisp.org>
 
        immutable: Fix initialization failure on Android.
index ce919bac727f7f894212bf480f4e749a8f90cc6d..99196fceef64172e40cde577386cfc12a16890ee 100755 (executable)
 eval 'exec perl -wSx -0777 -pi "$0" "$@"'
      if 0;
 
-my $VERSION = '2020-04-04.15:07'; # UTC
+my $VERSION = '2023-01-11.04:24'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -280,7 +280,7 @@ if (defined $stmt_re)
           }
 
         # Replace the old copyright statement.
-        s/$stmt_re/$stmt_wrapped/;
+        s/$stmt_re/$stmt_wrapped/g;
       }
   }
 else
index 377cf8731e707c934390159923f726bbf3f50583..a84ae34512c17dfc7c21424ad368bf51a73bc82c 100755 (executable)
@@ -115,6 +115,10 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2009 Free Software
 # Foundation, Inc.
 EOF
+cat > $TMP.8 <<EOF
+Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2008 Free Software Foundation, Inc.
+EOF
 
 UPDATE_COPYRIGHT_YEAR=2009 \
   update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr
@@ -157,6 +161,10 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2009 Free Software
 # Foundation, Inc.
 EOF
+compare - $TMP.8 <<EOF || exit 1
+Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+EOF
 
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
   update-copyright $TMP.? 1> $TMP-stdout 2> $TMP-stderr