4 # BEGIN BPS TAGGED BLOCK {{{
8 # This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
9 # <sales@bestpractical.com>
11 # (Except where explicitly superseded by other copyright notices)
16 # This work is made available to you under the terms of Version 2 of
17 # the GNU General Public License. A copy of that license should have
18 # been provided with this software, but in any event can be snarfed
21 # This work is distributed in the hope that it will be useful, but
22 # WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 # General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 # 02110-1301 or visit their web page on the internet at
30 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
33 # CONTRIBUTION SUBMISSION POLICY:
35 # (The following paragraph is not intended to limit the rights granted
36 # to you to modify and distribute this software under the terms of
37 # the GNU General Public License and is only of importance to you if
38 # you choose to contribute your changes and enhancements to the
39 # community by submitting them to Best Practical Solutions, LLC.)
41 # By intentionally submitting any modifications, corrections or
42 # derivatives to this work, or any other work intended for use with
43 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
44 # you are the copyright holder for those contributions and you grant
45 # Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
46 # royalty-free, perpetual, license to use, copy, create derivative
47 # works based on those contributions, and sublicense and distribute
48 # those contributions and any derivatives thereof.
50 # END BPS TAGGED BLOCK }}}
53 my $LICENSE = <<'EOL';
57 This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
58 <sales@bestpractical.com>
60 (Except where explicitly superseded by other copyright notices)
65 This work is made available to you under the terms of Version 2 of
66 the GNU General Public License. A copy of that license should have
67 been provided with this software, but in any event can be snarfed
70 This work is distributed in the hope that it will be useful, but
71 WITHOUT ANY WARRANTY; without even the implied warranty of
72 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
73 General Public License for more details.
75 You should have received a copy of the GNU General Public License
76 along with this program; if not, write to the Free Software
77 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
78 02110-1301 or visit their web page on the internet at
79 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
82 CONTRIBUTION SUBMISSION POLICY:
84 (The following paragraph is not intended to limit the rights granted
85 to you to modify and distribute this software under the terms of
86 the GNU General Public License and is only of importance to you if
87 you choose to contribute your changes and enhancements to the
88 community by submitting them to Best Practical Solutions, LLC.)
90 By intentionally submitting any modifications, corrections or
91 derivatives to this work, or any other work intended for use with
92 Request Tracker, to Best Practical Solutions, LLC, you confirm that
93 you are the copyright holder for those contributions and you grant
94 Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
95 royalty-free, perpetual, license to use, copy, create derivative
96 works based on those contributions, and sublicense and distribute
97 those contributions and any derivatives thereof.
103 my @MAKE = qw(Makefile);
105 File::Find::find({ no_chdir => 1, wanted => \&tag_pm}, 'lib');
106 File::Find::find({ no_chdir => 1, wanted => \&tag_mason}, 'share/html');
107 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'sbin');
108 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'bin');
109 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'etc/upgrade');
110 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'devel/tools');
111 tag_makefile ('Makefile.in');
112 tag_makefile ('README');
117 return unless (-f $pm);
118 return if $pm =~ /\.(?:png|jpe?g|gif)$/;
119 open( FILE, '<', $pm ) or die "Failed to open $pm";
120 my $file = (join "", <FILE>);
123 return if another_license($pm => $file) && print "has different license\n";
125 my $pmlic = $LICENSE;
126 $pmlic =~ s/^/%# /mg;
127 $pmlic =~ s/\s*$//mg;
128 if ($file =~ /^%# BEGIN BPS TAGGED BLOCK {{{/ms) {
129 print "has license section";
130 $file =~ s/^%# BEGIN BPS TAGGED BLOCK {{{(.*?)%# END BPS TAGGED BLOCK }}}/%# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n%# END BPS TAGGED BLOCK }}}/ms;
134 print "no license section";
135 $file ="%# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n%# END BPS TAGGED BLOCK }}}\n". $file;
137 $file =~ s/%# END BPS TAGGED BLOCK }}}(\n+)/%# END BPS TAGGED BLOCK }}}\n/mg;
143 open( FILE, '>', $pm ) or die "couldn't write new file";
152 open( FILE, '<', $pm ) or die "Failed to open $pm";
153 my $file = (join "", <FILE>);
156 return if another_license($pm => $file) && print "has different license\n";
158 my $pmlic = $LICENSE;
160 $pmlic =~ s/\s*$//mg;
161 if ($file =~ /^# BEGIN BPS TAGGED BLOCK {{{/ms) {
162 print "has license section";
163 $file =~ s/^# BEGIN BPS TAGGED BLOCK {{{(.*?)# END BPS TAGGED BLOCK }}}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}/ms;
167 print "no license section";
168 $file ="# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}\n". $file;
170 $file =~ s/# END BPS TAGGED BLOCK }}}(\n+)/# END BPS TAGGED BLOCK }}}\n/mg;
176 open( FILE, '>', $pm ) or die "couldn't write new file";
185 next unless $pm =~ /\.pm/s;
186 open( FILE, '<', $pm ) or die "Failed to open $pm";
187 my $file = (join "", <FILE>);
190 return if another_license($pm => $file) && print "has different license\n";
192 my $pmlic = $LICENSE;
194 $pmlic =~ s/\s*$//mg;
195 if ($file =~ /^# BEGIN BPS TAGGED BLOCK {{{/ms) {
196 print "has license section";
197 $file =~ s/^# BEGIN BPS TAGGED BLOCK {{{(.*?)# END BPS TAGGED BLOCK }}}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}/ms;
201 print "no license section";
202 $file ="# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}\n". $file;
204 $file =~ s/# END BPS TAGGED BLOCK }}}(\n+)/# END BPS TAGGED BLOCK }}}\n\n/mg;
210 open( FILE, '>', $pm ) or die "couldn't write new file $pm";
219 return unless (-f $pm);
220 open( FILE, '<', $pm ) or die "Failed to open $pm";
221 my $file = (join "", <FILE>);
224 return if another_license($pm => $file) && print "has different license\n";
226 my $pmlic = $LICENSE;
227 $pmlic =~ s/^/# /msg;
228 $pmlic =~ s/\s*$//mg;
229 if ($file =~ /^# BEGIN BPS TAGGED BLOCK {{{/ms) {
230 print "has license section";
231 $file =~ s/^# BEGIN BPS TAGGED BLOCK {{{(.*?)# END BPS TAGGED BLOCK }}}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}/ms;
235 print "no license section";
236 if ($file =~ /^(#!.*?)\n/) {
238 my $lic ="# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}\n";
239 $file =~ s/^(#!.*?)\n/$1\n$lic/;
243 $file =~ s/# END BPS TAGGED BLOCK }}}(\n+)/# END BPS TAGGED BLOCK }}}\n/mg;
247 open( FILE, '>', $pm ) or die "couldn't write new file";
253 sub another_license {
257 return 1 if ($name =~ /(?:ckeditor|scriptaculous|superfish|tablesorter|farbtastic)/i);
259 return 0 if $file =~ /Copyright\s+\(c\)\s+\d\d\d\d-\d\d\d\d Best Practical Solutions/i;
260 return 1 if $file =~ /\b(copyright|GPL|Public Domain)\b/i; # common
261 return 1 if $file =~ /\(c\)\s+\d\d\d\d(?:-\d\d\d\d)?/i; # prototype