Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/devscripts/licensecheck.pl.vanilla

Issue 11029052: Update licensecheck to version 2.12.4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fixes Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/devscripts/licensecheck.pl ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 # This script was originally based on the script of the same name from 2 # This script was originally based on the script of the same name from
3 # the KDE SDK (by dfaure@kde.org) 3 # the KDE SDK (by dfaure@kde.org)
4 # 4 #
5 # This version is 5 # This version is
6 # Copyright (C) 2007, 2008 Adam D. Barratt 6 # Copyright (C) 2007, 2008 Adam D. Barratt
7 # Copyright (C) 2012 Francesco Poli
7 # 8 #
8 # This program is free software; you can redistribute it and/or modify 9 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by 10 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or 11 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version. 12 # (at your option) any later version.
12 # 13 #
13 # This program is distributed in the hope that it will be useful, 14 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details. 17 # GNU General Public License for more details.
17 # 18 #
18 # You should have received a copy of the GNU General Public License along 19 # You should have received a copy of the GNU General Public License along
19 # with this program. If not, see <http://www.gnu.org/licenses/>. 20 # with this program. If not, see <http://www.gnu.org/licenses/>.
20 21
21 =head1 NAME 22 =head1 NAME
22 23
23 licensecheck - simple license checker for source files 24 licensecheck - simple license checker for source files
24 25
25 =head1 SYNOPSIS 26 =head1 SYNOPSIS
26 27
27 B<licensecheck> B<--help>|B<--version> 28 B<licensecheck> B<--help>|B<--version>
28 29
29 B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>] 30 B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>]
30 [B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>] 31 [B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>]
31 [B<-r>|B<--recursive>] I<list of files and directories to check> 32 [B<-m>|B<--machine>] [B<-r>|B<--recursive>]
33 I<list of files and directories to check>
32 34
33 =head1 DESCRIPTION 35 =head1 DESCRIPTION
34 36
35 B<licensecheck> attempts to determine the license that applies to each file 37 B<licensecheck> attempts to determine the license that applies to each file
36 passed to it, by searching the start of the file for text belonging to 38 passed to it, by searching the start of the file for text belonging to
37 various licenses. 39 various licenses.
38 40
39 If any of the arguments passed are directories, B<licensecheck> will add 41 If any of the arguments passed are directories, B<licensecheck> will add
40 the files contained within to the list of files to process. 42 the files contained within to the list of files to process.
41 43
(...skipping 28 matching lines...) Expand all
70 72
71 Specify a pattern against which filenames will be matched in order to 73 Specify a pattern against which filenames will be matched in order to
72 decide which files to check the license of. 74 decide which files to check the license of.
73 75
74 The default includes common source files. 76 The default includes common source files.
75 77
76 =item B<--copyright> 78 =item B<--copyright>
77 79
78 Also display copyright text found within the file 80 Also display copyright text found within the file
79 81
82 =item B<-m>, B<--machine>
83
84 Display the information in a machine readable way, i.e. in the form
85 <file><tab><license>[<tab><copyright>] so that it can be easily sorted
86 and/or filtered, e.g. with the B<awk> and B<sort> commands.
87 Note that using the B<--verbose> option will kill the readability.
88
80 =item B<--no-conf>, B<--noconf> 89 =item B<--no-conf>, B<--noconf>
81 90
82 Do not read any configuration files. This can only be used as the first 91 Do not read any configuration files. This can only be used as the first
83 option given on the command-line. 92 option given on the command-line.
84 93
85 =back 94 =back
86 95
87 =head1 CONFIGURATION VARIABLES 96 =head1 CONFIGURATION VARIABLES
88 97
89 The two configuration files F</etc/devscripts.conf> and 98 The two configuration files F</etc/devscripts.conf> and
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 (?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$| 157 (?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$|
149 # File or directory names that should be ignored 158 # File or directory names that should be ignored
150 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git| 159 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|
151 \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$) 160 \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
152 '; 161 ';
153 162
154 # Take out comments and newlines 163 # Take out comments and newlines
155 $default_ignore_regex =~ s/^#.*$//mg; 164 $default_ignore_regex =~ s/^#.*$//mg;
156 $default_ignore_regex =~ s/\n//sg; 165 $default_ignore_regex =~ s/\n//sg;
157 166
158 my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php |py|rb|java|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod)$'; 167 my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php |py(|x)|rb|java|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod|m|tex|mli?)$';
159 168
160 my $modified_conf_msg; 169 my $modified_conf_msg;
161 170
162 my ($opt_verbose, $opt_lines, $opt_noconf, $opt_ignore_regex, $opt_check_regex) 171 my ($opt_verbose, $opt_lines, $opt_noconf, $opt_ignore_regex, $opt_check_regex)
163 = ('', '', '', '', ''); 172 = ('', '', '', '', '');
164 my $opt_recursive = 0; 173 my $opt_recursive = 0;
165 my $opt_copyright = 0; 174 my $opt_copyright = 0;
175 my $opt_machine = 0;
166 my ($opt_help, $opt_version); 176 my ($opt_help, $opt_version);
167 my $def_lines = 60; 177 my $def_lines = 60;
168 178
169 # Read configuration files and then command line 179 # Read configuration files and then command line
170 # This is boilerplate 180 # This is boilerplate
171 181
172 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) { 182 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
173 $modified_conf_msg = " (no configuration files read)"; 183 $modified_conf_msg = " (no configuration files read)";
174 shift; 184 shift;
175 } else { 185 } else {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 221 }
212 222
213 GetOptions("help|h" => \$opt_help, 223 GetOptions("help|h" => \$opt_help,
214 "version|v" => \$opt_version, 224 "version|v" => \$opt_version,
215 "verbose!" => \$opt_verbose, 225 "verbose!" => \$opt_verbose,
216 "lines|l=i" => \$opt_lines, 226 "lines|l=i" => \$opt_lines,
217 "ignore|i=s" => \$opt_ignore_regex, 227 "ignore|i=s" => \$opt_ignore_regex,
218 "recursive|r" => \$opt_recursive, 228 "recursive|r" => \$opt_recursive,
219 "check|c=s" => \$opt_check_regex, 229 "check|c=s" => \$opt_check_regex,
220 "copyright" => \$opt_copyright, 230 "copyright" => \$opt_copyright,
231 "machine|m" => \$opt_machine,
221 "noconf" => \$opt_noconf, 232 "noconf" => \$opt_noconf,
222 "no-conf" => \$opt_noconf, 233 "no-conf" => \$opt_noconf,
223 ) 234 )
224 or die "Usage: $progname [options] filelist\nRun $progname --help for more d etails\n"; 235 or die "Usage: $progname [options] filelist\nRun $progname --help for more d etails\n";
225 236
226 $opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/; 237 $opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/;
227 $opt_ignore_regex = $default_ignore_regex if ! length $opt_ignore_regex; 238 $opt_ignore_regex = $default_ignore_regex if ! length $opt_ignore_regex;
228 $opt_check_regex = $default_check_regex if ! length $opt_check_regex; 239 $opt_check_regex = $default_check_regex if ! length $opt_check_regex;
229 240
230 if ($opt_noconf) { 241 if ($opt_noconf) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 $copyrights{lc("$copyright_match")} = "$copyright_match"; 293 $copyrights{lc("$copyright_match")} = "$copyright_match";
283 } 294 }
284 } 295 }
285 close(F); 296 close(F);
286 297
287 $copyright = join(" / ", values %copyrights); 298 $copyright = join(" / ", values %copyrights);
288 299
289 print qq(----- $file header -----\n$content----- end header -----\n\n) 300 print qq(----- $file header -----\n$content----- end header -----\n\n)
290 if $opt_verbose; 301 if $opt_verbose;
291 302
303 # Remove Fortran comments
304 $content =~ s/^[cC] //gm;
292 $content =~ tr/\t\r\n/ /; 305 $content =~ tr/\t\r\n/ /;
293 # Remove C / C++ comments 306 # Remove C / C++ comments
294 $content =~ s#(\*/|/[/*])##g; 307 $content =~ s#(\*/|/[/*])##g;
295 $content =~ tr% A-Za-z.,@;0-9\(\)/-%%cd; 308 $content =~ tr% A-Za-z.,@;0-9\(\)/-%%cd;
296 $content =~ s/ c //g; # Remove fortran comments
297 $content =~ tr/ //s; 309 $content =~ tr/ //s;
298 310
299 $license = parselicense($content); 311 $license = parselicense($content);
300 print "$file: "; 312 if ($opt_machine) {
301 print "*No copyright* " unless $copyright; 313 » print "$file\t$license";
302 print $license . "\n"; 314 » print "\t" . ($copyright or "*No copyright*") if $opt_copyright;
303 print " [Copyright: " . $copyright . "]\n" 315 » print "\n";
304 if $copyright and $opt_copyright; 316 } else {
305 print "\n" if $opt_copyright; 317 » print "$file: ";
318 » print "*No copyright* " unless $copyright;
319 » print $license . "\n";
320 » print " [Copyright: " . $copyright . "]\n"
321 » if $copyright and $opt_copyright;
322 » print "\n" if $opt_copyright;
323 }
306 } 324 }
307 325
308 sub parse_copyright($) { 326 sub parse_copyright($) {
309 my $copyright = ''; 327 my $copyright = '';
310 my $match; 328 my $match;
311 329
312 my $copyright_indicator_regex = ' 330 my $copyright_indicator_regex = '
313 (?:copyright # The full word 331 (?:copyright # The full word
314 |copr\. # Legally-valid abbreviation 332 |copr\. # Legally-valid abbreviation
315 |\x{00a9} # Unicode character COPYRIGHT SIGN 333 |\x{00a9} # Unicode character COPYRIGHT SIGN
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 --no-conf, --noconf Don't read devscripts config files; must be 367 --no-conf, --noconf Don't read devscripts config files; must be
350 the first option given 368 the first option given
351 --verbose Display the header of each file before its 369 --verbose Display the header of each file before its
352 license information 370 license information
353 --lines, -l Specify how many lines of the file header 371 --lines, -l Specify how many lines of the file header
354 should be parsed for license information 372 should be parsed for license information
355 (Default: $def_lines) 373 (Default: $def_lines)
356 --check, -c Specify a pattern indicating which files should 374 --check, -c Specify a pattern indicating which files should
357 be checked 375 be checked
358 (Default: '$default_check_regex') 376 (Default: '$default_check_regex')
377 --machine, -m Display in a machine readable way (good for awk)
359 --recursive, -r Add the contents of directories recursively 378 --recursive, -r Add the contents of directories recursively
360 --copyright Also display the file's copyright 379 --copyright Also display the file's copyright
361 --ignore, -i»» Specify that files / directories matching the 380 --ignore, -i Specify that files / directories matching the
362 regular expression should be ignored when 381 regular expression should be ignored when
363 checking files 382 checking files
364 (Default: '$default_ignore_regex') 383 (Default: '$default_ignore_regex')
365 384
366 Default settings modified by devscripts configuration files: 385 Default settings modified by devscripts configuration files:
367 $modified_conf_msg 386 $modified_conf_msg
368 EOF 387 EOF
369 } 388 }
370 389
371 sub version { 390 sub version {
372 print <<"EOF"; 391 print <<"EOF";
373 This is $progname, from the Debian devscripts package, version ###VERSION### 392 This is $progname, from the Debian devscripts package, version ###VERSION###
374 Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based 393 Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based
375 on a script of the same name from the KDE SDK by <dfaure\@kde.org>. 394 on a script of the same name from the KDE SDK by <dfaure\@kde.org>.
376 395
377 This program comes with ABSOLUTELY NO WARRANTY. 396 This program comes with ABSOLUTELY NO WARRANTY.
378 You are free to redistribute this code under the terms of the 397 You are free to redistribute this code under the terms of the
379 GNU General Public License, version 2, or (at your option) any 398 GNU General Public License, version 2, or (at your option) any
380 later version. 399 later version.
381 EOF 400 EOF
382 } 401 }
383 402
384 sub parselicense($) { 403 sub parselicense($) {
385 my ($licensetext) = @_; 404 my ($licensetext) = @_;
386 405
387 my $gplver = ""; 406 my $gplver = "";
388 my $extrainfo = ""; 407 my $extrainfo = "";
389 my $license = ""; 408 my $license = "";
390 409
391 if ($licensetext =~ /version ([^ ]+) (?:\(?only\)?.? )?(?:of the GNU (Affero )?General Public License )?as published by the Free Software Foundation/i or 410 if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?(Lesser |Library )?General Public License )?(as )?published by the Fre e Software Foundation/i or
392 » $licensetext =~ /GNU (?:Affero )?General Public License as published by the Free Software Foundation; version ([^ ]+) /i) { 411 » $licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public Lic ense (?:as )?published by the Free Software Foundation; version ([^, ]+?)[.,]? / i) {
393 412
394 $gplver = " (v$1)"; 413 $gplver = " (v$1)";
395 } elsif ($licensetext =~ /GNU (?:Affero ?)General Public License, version ([ ^ ]+?)[ .]/) { 414 } elsif ($licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Publi c License, version (\d+(?:\.\d+)?)[ \.]/) {
396 $gplver = " (v$1)"; 415 $gplver = " (v$1)";
397 } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(a t your option\) any later version/) { 416 } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(a t your option\) any later version/) {
398 $gplver = " (v$1 or later)"; 417 $gplver = " (v$1 or later)";
399 } 418 }
400 419
401 if ($licensetext =~ /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139 |02111-1307)/i) { 420 if ($licensetext =~ /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139 |02111-1307)/i) {
402 $extrainfo = " (with incorrect FSF address)$extrainfo"; 421 $extrainfo = " (with incorrect FSF address)$extrainfo";
403 } 422 }
404 423
405 if ($licensetext =~ /permission (?:is (also granted|given))? to link (the co de of )?this program with (any edition of )?(Qt|the Qt library)/i) { 424 if ($licensetext =~ /permission (?:is (also granted|given))? to link (the co de of )?this program with (any edition of )?(Qt|the Qt library)/i) {
406 $extrainfo = " (with Qt exception)$extrainfo" 425 $extrainfo = " (with Qt exception)$extrainfo"
407 } 426 }
408 427
409 if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDI T|delete this file)|Generated (automatically|by|from)|generated.*file)/i) { 428 if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDI T|delete this file)|Generated (automatically|by|from)|generated.*file)/i) {
410 $license = "GENERATED FILE"; 429 $license = "GENERATED FILE";
411 } 430 }
412 431
413 if ($licensetext =~ /is free software.? you can redistribute it and\/or modi fy it under the terms of the (GNU (Library|Lesser) General Public License|LGPL)/ i) { 432 if ($licensetext =~ /is (free software.? you can redistribute it and\/or mod ify it|licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesse r )General Public License|LGPL)/i) {
414 $license = "LGPL$gplver$extrainfo $license"; 433 $license = "LGPL$gplver$extrainfo $license";
415 } 434 }
416 435
417 if ($licensetext =~ /is free software.? you can redistribute it and\/or modi fy it under the terms of the (GNU Affero General Public License|AGPL)/i) { 436 if ($licensetext =~ /is free software.? you can redistribute it and\/or modi fy it under the terms of the (GNU Affero General Public License|AGPL)/i) {
418 $license = "AGPL$gplver$extrainfo $license"; 437 $license = "AGPL$gplver$extrainfo $license";
419 } 438 }
420 439
421 if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/o r modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU Gen eral Public License/i) { 440 if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/o r modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU Gen eral Public License/i) {
422 $license = "GPL$gplver$extrainfo $license"; 441 $license = "GPL$gplver$extrainfo $license";
423 } 442 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 493 }
475 494
476 if ($licensetext =~ /This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself/) { 495 if ($licensetext =~ /This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself/) {
477 $license = "Perl $license"; 496 $license = "Perl $license";
478 } 497 }
479 498
480 if ($licensetext =~ /under the Apache License, Version ([^ ]+)/) { 499 if ($licensetext =~ /under the Apache License, Version ([^ ]+)/) {
481 $license = "Apache (v$1) $license"; 500 $license = "Apache (v$1) $license";
482 } 501 }
483 502
503 if ($licensetext =~ /(THE BEER-WARE LICENSE)/i) {
504 $license = "Beerware $license";
505 }
506
484 if ($licensetext =~ /This source file is subject to version ([^ ]+) of the P HP license/) { 507 if ($licensetext =~ /This source file is subject to version ([^ ]+) of the P HP license/) {
485 $license = "PHP (v$1) $license"; 508 $license = "PHP (v$1) $license";
486 } 509 }
487 510
488 if ($licensetext =~ /under the terms of the CeCILL /) { 511 if ($licensetext =~ /under the terms of the CeCILL /) {
489 $license = "CeCILL $license"; 512 $license = "CeCILL $license";
490 } 513 }
491 514
492 if ($licensetext =~ /under the terms of the CeCILL-([^ ]+) /) { 515 if ($licensetext =~ /under the terms of the CeCILL-([^ ]+) /) {
493 $license = "CeCILL-$1 $license"; 516 $license = "CeCILL-$1 $license";
494 } 517 }
495 518
496 if ($licensetext =~ /under the SGI Free Software License B/) { 519 if ($licensetext =~ /under the SGI Free Software License B/) {
497 $license = "SGI Free Software License B $license"; 520 $license = "SGI Free Software License B $license";
498 } 521 }
499 522
500 if ($licensetext =~ /is in the public domain/i) { 523 if ($licensetext =~ /is in the public domain/i) {
501 » $license = "Public domain"; 524 » $license = "Public domain $license";
502 } 525 }
503 526
504 if ($licensetext =~ /terms of the Common Development and Distribution Licens e(, Version ([^(]+))? \(the License\)/) { 527 if ($licensetext =~ /terms of the Common Development and Distribution Licens e(, Version ([^(]+))? \(the License\)/) {
505 $license = "CDDL " . ($1 ? "(v$2) " : '') . $license; 528 $license = "CDDL " . ($1 ? "(v$2) " : '') . $license;
506 } 529 }
507 530
508 if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) { 531 if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) {
509 $license = "Ms-PL $license"; 532 $license = "Ms-PL $license";
510 } 533 }
511 534
512 if ($licensetext =~ /Permission is hereby granted, free of charge, to any pe rson or organization obtaining a copy of the software and accompanying documenta tion covered by this license \(the \"Software\"\)/ or 535 if ($licensetext =~ /Permission is hereby granted, free of charge, to any pe rson or organization obtaining a copy of the software and accompanying documenta tion covered by this license \(the \"Software\"\)/ or
513 $licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) { 536 $licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) {
514 $license = "BSL " . ($1 ? "(v$2) " : '') . $license; 537 $license = "BSL " . ($1 ? "(v$2) " : '') . $license;
515 } 538 }
516 539
517 if ($licensetext =~ /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i) { 540 if ($licensetext =~ /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i) {
518 $license = "PSF " . ($1 ? "(v$2) " : '') . $license; 541 $license = "PSF " . ($1 ? "(v$2) " : '') . $license;
519 } 542 }
520 543
521 if ($licensetext =~ /The origin of this software must not be misrepresented. *Altered source versions must be plainly marked as such.*This notice may not be removed or altered from any source distribution/ or 544 if ($licensetext =~ /The origin of this software must not be misrepresented. *Altered source versions must be plainly marked as such.*This notice may not be removed or altered from any source distribution/ or
522 $licensetext =~ /see copyright notice in zlib\.h/) { 545 $licensetext =~ /see copyright notice in zlib\.h/) {
523 $license = "zlib/libpng $license"; 546 $license = "zlib/libpng $license";
524 } elsif ($licensetext =~ /This code is released under the libpng license/) { 547 } elsif ($licensetext =~ /This code is released under the libpng license/) {
525 $license = "libpng $license"; 548 $license = "libpng $license";
526 } 549 }
527 550
528 if ($licensetext =~ /Do What The Fuck You Want To Public License, Version ([ ^, ]+)/i) { 551 if ($licensetext =~ /Do What The Fuck You Want To Public License, Version ([ ^, ]+)/i) {
529 $license = "WTFPL (v$1)"; 552 $license = "WTFPL (v$1) $license";
530 } 553 }
531 554
532 if ($licensetext =~ /Do what The Fuck You Want To Public License/i) { 555 if ($licensetext =~ /Do what The Fuck You Want To Public License/i) {
533 $license = "WTFPL"; 556 $license = "WTFPL $license";
534 } 557 }
535 558
536 if ($licensetext =~ /(License WTFPL|Under (the|a) WTFPL)/i) { 559 if ($licensetext =~ /(License WTFPL|Under (the|a) WTFPL)/i) {
537 $license = "WTFPL"; 560 $license = "WTFPL $license";
538 } 561 }
539 562
540 $license = "UNKNOWN" if (!length($license)); 563 $license = "UNKNOWN" if (!length($license));
541 564
565 # Remove trailing spaces.
566 $license =~ s/\s+$//;
567
542 return $license; 568 return $license;
543 } 569 }
544 570
545 sub fatal($) { 571 sub fatal($) {
546 my ($pack,$file,$line); 572 my ($pack,$file,$line);
547 ($pack,$file,$line) = caller(); 573 ($pack,$file,$line) = caller();
548 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; 574 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d;
549 $msg =~ s/\n\n$/\n/; 575 $msg =~ s/\n\n$/\n/;
550 die $msg; 576 die $msg;
551 } 577 }
OLDNEW
« no previous file with comments | « third_party/devscripts/licensecheck.pl ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698