4 # BEGIN BPS TAGGED BLOCK {{{
8 # This software is Copyright (c) 1996-2016 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-2016 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 for my $masondir (qw( html share/html )) {
107 next unless -d $masondir;
108 File::Find::find({ no_chdir => 1, wanted => \&tag_mason}, $masondir);
110 for my $bindir (qw( sbin bin etc/upgrade devel/tools )) {
111 next unless -d $bindir;
112 File::Find::find({ no_chdir => 1, wanted => \&tag_script}, $bindir);
114 tag_makefile ('Makefile.in') if -f 'Makefile.in';
115 tag_makefile ('README');
120 return unless (-f $pm);
121 return if $pm =~ /\.(?:png|jpe?g|gif)$/;
122 open( FILE, '<', $pm ) or die "Failed to open $pm";
123 my $file = (join "", <FILE>);
126 return if another_license($pm => $file) && print "has different license\n";
128 my $pmlic = $LICENSE;
129 $pmlic =~ s/^/%# /mg;
130 $pmlic =~ s/\s*$//mg;
131 if ($file =~ /^%# BEGIN BPS TAGGED BLOCK \{\{\{/ms) {
132 print "has license section";
133 $file =~ s/^%# BEGIN BPS TAGGED BLOCK \{\{\{(.*?)%# END BPS TAGGED BLOCK \}\}\}/%# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n%# END BPS TAGGED BLOCK }}}/ms;
137 print "no license section";
138 $file ="%# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n%# END BPS TAGGED BLOCK }}}\n". $file;
140 $file =~ s/%# END BPS TAGGED BLOCK \}\}\}(\n+)/%# END BPS TAGGED BLOCK }}}\n/mg;
146 open( FILE, '>', $pm ) or die "couldn't write new file";
155 open( FILE, '<', $pm ) or die "Failed to open $pm";
156 my $file = (join "", <FILE>);
159 return if another_license($pm => $file) && print "has different license\n";
161 my $pmlic = $LICENSE;
163 $pmlic =~ s/\s*$//mg;
164 if ($file =~ /^# BEGIN BPS TAGGED BLOCK \{\{\{/ms) {
165 print "has license section";
166 $file =~ s/^# BEGIN BPS TAGGED BLOCK \{\{\{(.*?)# END BPS TAGGED BLOCK \}\}\}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}/ms;
170 print "no license section";
171 $file ="# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}\n". $file;
173 $file =~ s/# END BPS TAGGED BLOCK \}\}\}(\n+)/# END BPS TAGGED BLOCK }}}\n/mg;
179 open( FILE, '>', $pm ) or die "couldn't write new file";
188 return unless $pm =~ /\.pm/s;
189 open( FILE, '<', $pm ) or die "Failed to open $pm";
190 my $file = (join "", <FILE>);
193 return if another_license($pm => $file) && print "has different license\n";
195 my $pmlic = $LICENSE;
197 $pmlic =~ s/\s*$//mg;
198 if ($file =~ /^# BEGIN BPS TAGGED BLOCK \{\{\{/ms) {
199 print "has license section";
200 $file =~ s/^# BEGIN BPS TAGGED BLOCK \{\{\{(.*?)# END BPS TAGGED BLOCK \}\}\}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}/ms;
204 print "no license section";
205 $file ="# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}\n". $file;
207 $file =~ s/# END BPS TAGGED BLOCK \}\}\}(\n+)/# END BPS TAGGED BLOCK }}}\n\n/mg;
213 open( FILE, '>', $pm ) or die "couldn't write new file $pm";
222 return unless (-f $pm);
223 open( FILE, '<', $pm ) or die "Failed to open $pm";
224 my $file = (join "", <FILE>);
227 return if another_license($pm => $file) && print "has different license\n";
229 my $pmlic = $LICENSE;
230 $pmlic =~ s/^/# /msg;
231 $pmlic =~ s/\s*$//mg;
232 if ($file =~ /^# BEGIN BPS TAGGED BLOCK \{\{\{/ms) {
233 print "has license section";
234 $file =~ s/^# BEGIN BPS TAGGED BLOCK \{\{\{(.*?)# END BPS TAGGED BLOCK \}\}\}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}/ms;
238 print "no license section";
239 if ($file =~ /^(#!.*?)\n/) {
241 my $lic ="# BEGIN BPS TAGGED BLOCK {{{\n$pmlic\n# END BPS TAGGED BLOCK }}}\n";
242 $file =~ s/^(#!.*?)\n/$1\n$lic/;
246 $file =~ s/# END BPS TAGGED BLOCK \}\}\}(\n+)/# END BPS TAGGED BLOCK }}}\n/mg;
250 open( FILE, '>', $pm ) or die "couldn't write new file";
256 sub another_license {
260 return 1 if ($name =~ /(?:ckeditor|scriptaculous|superfish|tablesorter|farbtastic)/i);
262 return 0 if $file =~ /Copyright\s+\(c\)\s+\d\d\d\d-\d\d\d\d Best Practical Solutions/i;
263 return 1 if $file =~ /\b(copyright|GPL|Public Domain)\b/i; # common
264 return 1 if $file =~ /\(c\)\s+\d\d\d\d(?:-\d\d\d\d)?/i; # prototype