1#!/bin/sh 2# Update copyright year lists. 3# Copyright (C) 2012-2022 Free Software Foundation, Inc. 4# This file is part of the GNU C Library. 5 6# The GNU C Library is free software; you can redistribute it and/or 7# modify it under the terms of the GNU Lesser General Public 8# License as published by the Free Software Foundation; either 9# version 2.1 of the License, or (at your option) any later version. 10 11# The GNU C Library is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Lesser General Public License for more details. 15 16# You should have received a copy of the GNU Lesser General Public 17# License along with the GNU C Library; if not, see 18# <https://www.gnu.org/licenses/>. 19 20# Run this script with the first argument being the location of 21# gnulib's update-copyright script. Any other arguments are ignored. 22# FSF copyright notices in the glibc source directory containing this 23# script will be updated; glibc must then be built to update generated 24# files. Copyright dates in --version copyright notices are not 25# updated. 26 27set -e 28 29export LC_ALL=C 30export UPDATE_COPYRIGHT_FORCE=1 31export UPDATE_COPYRIGHT_USE_INTERVALS=2 32export UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 33 34update_script=$1 35 36if ! [ -f "$update_script" ]; then 37 echo "error: first argument must point to gnulib update-copyright script" >&2 38 exit 1 39fi 40 41cd "$(dirname "$0")/.." 42 43files=$(find . -type f | sed 's|^\./||' | grep -v '^\.git/') 44 45for f in $files; do 46 case $f in 47 COPYING | COPYING.LIB | manual/fdl-1.3.texi | manual/lgpl-2.1.texi) 48 # Licenses imported verbatim from FSF sources. 49 ;; 50 manual/texinfo.tex | scripts/config.guess | scripts/config.sub \ 51 | scripts/install-sh | scripts/mkinstalldirs | scripts/move-if-change) 52 # Other files imported verbatim from other GNU repositories. 53 ;; 54 po/*.po) 55 # Files imported verbatim from the Translation Project. 56 ;; 57 INSTALL \ 58 | locale/programs/charmap-kw.h | locale/programs/locfile-kw.h \ 59 | po/libc.pot | sysdeps/gnu/errlist.c) 60 # Generated files. 61 ;; 62 configure | */configure | preconfigure | */preconfigure) 63 # Possibly generated files. 64 if ! [ -f "$f.ac" ]; then 65 "$update_script" "$f" 66 fi 67 ;; 68 grp/initgroups.c | misc/bits/stab.def | posix/regex.h \ 69 | sysdeps/wordsize-32/divdi3.c) 70 # Pre-1991 gaps in copyright years, so cannot use a single range. 71 UPDATE_COPYRIGHT_USE_INTERVALS=1 "$update_script" "$f" 72 ;; 73 csu/version.c | elf/dl-usage.c) 74 # Update the copyright string in the output message. 75 year="$(date +%Y)" 76 sed -i 's/^Copyright (C) [0-9]\{4\} /Copyright (C) '"$year"' /' $f 77 "$update_script" "$f" 78 ;; 79 *) 80 "$update_script" "$f" 81 ;; 82 esac 83done 84