From 7f1b32336b063be3a672e9285f62c6b8ce5eb6e1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 2 Jan 2023 22:52:08 -0800 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ build-aux/update-copyright | 4 ++-- tests/test-update-copyright.sh | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 673da843c1..7868d312bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-01-10 Jim Meyering + + 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 immutable: Fix initialization failure on Android. diff --git a/build-aux/update-copyright b/build-aux/update-copyright index ce919bac72..99196fceef 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -137,7 +137,7 @@ 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 diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 377cf8731e..a84ae34512 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -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 < $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 < $TMP-stdout 2> $TMP-stderr -- 2.39.5