Bugzilla – Attachment 8176 Details for
Bug 4330
Copyright statements out of date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Moving license scripts to misc
patch.txt (text/plain), 16.95 KB, created by
Marcel de Rooy
on 2012-03-12 08:55:12 UTC
(
hide
)
Description:
Moving license scripts to misc
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2012-03-12 08:55:12 UTC
Size:
16.95 KB
patch
obsolete
>From d5bf7ab41625736152d6a849e15b2542d1869a8c Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 12 Mar 2012 09:45:57 +0100 >Subject: [PATCH] 4330 Followup: moving license scripts to misc. >Content-Type: text/plain; charset="utf-8" > >Was triggered by similar cleanup actions in report 7675. >--- > misc/code_fixing/find-license-problems.pl | 69 +++++++++++ > misc/code_fixing/fix-old-fsf-address.exclude | 7 + > misc/code_fixing/fix-old-fsf-address.pl | 167 ++++++++++++++++++++++++++ > xt/find-license-problems | 69 ----------- > xt/fix-old-fsf-address | 167 -------------------------- > xt/fix-old-fsf-address.exclude | 7 - > 6 files changed, 243 insertions(+), 243 deletions(-) > create mode 100755 misc/code_fixing/find-license-problems.pl > create mode 100644 misc/code_fixing/fix-old-fsf-address.exclude > create mode 100755 misc/code_fixing/fix-old-fsf-address.pl > delete mode 100755 xt/find-license-problems > delete mode 100755 xt/fix-old-fsf-address > delete mode 100644 xt/fix-old-fsf-address.exclude > >diff --git a/misc/code_fixing/find-license-problems.pl b/misc/code_fixing/find-license-problems.pl >new file mode 100755 >index 0000000..d0c5c30 >--- /dev/null >+++ b/misc/code_fixing/find-license-problems.pl >@@ -0,0 +1,69 @@ >+#!/usr/bin/perl >+# >+# Find copyright and license problems in Koha source files. At this >+# time it only looks for references to the old FSF address in GPLv2 >+# license notices, but it might in the future be extended to look for >+# other things, too. >+# >+# Copyright 2010 Catalyst IT Ltd >+# >+# This file is part of Koha. >+# >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 2 of the License, or >+# (at your option) any later version. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with this program; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+ >+use strict; >+use warnings; >+ >+use File::Find; >+ >+ >+my @files; >+sub wanted { >+ my $name = $File::Find::name; >+ push @files, $name >+ unless $name =~ /\/(\.git|koha-tmpl)(\/.*)?$/ || >+ $name =~ /\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip)$/ || >+ ! -f $name; >+} >+ >+ >+sub has_gpl2plus_and_current_fsf_address { >+ my ($name) = @_; >+ my $hascopyright; >+ my $hasgpl; >+ my $hasv2; >+ my $hasorlater; >+ my $hasfranklinst; >+ open(FILE, $name) || return 0; >+ while (my $line = <FILE>) { >+ $hascopyright = 1 if ($line =~ /Copyright.*\d\d/); >+ $hasgpl = 1 if ($line =~ /GNU General Public License/); >+ $hasv2 = 1 if ($line =~ /either version 2/); >+ $hasorlater = 1 if ($line =~ /any later version/ || >+ $line =~ /at your option/); >+ $hasfranklinst = 1 if ($line =~ /51 Franklin Street/); >+ } >+ return ! $hascopyright || >+ ($hasgpl && $hasv2 && $hasorlater && $hasfranklinst); >+} >+ >+ >+find({ wanted => \&wanted, no_chdir => 1 }, @ARGV); >+foreach my $name (@files) { >+ if (! has_gpl2plus_and_current_fsf_address($name)) { >+ print "$name\n"; >+ } >+} >diff --git a/misc/code_fixing/fix-old-fsf-address.exclude b/misc/code_fixing/fix-old-fsf-address.exclude >new file mode 100644 >index 0000000..6925560 >--- /dev/null >+++ b/misc/code_fixing/fix-old-fsf-address.exclude >@@ -0,0 +1,7 @@ >+INSTALL.fedora7 >+t/smolder_smoke_signal >+misc/cronjobs/check-url.pl >+misc/cronjobs/cloud-kw.pl >+misc/installer_devel_notes/data/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql >+misc/installer_devel_notes/data/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql >+koha-tmpl/ >diff --git a/misc/code_fixing/fix-old-fsf-address.pl b/misc/code_fixing/fix-old-fsf-address.pl >new file mode 100755 >index 0000000..6a67d8b >--- /dev/null >+++ b/misc/code_fixing/fix-old-fsf-address.pl >@@ -0,0 +1,167 @@ >+#!/usr/bin/perl >+# >+# Fix GPLv2 license blurbs that have the old FSF address at Temple Street, >+# instead of the Franklin Street one. Files to be fixed are read from >+# stdin. Typical usage would be: >+# >+# ./xt/find-license-problems . | >+# grep -vFx -f ./xt/fix-old-fsf-address.exclude | >+# ./xt/fix-old-fsf-address >+# >+# Copyright 2010 Catalyst IT Ltd >+# >+# This file is part of Koha. >+# >+# This program is free software; you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 2 of the License, or >+# (at your option) any later version. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with this program; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+ >+use strict; >+use warnings; >+ >+use File::Basename; >+use File::Copy; >+use File::Temp qw/ tempfile /; >+ >+ >+my $temple = << 'eof'; >+You should have received a copy of the GNU General Public License along with >+Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+Suite 330, Boston, MA 02111-1307 USA >+eof >+ >+my $franklin = << 'eof'; >+You should have received a copy of the GNU General Public License along >+with Koha; if not, write to the Free Software Foundation, Inc., >+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+eof >+ >+ >+my $temple2 = << 'eof'; >+You should have received a copy of the GNU General Public License along with Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+Suite 330, Boston, MA 02111-1307 USA >+eof >+ >+my $franklin2 = << 'eof'; >+You should have received a copy of the GNU General Public License along with Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, >+Fifth Floor, Boston, MA 02110-1301 USA. >+eof >+ >+ >+my $temple3 = << 'eof'; >+You should have received a copy of the GNU General Public License >+along with this program; if not, write to the Free Software >+Foundation, Inc., 50 Temple Place, Suite 330, Boston, MA 02111-1307 USA >+eof >+ >+my $franklin3 = << 'eof'; >+You should have received a copy of the GNU General Public License >+along with this program; if not, write to the Free Software Foundation, Inc., >+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+eof >+ >+ >+my $temple4 = << 'eof'; >+You should have received a copy of the GNU General Public License >+along with Zebra; see the file LICENSE.zebra. If not, write to the >+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA >+02111-1307, USA. >+eof >+ >+my $franklin4 = << 'eof'; >+You should have received a copy of the GNU General Public License >+along with Zebra; see the file LICENSE.zebra. If not, write to the >+Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, >+MA 02110-1301 USA. >+eof >+ >+ >+my @patterns = ($temple, $temple2, $temple3, $temple4); >+my @replacements = ($franklin, $franklin2, $franklin3, $franklin4); >+ >+ >+sub hashcomment { >+ my ($str) = @_; >+ my @lines = split /\n/, $str; >+ my @result; >+ foreach my $line (@lines) { >+ push @result, "# $line\n"; >+ } >+ return join "", @result >+} >+ >+ >+sub dashcomment { >+ my ($str) = @_; >+ my @lines = split /\n/, $str; >+ my @result; >+ foreach my $line (@lines) { >+ push @result, "-- $line\n"; >+ } >+ return join "", @result >+} >+ >+ >+sub readfile { >+ my ($filename) = @_; >+ open(FILE, $filename) || die("Can't open $filename for reading"); >+ my @lines; >+ while (my $line = <FILE>) { >+ push @lines, $line; >+ } >+ close(FILE); >+ return join '', @lines; >+} >+ >+ >+sub try_to_fix { >+ my ($data, @patterns) = @_; >+ return undef; >+} >+ >+ >+sub overwrite { >+ my ($filename, $data) = @_; >+ my ($fh, $tempname) = tempfile(DIR => dirname($filename)); >+ print $fh $data; >+ close($fh); >+ copy($tempname, $filename); >+ unlink($tempname); >+} >+ >+ >+sub fix_temple_street { >+ my ($filename) = @_; >+ my $data = readfile($filename); >+ my @pats = map { ($_, hashcomment($_), dashcomment($_)) } @patterns; >+ my @repls = map { ($_, hashcomment($_), dashcomment($_)) } @replacements; >+ while (@pats) { >+ my $pat = shift @pats; >+ my $repl = shift @repls; >+ my $index = index($data, $pat); >+ next if $index == -1; >+ my $length = length($pat); >+ my $before = substr($data, 0, $index); >+ my $after = substr($data, $index + $length); >+ overwrite($filename, "$before$repl$after"); >+ return; >+ } >+ die("Cannot find old address in $filename"); >+} >+ >+ >+while (my $filename = <>) { >+ chomp $filename; >+ fix_temple_street($filename); >+} >diff --git a/xt/find-license-problems b/xt/find-license-problems >deleted file mode 100755 >index d0c5c30..0000000 >--- a/xt/find-license-problems >+++ /dev/null >@@ -1,69 +0,0 @@ >-#!/usr/bin/perl >-# >-# Find copyright and license problems in Koha source files. At this >-# time it only looks for references to the old FSF address in GPLv2 >-# license notices, but it might in the future be extended to look for >-# other things, too. >-# >-# Copyright 2010 Catalyst IT Ltd >-# >-# This file is part of Koha. >-# >-# This program is free software; you can redistribute it and/or modify >-# it under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 2 of the License, or >-# (at your option) any later version. >-# >-# This program is distributed in the hope that it will be useful, >-# but WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# with this program; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >- >-use strict; >-use warnings; >- >-use File::Find; >- >- >-my @files; >-sub wanted { >- my $name = $File::Find::name; >- push @files, $name >- unless $name =~ /\/(\.git|koha-tmpl)(\/.*)?$/ || >- $name =~ /\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip)$/ || >- ! -f $name; >-} >- >- >-sub has_gpl2plus_and_current_fsf_address { >- my ($name) = @_; >- my $hascopyright; >- my $hasgpl; >- my $hasv2; >- my $hasorlater; >- my $hasfranklinst; >- open(FILE, $name) || return 0; >- while (my $line = <FILE>) { >- $hascopyright = 1 if ($line =~ /Copyright.*\d\d/); >- $hasgpl = 1 if ($line =~ /GNU General Public License/); >- $hasv2 = 1 if ($line =~ /either version 2/); >- $hasorlater = 1 if ($line =~ /any later version/ || >- $line =~ /at your option/); >- $hasfranklinst = 1 if ($line =~ /51 Franklin Street/); >- } >- return ! $hascopyright || >- ($hasgpl && $hasv2 && $hasorlater && $hasfranklinst); >-} >- >- >-find({ wanted => \&wanted, no_chdir => 1 }, @ARGV); >-foreach my $name (@files) { >- if (! has_gpl2plus_and_current_fsf_address($name)) { >- print "$name\n"; >- } >-} >diff --git a/xt/fix-old-fsf-address b/xt/fix-old-fsf-address >deleted file mode 100755 >index 6a67d8b..0000000 >--- a/xt/fix-old-fsf-address >+++ /dev/null >@@ -1,167 +0,0 @@ >-#!/usr/bin/perl >-# >-# Fix GPLv2 license blurbs that have the old FSF address at Temple Street, >-# instead of the Franklin Street one. Files to be fixed are read from >-# stdin. Typical usage would be: >-# >-# ./xt/find-license-problems . | >-# grep -vFx -f ./xt/fix-old-fsf-address.exclude | >-# ./xt/fix-old-fsf-address >-# >-# Copyright 2010 Catalyst IT Ltd >-# >-# This file is part of Koha. >-# >-# This program is free software; you can redistribute it and/or modify >-# it under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 2 of the License, or >-# (at your option) any later version. >-# >-# This program is distributed in the hope that it will be useful, >-# but WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# with this program; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >- >-use strict; >-use warnings; >- >-use File::Basename; >-use File::Copy; >-use File::Temp qw/ tempfile /; >- >- >-my $temple = << 'eof'; >-You should have received a copy of the GNU General Public License along with >-Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-Suite 330, Boston, MA 02111-1307 USA >-eof >- >-my $franklin = << 'eof'; >-You should have received a copy of the GNU General Public License along >-with Koha; if not, write to the Free Software Foundation, Inc., >-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >-eof >- >- >-my $temple2 = << 'eof'; >-You should have received a copy of the GNU General Public License along with Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >-Suite 330, Boston, MA 02111-1307 USA >-eof >- >-my $franklin2 = << 'eof'; >-You should have received a copy of the GNU General Public License along with Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, >-Fifth Floor, Boston, MA 02110-1301 USA. >-eof >- >- >-my $temple3 = << 'eof'; >-You should have received a copy of the GNU General Public License >-along with this program; if not, write to the Free Software >-Foundation, Inc., 50 Temple Place, Suite 330, Boston, MA 02111-1307 USA >-eof >- >-my $franklin3 = << 'eof'; >-You should have received a copy of the GNU General Public License >-along with this program; if not, write to the Free Software Foundation, Inc., >-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >-eof >- >- >-my $temple4 = << 'eof'; >-You should have received a copy of the GNU General Public License >-along with Zebra; see the file LICENSE.zebra. If not, write to the >-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA >-02111-1307, USA. >-eof >- >-my $franklin4 = << 'eof'; >-You should have received a copy of the GNU General Public License >-along with Zebra; see the file LICENSE.zebra. If not, write to the >-Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, >-MA 02110-1301 USA. >-eof >- >- >-my @patterns = ($temple, $temple2, $temple3, $temple4); >-my @replacements = ($franklin, $franklin2, $franklin3, $franklin4); >- >- >-sub hashcomment { >- my ($str) = @_; >- my @lines = split /\n/, $str; >- my @result; >- foreach my $line (@lines) { >- push @result, "# $line\n"; >- } >- return join "", @result >-} >- >- >-sub dashcomment { >- my ($str) = @_; >- my @lines = split /\n/, $str; >- my @result; >- foreach my $line (@lines) { >- push @result, "-- $line\n"; >- } >- return join "", @result >-} >- >- >-sub readfile { >- my ($filename) = @_; >- open(FILE, $filename) || die("Can't open $filename for reading"); >- my @lines; >- while (my $line = <FILE>) { >- push @lines, $line; >- } >- close(FILE); >- return join '', @lines; >-} >- >- >-sub try_to_fix { >- my ($data, @patterns) = @_; >- return undef; >-} >- >- >-sub overwrite { >- my ($filename, $data) = @_; >- my ($fh, $tempname) = tempfile(DIR => dirname($filename)); >- print $fh $data; >- close($fh); >- copy($tempname, $filename); >- unlink($tempname); >-} >- >- >-sub fix_temple_street { >- my ($filename) = @_; >- my $data = readfile($filename); >- my @pats = map { ($_, hashcomment($_), dashcomment($_)) } @patterns; >- my @repls = map { ($_, hashcomment($_), dashcomment($_)) } @replacements; >- while (@pats) { >- my $pat = shift @pats; >- my $repl = shift @repls; >- my $index = index($data, $pat); >- next if $index == -1; >- my $length = length($pat); >- my $before = substr($data, 0, $index); >- my $after = substr($data, $index + $length); >- overwrite($filename, "$before$repl$after"); >- return; >- } >- die("Cannot find old address in $filename"); >-} >- >- >-while (my $filename = <>) { >- chomp $filename; >- fix_temple_street($filename); >-} >diff --git a/xt/fix-old-fsf-address.exclude b/xt/fix-old-fsf-address.exclude >deleted file mode 100644 >index 6925560..0000000 >--- a/xt/fix-old-fsf-address.exclude >+++ /dev/null >@@ -1,7 +0,0 @@ >-INSTALL.fedora7 >-t/smolder_smoke_signal >-misc/cronjobs/check-url.pl >-misc/cronjobs/cloud-kw.pl >-misc/installer_devel_notes/data/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql >-misc/installer_devel_notes/data/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql >-koha-tmpl/ >-- >1.6.0.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4330
:
3367
|
3368
|
4635
|
4636
|
5028
|
6362
|
6363
|
6364
|
6365
|
8174
|
8175
|
8176
|
8177
|
9668
|
9669
|
9670
|
9671
|
9672
|
9675
|
9676
|
9789
|
9790
|
9791
|
9792
|
9793
|
9794
|
9795