annotate admin/copyright_fix.pl @ 12669:1c92b4b26ced octave-forge

releasePKG.m: exclude .hg* files of export as of bug #45669
author jpicarbajal
date Fri, 31 Jul 2015 19:49:28 +0000
parents 18cee17201df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9342
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
1 #!/usr/bin/perl
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
2 ## Copyright (C) 2011-2012 Carnë Draug <carandraug+dev@gmail.com>
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
3 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
4 ## This program is free software; you can redistribute it and/or modify
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
5 ## it under the terms of the GNU General Public License as published by
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
6 ## the Free Software Foundation; either version 3 of the License, or
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
7 ## (at your option) any later version.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
8 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
9 ## This program is distributed in the hope that it will be useful,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
12 ## GNU General Public License for more details.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
13 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
14 ## You should have received a copy of the GNU General Public License
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
15 ## along with this program; if not, see <http://www.gnu.org/licenses/>.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
16
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
17 ## add copyright notice to multiple files
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
18 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
19 ## OPTIONS
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
20 ## --author This is the name and e-mail address of the author, and the
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
21 ## year(s). Defaults to name obtained from getpwnam call (no guess
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
22 ## for e-mail address) and current year. Can be specified multiple
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
23 ## times.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
24 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
25 ## --comment Character to use as comment. Defaults to '##' and '//' for
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
26 ## Octave and C++ source. See '--files' option.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
27 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
28 ## --files Extension of files to edit. Defaults to 'm'. Can also be 'cc'
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
29 ## and 'h'. See also the '--comment' option.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
30 ##
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
31 ## --license License to use. Defaults to "GPLv3+". Valid options are "GPLv3+",
11211
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
32 ## "LGPLv3+", "AGPLv3+", "clear BSD", "FreeBSD", "simplified BSD",
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
33 ## "public domain", "X11", "Expat", "Apache2" and "ISC".
9342
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
34 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
35 ## --replace Replace existing copyright notice on the files for the new one.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
36 ## A copyright notice is identified as the first block of comments
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
37 ## as per the '--comment' option.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
38 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
39 ## --verbose Turns verbosity on.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
40 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
41 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
42 ## EXAMPLES:
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
43 ## Basic usage. Add a copyright notice to all .m files under current directory, recursively.
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
44 ## copyright_fix .
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
45 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
46 ## Same as before but with year and path specified
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
47 ## copyright_fix --author="Carnë Draug <carandraug+dev@gmail.com>=2009-2011"/home/devel/pkg/
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
48 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
49 ## Same as before but use '%%' for comment
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
50 ## copyright_fix --author="Carnë Draug <carandraug+dev@gmail.com>=2009-2011" --comment="%%" /home/devel/pkg/
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
51 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
52 ## Basic usage but for .cc files
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
53 ## copyright_fix --files="cc" .
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
54 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
55 ## Specifying mutiple authors with different years
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
56 ## copyright_fix --author="Carnë Draug <carandraug+dev@gmail.com>=2011" --author="Juan Carbajal <carbajal@ifi.uzh.ch>=2010" --comment="%%".
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
57 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
58 ## Specifying license
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
59 ## copyright_fix --license="modified BSD" .
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
60 ##
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
61
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
62 use 5.010; # Use Perl 5.10
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
63 use strict; # Enforce some good programming rules
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
64 use warnings; # Replacement for the -w flag, but lexically scoped
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
65 use Getopt::Long; # Parse program arguments
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
66 use File::Find; # Load functions to traverse a directory tree
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
67 use Tie::File;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
68 use Fcntl;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
69
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
70 my %authors;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
71 my $comment;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
72 my $files = "m";
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
73 my $license = "GPLv3+";
9342
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
74 my $replace;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
75 my $verbose;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
76
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
77 GetOptions(
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
78 'authors:s' => \%authors,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
79 'comment:s' => \$comment,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
80 'files:s' => \$files,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
81 'license:s' => \$license,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
82 'replace!' => \$replace,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
83 'verbose!' => \$verbose,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
84 ) or die "Error processing options";
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
85
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
86 if (keys %authors == 0) {
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
87 ## defaults to Full Name (index 6) of the user running this process and current year
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
88 $authors{(getpwnam (getpwuid($>)))[6]} = (localtime)[5] + 1900;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
89 }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
90 ## Order name of authors
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
91 ## after this we can use sort to get the list of authors ordered by year first
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
92 ## and alphabetic order of names second
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
93 ## each element on %authors now points to an array
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
94 foreach (keys %authors) {
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
95 my $year = delete $authors{$_};
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
96 $authors{"$year-$_"} = [$year, $_];
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
97 }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
98
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
99 if (!$comment) {
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
100 if ($files eq "cc" || $files eq "h") { $comment = "//"; }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
101 elsif ($files eq "m") { $comment = "##"; }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
102 else {die "Comment character not defined and unknown type of source";}
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
103 }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
104
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
105 ## prepare license text
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
106 my @text;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
107 my @copyR_line = map ("Copyright (C) ${$authors{$_}}[0] ${$authors{$_}}[1]", sort keys %authors);
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
108 my @author_line = map ("Author: ${$authors{$_}}[1] (${$authors{$_}}[0])", sort keys %authors);
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
109
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
110 my @BSD_header = (
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
111 @copyR_line,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
112 "All rights reserved.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
113 "",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
114 "Redistribution and use in source and binary forms, with or without",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
115 "modification, are permitted provided that the following conditions are met:",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
116 "",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
117 );
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
118 my @BSD_clauses = (
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
119 [
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
120 " 1 Redistributions of source code must retain the above copyright notice,",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
121 " this list of conditions and the following disclaimer.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
122 ],
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
123 [
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
124 " 2 Redistributions in binary form must reproduce the above copyright",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
125 " notice, this list of conditions and the following disclaimer in the",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
126 " documentation and/or other materials provided with the distribution.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
127 ],
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
128 [
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
129 " 3 Neither the name of the author nor the names of its contributors may be",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
130 " used to endorse or promote products derived from this software without",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
131 " specific prior written permission.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
132 ],
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
133 );
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
134 my @BSD_disclaimer = (
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
135 "",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
136 "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS''",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
137 "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
138 "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
139 "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
140 "ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
141 "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
142 "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
143 "CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
144 "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
145 "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
146 );
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
147
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
148 given ($license) {
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
149 when (/GPLv3+/i) {
9342
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
150 @text = (
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
151 @copyR_line,
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
152 "",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
153 "This program is free software; you can redistribute it and/or modify it under",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
154 "the terms of the GNU General Public License as published by the Free Software",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
155 "Foundation; either version 3 of the License, or (at your option) any later",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
156 "version.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
157 "",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
158 "This program is distributed in the hope that it will be useful, but WITHOUT",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
159 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
160 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
161 "details.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
162 "",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
163 "You should have received a copy of the GNU General Public License along with",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
164 "this program; if not, see <http://www.gnu.org/licenses/>.",
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
165 );
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
166 }
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
167 when (/LGPLv3+/i) {
9355
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
168 @text = (
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
169 @copyR_line,
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
170 "",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
171 "This program is free software; you can redistribute it and/or modify it under",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
172 "the terms of the GNU Lesser General Public License as published by the Free",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
173 "Software Foundation; either version 3 of the License, or (at your option) any",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
174 "later version.",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
175 "",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
176 "This program is distributed in the hope that it will be useful, but WITHOUT",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
177 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
178 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
179 "for more details.",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
180 "",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
181 "You should have received a copy of the GNU Lesser General Public License",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
182 "along with this program; if not, see <http://www.gnu.org/licenses/>.",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
183 );
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
184 }
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
185 when (/AGPLv3+/i) {
9355
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
186 @text = (
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
187 @copyR_line,
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
188 "",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
189 "This program is free software; you can redistribute it and/or modify it under",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
190 "the terms of the GNU Affero General Public License as published by the Free",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
191 "Software Foundation; either version 3 of the License, or (at your option) any",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
192 "later version.",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
193 "",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
194 "This program is distributed in the hope that it will be useful, but WITHOUT",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
195 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
196 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
197 "for more details.",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
198 "",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
199 "You should have received a copy of the GNU Affero General Public License",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
200 "along with this program; if not, see <http://www.gnu.org/licenses/>.",
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
201 );
e10fd1e037d0 copyright_fix: added AGPL and LGPL to script
carandraug
parents: 9342
diff changeset
202 }
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
203 when (/Apache2/i) {
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
204 @text = (
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
205 @copyR_line,
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
206 "You should have received a copy of the GNU Affero General Public License",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
207 "Licensed under the Apache License, Version 2.0 (the \"License\");",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
208 "you may not use this file except in compliance with the License.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
209 "You may obtain a copy of the License at",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
210 "",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
211 " http://www.apache.org/licenses/LICENSE-2.0",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
212 "",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
213 "Unless required by applicable law or agreed to in writing, software",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
214 "distributed under the License is distributed on an \"AS IS\" BASIS,",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
215 "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
216 "See the License for the specific language governing permissions and",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
217 "limitations under the License.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
218 );
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
219 }
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
220 when (/Expat/i) {
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
221 @text = (
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
222 @copyR_line,
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
223 "Permission is hereby granted, free of charge, to any person obtaining",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
224 "a copy of this software and associated documentation files (the",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
225 "\"Software\"), to deal in the Software without restriction, including",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
226 "without limitation the rights to use, copy, modify, merge, publish,",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
227 "distribute, sublicense, and/or sell copies of the Software, and to",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
228 "permit persons to whom the Software is furnished to do so, subject to",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
229 "the following conditions:",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
230 "",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
231 "The above copyright notice and this permission notice shall be included",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
232 "in all copies or substantial portions of the Software.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
233 "",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
234 "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
235 "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
236 "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
237 "IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
238 "CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
239 "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
240 "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
241 );
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
242 }
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
243 when (/ISC/i) {
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
244 @text = (
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
245 @copyR_line,
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
246 "Permission to use, copy, modify, and/or distribute this software for",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
247 "any purpose with or without fee is hereby granted, provided that the",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
248 "above copyright notice and this permission notice appear in all",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
249 "copies.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
250 "",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
251 "THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
252 "REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
253 "MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
254 "SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
255 "WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
256 "ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
257 "OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.",
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
258 );
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
259 }
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
260 when (/X11/i) {
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
261 @text = (
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
262 @copyR_line,
11291
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
263 "Permission is hereby granted, free of charge, to any person obtaining",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
264 "a copy of this software and associated documentation files (the",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
265 "\"Software\"), to deal in the Software without restriction, including",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
266 "without limitation the rights to use, copy, modify, merge, publish,",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
267 "distribute, sublicense, and/or sell copies of the Software, and to",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
268 "permit persons to whom the Software is furnished to do so, subject to",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
269 "the following conditions:",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
270 "",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
271 "The above copyright notice and this permission notice shall be",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
272 "included in all copies or substantial portions of the Software.",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
273 "",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
274 "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
275 "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
276 "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
277 "NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
278 "CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
279 "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
280 "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
281 "",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
282 "Except as contained in this notice, the name of the authors shall",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
283 "not be used in advertising or otherwise to promote the sale, use or",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
284 "other dealings in this Software without prior written authorization",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
285 "from the authors.",
11192
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
286 );
175994a0a275 copyright_fix: add X11, ISC, Expat and Apache2. Specify GPLs version on option
carandraug
parents: 10872
diff changeset
287 }
9342
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
288 when (/modified BSD/i) { @text = (@BSD_header, @{$BSD_clauses[0]}, @{$BSD_clauses[1]}, @{$BSD_clauses[2]}, @BSD_disclaimer); }
11211
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
289 when (/FreeBSD/i) { @text = (@BSD_header, @{$BSD_clauses[0]}, @{$BSD_clauses[1]}, @BSD_disclaimer); }
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
290 when (/clear BSD/i) { @text = (
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
291 @copyR_line,
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
292 "All rights reserved.",
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
293 "",
11291
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
294 "Redistribution and use in source and binary forms, with or without",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
295 "modification, are permitted (subject to the limitations in the",
18cee17201df admin: fixing missing commmas in copyright_fix
jpicarbajal
parents: 11211
diff changeset
296 "disclaimer below) provided that the following conditions are met:",
11211
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
297 "",
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
298 @{$BSD_clauses[0]},
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
299 @{$BSD_clauses[1]},
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
300 @{$BSD_clauses[2]},
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
301 "NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY",
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
302 "THIS LICENSE.",
85065c00e580 copyright_fix: remove simplified BSD (it's actually FreeBSD, the notice does not make it separate license) and added clear BSD license
carandraug
parents: 11192
diff changeset
303 @BSD_disclaimer); }
9342
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
304 when (/public domain/i) { @text = (@author_line, "This program is granted to the public domain."); }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
305 default { die "Non-valid license $license."; }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
306 }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
307
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
308 ## add comment characters to text
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
309 @text = map ("$comment $_", @text);
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
310 ## if we are not replacing a copyright notice, we need an empty line between
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
311 ## the new copyright and what follows (texinfo maybe)
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
312 push (@text, "") if !$replace;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
313
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
314 ## function that actually edits file
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
315 sub fix {
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
316 ## $_ is file path relative to pwd (always changing)
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
317 ## $path is relative to working directory where script started
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
318
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
319 my $path = $File::Find::name;
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
320 return if $_ =~ m/^\.\.?$/; # skip special "files" . and ..
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
321 return if $File::Find::dir =~ m/\.(svn|hg|git)$/; # skip svn/hg/git directories
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
322 return unless -f $_; # only files ...
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
323 return unless $_ =~ m/\.$files$/; # with right extension
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
324 tie (my @file, "Tie::File", $_) or (warn "Can't tie to '$path' : $!\n" && return);
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
325
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
326 ## remove copyright
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
327 if ($replace) {
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
328 while ($file[0] =~ m/^$comment/) { shift @file; } # remove top line as long as it looks like a comment
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
329 if ($verbose) { say "Removed old copyright notice from $_"; }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
330 }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
331
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
332 ## add copyright
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
333 unshift (@file, @text);
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
334 if ($verbose) { say "Added copyright notice to '$_'"; }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
335 }
b304d13181fc replaced ugly scripts foor edit copyright notices by pretty script with documentation
carandraug
parents:
diff changeset
336
10872
a2746f3c9f53 copyright_fix.pl: check if path was given and warn otherwise
carandraug
parents: 9355
diff changeset
337 if (@ARGV) {
a2746f3c9f53 copyright_fix.pl: check if path was given and warn otherwise
carandraug
parents: 9355
diff changeset
338 find(\&fix, @ARGV); # this call does all the recursive work
a2746f3c9f53 copyright_fix.pl: check if path was given and warn otherwise
carandraug
parents: 9355
diff changeset
339 } else {
a2746f3c9f53 copyright_fix.pl: check if path was given and warn otherwise
carandraug
parents: 9355
diff changeset
340 warn ("No path was specified, no changes were made");
a2746f3c9f53 copyright_fix.pl: check if path was given and warn otherwise
carandraug
parents: 9355
diff changeset
341 }