execute tests: Add more tests.
[gnulib.git] / check-copyright
blob55c37a90ac14f1e44fb4d7766a24f014bbea2693
1 #!/bin/sh
3 # Copyright (C) 2011-2020 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 error=0
20 for module in `./gnulib-tool --list`; do
21 module_license=`./gnulib-tool --extract-license $module`
22 if test "$module_license" = 'GPLed build tool'; then
23 module_license='GPL'
25 for file in `./gnulib-tool --extract-filelist $module | grep '^\(lib\|build-aux\)/'`; do
26 if grep 'GNU General Public' $file > /dev/null; then
27 if grep 'version 3 or later' $file > /dev/null \
28 || grep 'either version 3' $file > /dev/null; then
29 file_license='GPL'
30 else
31 if grep 'version 2 or later' $file > /dev/null \
32 || grep 'either version 2' $file > /dev/null; then
33 file_license='GPLv2+'
34 else
35 file_license='GPL??'
38 else
39 if grep 'Lesser General' $file > /dev/null; then
40 if grep 'version 3 or later' $file > /dev/null \
41 || grep 'either version 3' $file > /dev/null; then
42 file_license='LGPL'
43 else
44 if grep 'version 2 or later' $file > /dev/null \
45 || grep 'version 2 of the License, or' $file > /dev/null \
46 || grep 'version 2\.1 of the License, or' $file > /dev/null; then
47 file_license='LGPLv2+'
48 else
49 file_license='LGPL??'
52 else
53 file_license='??'
56 if test "$file_license" != "$module_license"; then
57 if test $error = 0; then
58 echo "Module License File License File name"
59 echo "============== ============== ====================================="
61 printf '%-14s %-14s %s\n' "$module_license" "$file_license" "$file"
62 error=1
64 done
65 done
66 exit $error