| 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 # | 7 # |
| 8 # This program is free software; you can redistribute it and/or modify | 8 # 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 | 9 # 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 | 10 # the Free Software Foundation; either version 2 of the License, or |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 General Public License, version 2 or later. | 118 General Public License, version 2 or later. |
| 119 | 119 |
| 120 =head1 AUTHOR | 120 =head1 AUTHOR |
| 121 | 121 |
| 122 Adam D. Barratt <adam@adam-barratt.org.uk> | 122 Adam D. Barratt <adam@adam-barratt.org.uk> |
| 123 | 123 |
| 124 =cut | 124 =cut |
| 125 | 125 |
| 126 use strict; | 126 use strict; |
| 127 use warnings; | 127 use warnings; |
| 128 use Getopt::Long; | 128 use Getopt::Long qw(:config gnu_getopt); |
| 129 use File::Basename; | 129 use File::Basename; |
| 130 | 130 |
| 131 sub fatal($); | 131 sub fatal($); |
| 132 sub parse_copyright($); | 132 sub parse_copyright($); |
| 133 sub parselicense($); | 133 sub parselicense($); |
| 134 | 134 |
| 135 my $progname = basename($0); | 135 my $progname = basename($0); |
| 136 | 136 |
| 137 # From dpkg-source | 137 # From dpkg-source |
| 138 my $default_ignore_regex = ' | 138 my $default_ignore_regex = ' |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 } | 399 } |
| 400 | 400 |
| 401 if ($licensetext =~ /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139
|02111-1307)/i) { | 401 if ($licensetext =~ /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139
|02111-1307)/i) { |
| 402 $extrainfo = " (with incorrect FSF address)$extrainfo"; | 402 $extrainfo = " (with incorrect FSF address)$extrainfo"; |
| 403 } | 403 } |
| 404 | 404 |
| 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) { | 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) { |
| 406 $extrainfo = " (with Qt exception)$extrainfo" | 406 $extrainfo = " (with Qt exception)$extrainfo" |
| 407 } | 407 } |
| 408 | 408 |
| 409 if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDI
T|delete this file)|Generated by)/i) { | 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) { |
| 410 $license = "GENERATED FILE"; | 410 $license = "GENERATED FILE"; |
| 411 } | 411 } |
| 412 | 412 |
| 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) { | 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) { |
| 414 $license = "LGPL$gplver$extrainfo $license"; | 414 $license = "LGPL$gplver$extrainfo $license"; |
| 415 } | 415 } |
| 416 | 416 |
| 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) { | 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) { |
| 418 $license = "AGPL$gplver$extrainfo $license"; | 418 $license = "AGPL$gplver$extrainfo $license"; |
| 419 } | 419 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 430 if ($licensetext =~ /is distributed.*terms.*GPL/) { | 430 if ($licensetext =~ /is distributed.*terms.*GPL/) { |
| 431 $license = "GPL (unversioned/unknown version) $license"; | 431 $license = "GPL (unversioned/unknown version) $license"; |
| 432 } | 432 } |
| 433 | 433 |
| 434 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/) { | 434 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/) { |
| 435 $license = "QPL (part of Qt) $license"; | 435 $license = "QPL (part of Qt) $license"; |
| 436 } elsif ($licensetext =~ /may be distributed under the terms of the Q Public
License as defined/) { | 436 } elsif ($licensetext =~ /may be distributed under the terms of the Q Public
License as defined/) { |
| 437 $license = "QPL $license"; | 437 $license = "QPL $license"; |
| 438 } | 438 } |
| 439 | 439 |
| 440 if ($licensetext =~ /http:\/\/opensource\.org\/licenses\/mit-license\.php/)
{ | 440 if ($licensetext =~ /opensource\.org\/licenses\/mit-license\.php/) { |
| 441 $license = "MIT/X11 (BSD like) $license"; | 441 $license = "MIT/X11 (BSD like) $license"; |
| 442 } elsif ($licensetext =~ /Permission is hereby granted, free of charge, to a
ny person obtaining a copy of this software and associated documentation files \
(the Software\), to deal in the Software/) { | 442 } elsif ($licensetext =~ /Permission is hereby granted, free of charge, to a
ny person obtaining a copy of this software and(\/or)? associated documentation
files \(the (Software|Materials)\), to deal in the (Software|Materials)/) { |
| 443 » $license = "MIT/X11 (BSD like) $license"; |
| 444 } elsif ($licensetext =~ /Permission is hereby granted, without written agre
ement and without license or royalty fees, to use, copy, modify, and distribute
this software and its documentation for any purpose/) { |
| 443 $license = "MIT/X11 (BSD like) $license"; | 445 $license = "MIT/X11 (BSD like) $license"; |
| 444 } | 446 } |
| 445 | 447 |
| 446 if ($licensetext =~ /Permission to use, copy, modify, and(\/or)? distribute
this software for any purpose with or without fee is hereby granted, provided.*
copyright notice.*permission notice.*all copies/) { | 448 if ($licensetext =~ /Permission to use, copy, modify, and(\/or)? distribute
this software for any purpose with or without fee is hereby granted, provided.*
copyright notice.*permission notice.*all copies/) { |
| 447 $license = "ISC $license"; | 449 $license = "ISC $license"; |
| 448 } | 450 } |
| 449 | 451 |
| 450 if ($licensetext =~ /THIS SOFTWARE IS PROVIDED .*AS IS AND ANY EXPRESS OR IM
PLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCH
ANTABILITY/) { | 452 if ($licensetext =~ /THIS SOFTWARE IS PROVIDED .*AS IS AND ANY EXPRESS OR IM
PLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCH
ANTABILITY/) { |
| 451 if ($licensetext =~ /All advertising materials mentioning features or us
e of this software must display the following acknowledge?ment.*This product inc
ludes software developed by/i) { | 453 if ($licensetext =~ /All advertising materials mentioning features or us
e of this software must display the following acknowledge?ment.*This product inc
ludes software developed by/i) { |
| 452 $license = "BSD (4 clause) $license"; | 454 $license = "BSD (4 clause) $license"; |
| 453 » } elsif ($licensetext =~ /(The name of .*? may not|Neither the names? of
.*? nor the names of (its|their) contributors may) be used to endorse or promot
e products derived from this software/i) { | 455 » } elsif ($licensetext =~ /(The name .*? may not|Neither the names? .*? n
or the names of (its|their) contributors may) be used to endorse or promote prod
ucts derived from this software/i) { |
| 454 $license = "BSD (3 clause) $license"; | 456 $license = "BSD (3 clause) $license"; |
| 455 } elsif ($licensetext =~ /Redistributions of source code must retain the
above copyright notice/i) { | 457 } elsif ($licensetext =~ /Redistributions of source code must retain the
above copyright notice/i) { |
| 456 $license = "BSD (2 clause) $license"; | 458 $license = "BSD (2 clause) $license"; |
| 457 } else { | 459 } else { |
| 458 $license = "BSD $license"; | 460 $license = "BSD $license"; |
| 459 } | 461 } |
| 460 } | 462 } |
| 461 | 463 |
| 462 if ($licensetext =~ /Mozilla Public License Version ([^ ]+)/) { | 464 if ($licensetext =~ /Mozilla Public License Version ([^ ]+)/) { |
| 463 $license = "MPL (v$1) $license"; | 465 $license = "MPL (v$1) $license"; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 498 } |
| 497 | 499 |
| 498 if ($licensetext =~ /is in the public domain/i) { | 500 if ($licensetext =~ /is in the public domain/i) { |
| 499 $license = "Public domain"; | 501 $license = "Public domain"; |
| 500 } | 502 } |
| 501 | 503 |
| 502 if ($licensetext =~ /terms of the Common Development and Distribution Licens
e(, Version ([^(]+))? \(the License\)/) { | 504 if ($licensetext =~ /terms of the Common Development and Distribution Licens
e(, Version ([^(]+))? \(the License\)/) { |
| 503 $license = "CDDL " . ($1 ? "(v$2) " : '') . $license; | 505 $license = "CDDL " . ($1 ? "(v$2) " : '') . $license; |
| 504 } | 506 } |
| 505 | 507 |
| 508 if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) { |
| 509 $license = "Ms-PL $license"; |
| 510 } |
| 511 |
| 506 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 | 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 |
| 507 $licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) { | 513 $licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) { |
| 508 $license = "BSL " . ($1 ? "(v$2) " : '') . $license; | 514 $license = "BSL " . ($1 ? "(v$2) " : '') . $license; |
| 509 } | 515 } |
| 510 | 516 |
| 511 if ($licensetext =~ /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i)
{ | 517 if ($licensetext =~ /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i)
{ |
| 512 $license = "PSF " . ($1 ? "(v$2) " : '') . $license; | 518 $license = "PSF " . ($1 ? "(v$2) " : '') . $license; |
| 513 } | 519 } |
| 514 | 520 |
| 515 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 | 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 |
| 516 $licensetext =~ /see copyright notice in zlib\.h/) { | 522 $licensetext =~ /see copyright notice in zlib\.h/) { |
| 517 $license = "zlib/libpng $license"; | 523 $license = "zlib/libpng $license"; |
| 524 } elsif ($licensetext =~ /This code is released under the libpng license/) { |
| 525 $license = "libpng $license"; |
| 518 } | 526 } |
| 519 | 527 |
| 520 if ($licensetext =~ /Do What The Fuck You Want To Public License, Version ([
^, ]+)/i) { | 528 if ($licensetext =~ /Do What The Fuck You Want To Public License, Version ([
^, ]+)/i) { |
| 521 $license = "WTFPL (v$1)"; | 529 $license = "WTFPL (v$1)"; |
| 522 } | 530 } |
| 523 | 531 |
| 524 if ($licensetext =~ /Do what The Fuck You Want To Public License/i) { | 532 if ($licensetext =~ /Do what The Fuck You Want To Public License/i) { |
| 525 $license = "WTFPL"; | 533 $license = "WTFPL"; |
| 526 } | 534 } |
| 527 | 535 |
| 528 if ($licensetext =~ /(License WTFPL|Under (the|a) WTFPL)/i) { | 536 if ($licensetext =~ /(License WTFPL|Under (the|a) WTFPL)/i) { |
| 529 $license = "WTFPL"; | 537 $license = "WTFPL"; |
| 530 } | 538 } |
| 531 | 539 |
| 532 $license = "UNKNOWN" if (!length($license)); | 540 $license = "UNKNOWN" if (!length($license)); |
| 533 | 541 |
| 534 return $license; | 542 return $license; |
| 535 } | 543 } |
| 536 | 544 |
| 537 sub fatal($) { | 545 sub fatal($) { |
| 538 my ($pack,$file,$line); | 546 my ($pack,$file,$line); |
| 539 ($pack,$file,$line) = caller(); | 547 ($pack,$file,$line) = caller(); |
| 540 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; | 548 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; |
| 541 $msg =~ s/\n\n$/\n/; | 549 $msg =~ s/\n\n$/\n/; |
| 542 die $msg; | 550 die $msg; |
| 543 } | 551 } |
| OLD | NEW |