OLD | NEW |
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 # Copyright (C) 2012 Francesco Poli |
8 # | 8 # |
9 # 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 |
10 # 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 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 sub parselicense($) { | 430 sub parselicense($) { |
431 my ($licensetext) = @_; | 431 my ($licensetext) = @_; |
432 | 432 |
433 my $gplver = ""; | 433 my $gplver = ""; |
434 my $lgplver = ""; | 434 my $lgplver = ""; |
435 my $extrainfo = ""; | 435 my $extrainfo = ""; |
436 my $license = ""; | 436 my $license = ""; |
437 | 437 |
438 if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU
(Affero )?General Public License )?(as )?published by the Free Software Foundati
on/i or | 438 if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU
(Affero )?General Public License )?(as )?published by the Free Software Foundati
on/i or |
439 $licensetext =~ /GNU (?:Affero )?General Public License (?:as )?publishe
d by the Free Software Foundation; version ([^, ]+?)[.,]? /i or | 439 $licensetext =~ /GNU (?:Affero )?General Public License (?:as )?publishe
d by the Free Software Foundation; version ([^, ]+?)[.,]? /i or |
440 » $licensetext =~ /GNU (?:Affero )?General Public License,? [Vv]ersion (\d
+(?:\.\d+)?)[ \.]/) { | 440 » $licensetext =~ /GNU (?:Affero )?General Public License,? [Vv](?:ersion
)?(\d+(?:\.\d+)?)[ \.,]/) { |
441 $gplver = " (v$1)"; | 441 $gplver = " (v$1)"; |
442 } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(a
t your option\) any later version/) { | 442 } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(a
t your option\) any later version/) { |
443 $gplver = " (v$1 or later)"; | 443 $gplver = " (v$1 or later)"; |
444 } | 444 } |
445 | 445 |
446 if ($licensetext =~ /version ([^, ]+?)[.,]? (?:or later|or any later version
) (?:of the GNU (?:Lesser |Library )General Public License )(as )?published by t
he Free Software Foundation/i or | 446 if ($licensetext =~ /version ([^, ]+?)[.,]? (?:or later|or any later version
) (?:of the GNU (?:Lesser |Library )General Public License )(as )?published by t
he Free Software Foundation/i or |
447 $licensetext =~ /(?:GNU (?:Lesser |Library )|(?:Lesser|Library) GNU )Gen
eral Public License (?:(?:as )?published by the Free Software Foundation;)?,? (?
:either )?[Vv]ersion ([^, ]+?)(?: of the license)?[.,]? (?:or later|or (?:\(at y
our option\) )?any later version)/i or | 447 $licensetext =~ /(?:GNU (?:Lesser |Library )|(?:Lesser|Library) GNU )Gen
eral Public License (?:(?:as )?published by the Free Software Foundation;)?,? (?
:either )?[Vv]ersion ([^, ]+?)(?: of the license)?[.,]? (?:or later|or (?:\(at y
our option\) )?any later version)/i or |
448 $licensetext =~ /GNU (?:Lesser |Library )General Public License(?: \(LGP
L\))?,? [Vv]ersion (\d+(?:\.\d+)?)[ \.]/) { | 448 $licensetext =~ /GNU (?:Lesser |Library )General Public License(?: \(LGP
L\))?,? [Vv]ersion (\d+(?:\.\d+)?)[ \.]/) { |
449 $lgplver = " (v$1 or later)"; | 449 $lgplver = " (v$1 or later)"; |
450 } | 450 } |
(...skipping 10 matching lines...) Expand all Loading... |
461 $licensetext =~ /(is distributed|may be used|can redistribute).*terms.*(
LGPL|(Lesser|Library) GNU General Public License)/) { | 461 $licensetext =~ /(is distributed|may be used|can redistribute).*terms.*(
LGPL|(Lesser|Library) GNU General Public License)/) { |
462 if ($lgplver) { | 462 if ($lgplver) { |
463 $license = "LGPL$lgplver$extrainfo $license"; | 463 $license = "LGPL$lgplver$extrainfo $license"; |
464 } else { | 464 } else { |
465 $license = "LGPL (unversioned/unknown version) $license"; | 465 $license = "LGPL (unversioned/unknown version) $license"; |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 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) { | 469 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) { |
470 $license = "GPL$gplver$extrainfo $license"; | 470 $license = "GPL$gplver$extrainfo $license"; |
471 } elsif ($licensetext =~ /is distributed under the terms of the GNU General
Public License,/ | 471 } elsif ($licensetext =~ /under the terms of the GNU General Public License/
i |
472 and $gplver) { | 472 and $gplver) { |
473 $license = "GPL$gplver$extrainfo $license"; | 473 $license = "GPL$gplver$extrainfo $license"; |
474 } elsif ($licensetext =~ /is distributed.*terms.*[^L]GPL/) { | 474 } elsif ($licensetext =~ /terms.*[^L]GPL/) { |
475 if ($gplver) { | 475 if ($gplver) { |
476 $license = "GPL$gplver$extrainfo $license"; | 476 $license = "GPL$gplver$extrainfo $license"; |
477 } else { | 477 } else { |
478 $license = "GPL (unversioned/unknown version) $license"; | 478 $license = "GPL (unversioned/unknown version) $license"; |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 if ($licensetext =~ /This file is part of the .*Qt GUI Toolkit. This file ma
y be distributed under the terms of the Q Public License as defined/) { | 482 if ($licensetext =~ /This file is part of the .*Qt GUI Toolkit. This file ma
y be distributed under the terms of the Q Public License as defined/) { |
483 $license = "QPL (part of Qt) $license"; | 483 $license = "QPL (part of Qt) $license"; |
484 } elsif ($licensetext =~ /may be distributed under the terms of the Q Public
License as defined/) { | 484 } elsif ($licensetext =~ /may be distributed under the terms of the Q Public
License as defined/) { |
(...skipping 20 matching lines...) Expand all Loading... |
505 $licensetext =~ /THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHA
NTABIL- ITY/) { | 505 $licensetext =~ /THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHA
NTABIL- ITY/) { |
506 if ($licensetext =~ /All advertising materials mentioning features or us
e of this software must display the following/) { | 506 if ($licensetext =~ /All advertising materials mentioning features or us
e of this software must display the following/) { |
507 $license = "BSD (4 clause) $license"; | 507 $license = "BSD (4 clause) $license"; |
508 } elsif ($licensetext =~ /be used to endorse or promote products derived
from this software/) { | 508 } elsif ($licensetext =~ /be used to endorse or promote products derived
from this software/) { |
509 $license = "BSD (3 clause) $license"; | 509 $license = "BSD (3 clause) $license"; |
510 } elsif ($licensetext =~ /Redistributions of source code must retain the
above copyright notice/) { | 510 } elsif ($licensetext =~ /Redistributions of source code must retain the
above copyright notice/) { |
511 $license = "BSD (2 clause) $license"; | 511 $license = "BSD (2 clause) $license"; |
512 } else { | 512 } else { |
513 $license = "BSD $license"; | 513 $license = "BSD $license"; |
514 } | 514 } |
515 } elsif ($licensetext =~ /Use of this source code is governed by a BSD-style
license/) { | 515 } elsif ($licensetext =~ /a BSD-style license/i) { |
516 $license = "BSD-like $license"; | 516 $license = "BSD-like $license"; |
517 } elsif ($licensetext =~ /BSD terms apply/) { | 517 } elsif ($licensetext =~ /BSD terms apply/) { |
518 $license = "BSD-like $license"; | 518 $license = "BSD-like $license"; |
519 } elsif ($licensetext =~ /subject to the BSD License/) { | 519 } elsif ($licensetext =~ /subject to the BSD License/) { |
520 # TODO(sbc): remove this case once we fix: http://crbug.com/177268 | 520 # TODO(sbc): remove this case once we fix: http://crbug.com/177268 |
521 $license = "BSD-like $license"; | 521 $license = "BSD-like $license"; |
522 } elsif ($licensetext =~ /license BSD/) { | 522 } elsif ($licensetext =~ /license BSD/) { |
523 $license = "BSD-like $license"; | 523 $license = "BSD-like $license"; |
524 } elsif ($licensetext =~ /GOVERNED BY A BSD-STYLE SOURCE LICENSE/) { | 524 } elsif ($licensetext =~ /GOVERNED BY A BSD-STYLE SOURCE LICENSE/) { |
525 $license = "BSD-like $license"; | 525 $license = "BSD-like $license"; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 return $license; | 630 return $license; |
631 } | 631 } |
632 | 632 |
633 sub fatal($) { | 633 sub fatal($) { |
634 my ($pack,$file,$line); | 634 my ($pack,$file,$line); |
635 ($pack,$file,$line) = caller(); | 635 ($pack,$file,$line) = caller(); |
636 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; | 636 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; |
637 $msg =~ s/\n\n$/\n/; | 637 $msg =~ s/\n\n$/\n/; |
638 die $msg; | 638 die $msg; |
639 } | 639 } |
OLD | NEW |