# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
+# Originally copied from Debian's devscripts. A more modern version of
+# this can be found at
+# https://anonscm.debian.org/git/pkg-perl/packages/licensecheck.git/
+
=head1 NAME
licensecheck - simple license checker for source files
tr/\t\r\n/ /;
# this also removes quotes
- tr% A-Za-z.,@;0-9\(\)/-%%cd;
+ tr% A-Za-z.+,@:;0-9\(\)/-%%cd;
tr/ //s;
return $_;
$gplver = " (v$1 or later)";
} elsif ($licensetext =~ /GPL\sas\spublished\sby\sthe\sFree\sSoftware\sFoundation,\sversion\s([\d.]+)/i ) {
$gplver = " (v$1)";
+ } elsif ($licensetext =~ /SPDX-License-Identifier:\s+GPL-([1-9])\.0[^+]/i ) {
+ $gplver = " (v$1)";
+ } elsif ($licensetext =~ /SPDX-License-Identifier:\s+GPL-([1-9])\.0\+/i ) {
+ $gplver = " (v$1 or later)";
}
-
if ($licensetext =~ /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139|02111-1307)/i) {
$extrainfo = " (with incorrect FSF address)$extrainfo";
}
$license = "GPL$gplver$extrainfo $license";
}
+ if ($licensetext =~ /SPDX-License-Identifier:\s+GPL/i
+ and length $gplver) {
+ $license = "GPL$gplver$extrainfo $license";
+ }
+
if ($licensetext =~ /(?:is|may be)\s(?:(?:distributed|used).*?terms|being\s+released).*?\b(L?GPL)\b/) {
my $v = $gplver || ' (unversioned/unknown version)';
$license = "$1$v $license";