update-copyrights 2.9 KB

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