| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # my-check-copyright-years.sh -- check copyright years in dist |
| 4 | |
| 5 | # Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2017, 2018 Kevin Ryde |
| 6 | |
| 7 | # my-check-copyright-years.sh is shared by several distributions. |
| 8 | # |
| 9 | # my-check-copyright-years.sh is free software; you can redistribute it |
| 10 | # and/or modify it under the terms of the GNU General Public License as |
| 11 | # published by the Free Software Foundation; either version 3, or (at your |
| 12 | # option) any later version. |
| 13 | # |
| 14 | # my-check-copyright-years.sh is distributed in the hope that it will be |
| 15 | # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 17 | # Public License for more details. |
| 18 | # |
| 19 | # You should have received a copy of the GNU General Public License along |
| 20 | # with this file. If not, see <http://www.gnu.org/licenses/>. |
| 21 | |
| 22 | set -e # die on error |
| 23 | set -x # echo |
| 24 | |
| 25 | # find files in the dist with mod times this year, but without this year in |
| 26 | # the copyright line |
| 27 | |
| 28 | if testscip-shell system . . test. -z "$DISTVNAME"; then |
| 29 | DISTVNAME=`sedscip-shell system . . sed. -n 's/^DISTVNAME = \(.*\)/\1/p' Makefile` |
| 30 | fi |
| 31 | case $DISTVNAME in |
| 32 | *\$*) DISTVNAME=`makescip-shell system . . make. echo-DISTVNAME` ;; |
| 33 | esac |
| 34 | if testscip-shell system . . test. -z "$DISTVNAME"; then |
| 35 | echoscip-shell system . . echo. "DISTVNAME not set and not in Makefile" |
| 36 | exit 1 |
| 37 | fi |
| 38 | TARGZ="$DISTVNAME.tar.gz" |
| 39 | if testscip-shell system . . test. -e "$TARGZ"; then :; |
| 40 | else |
| 41 | pwdscip-shell system . . pwd. |
| 42 | echoscip-shell system . . echo. "TARGZ $TARGZ not found" |
| 43 | exit 1 |
| 44 | fi |
| 45 | |
| 46 | |
| 47 | MY_HIDE= |
| 48 | year=`datescip-shell system . . date. +%Y` |
| 49 | |
| 50 | result=0 |
| 51 | |
| 52 | # files with dates $year |
| 53 | tarscip-shell system . . tar. tvfz $TARGZ \ |
| 54 | | egrepscip-shell system . . egrep. "$year-|debian/copyright" \ |
| 55 | | sedscip-shell system . . sed. "s:^.*$DISTVNAME/::" \ |
| 56 | | { |
| 57 | while read i |
| 58 | do |
| 59 | # echo "consider $i" |
| 60 | GREP=grep |
| 61 | case $i in \ |
| 62 | '' | */ \ |
| 63 | | ppport.h \ |
| 64 | | debian/changelog | debian/doc-base \ |
| 65 | | debian/compat | debian/emacsen-compat | debian/source/format \ |
| 66 | | debian/patches/*.diff \ |
| 67 | | COPYING | MANIFEST* | SIGNATURE | META.yml | META.json \ |
| 68 | | version.texi | */version.texi \ |
| 69 | | *utf16* | examples/rs''s2lea''fnode.conf \ |
| 70 | | */MathI''mage/ln2.gz | */MathI''mage/pi.gz \ |
| 71 | | *.mo | *.locatedb* | t/samp.* \ |
| 72 | | t/empty.dat | t/*.xpm | t/*.xbm | t/*.jpg | t/*.gif \ |
| 73 | | t/*.g${MY_HIDE}d \ |
| 74 | | tools/*-oeis-samples.gp \ |
| 75 | | test-oeis-samples.gp \ |
| 76 | | tools/configurations-gfs-generated.gp \ |
| 77 | | devel/configurations-t-generated.gp \ |
| 78 | | test-symbols.txt | test-funcs.txt \ |
| 79 | | devel/minimal-domsets-max-even2.c \ |
| 80 | | */_whizzy*) |
| 81 | continue ;; |
| 82 | *.gz) |
| 83 | GREP=zgrep |
| 84 | esac; \ |
| 85 | |
| 86 | if testscip-shell system . . test. -e "$srcdir/$i" |
| 87 | then f="$srcdir/$i" |
| 88 | else f="$i" |
| 89 | fi |
| 90 | |
| 91 | if $GREP -q -e "Copyright.*$year" $f |
| 92 | then :; |
| 93 | else |
| 94 | echoscip-shell system . . echo. "$i:1: this file" |
| 95 | grepscip-shell system . . grep. Copyright $f |
| 96 | result=1 |
| 97 | fi |
| 98 | done |
| 99 | } |
| 100 | exit $result |