3 # Find copyright and license problems in Koha source files. At this
4 # time it only looks for references to the old FSF address in GPLv2
5 # license notices, but it might in the future be extended to look for
8 # Copyright 2010 Catalyst IT Ltd
10 # This file is part of Koha.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License along
23 # with this program; if not, write to the Free Software Foundation, Inc.,
24 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 my $name = $File::Find::name;
37 unless $name =~ /\/(\.git|koha-tmpl)(\/.*)?$/ ||
38 $name =~ /\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip)$/ ||
43 sub has_gpl2plus_and_current_fsf_address {
50 open(FILE, $name) || return 0;
51 while (my $line = <FILE>) {
52 $hascopyright = 1 if ($line =~ /Copyright.*\d\d/);
53 $hasgpl = 1 if ($line =~ /GNU General Public License/);
54 $hasv2 = 1 if ($line =~ /either version 2/);
55 $hasorlater = 1 if ($line =~ /any later version/ ||
56 $line =~ /at your option/);
57 $hasfranklinst = 1 if ($line =~ /51 Franklin Street/);
59 return ! $hascopyright ||
60 ($hasgpl && $hasv2 && $hasorlater && $hasfranklinst);
64 find({ wanted => \&wanted, no_chdir => 1 }, @ARGV);
65 foreach my $name (@files) {
66 if (! has_gpl2plus_and_current_fsf_address($name)) {