Tweak license handling to handle more common licenses or variations

of the same licenses.

ok giovanni@
This commit is contained in:
kmos 2022-10-15 00:11:56 +00:00
parent bf01257e6c
commit 45837f04bf

View File

@ -1,4 +1,4 @@
# $OpenBSD: License.pm,v 1.5 2019/05/13 00:21:29 kmos Exp $
# $OpenBSD: License.pm,v 1.6 2022/10/15 00:11:56 kmos Exp $
#
# Copyright (c) 2015 Giannis Tsaraias <tsg@openbsd.org>
#
@ -28,28 +28,38 @@ our @EXPORT_OK = qw(
# Add licenses not recognized here.
my %good_licenses = (
agpl_3 => 'AGPL 3',
apache_1_1 => 'Apache 1.1',
apache_2_0 => 'Apache 2.0',
artistic_1 => 'Artistic 1.0',
artistic_2 => 'Artistic 2.0',
bsd => 'BSD',
freebsd => 'FreeBSD',
gpl_2 => 'GPLv2',
gpl_2_0 => 'GPLv2',
gpl_3 => 'GPLv3',
gpl_3_0 => 'GPLv3',
isc => 'ISC',
lgpl => 'LGPL',
lgpl_2_1 => 'LGPL v2.1',
'lgpl_2_1+' => 'LGPL v2.1',
mit => 'MIT',
mpl_v2 => 'MPL 2.0',
new_bsd => 'BSD-3',
perl_5 => 'Perl',
ruby => 'Ruby',
qpl_1_0 => 'QPLv1',
zlib => 'zlib',
agpl_3 => 'AGPL 3',
apache_1_1 => 'Apache 1.1',
apache_2_0 => 'Apache 2.0',
artistic_1 => 'Artistic 1.0',
artistic_1_0 => 'Artistic 1.0',
artistic_2 => 'Artistic 2.0',
artistic_2_0 => 'Artistic 2.0',
bsd => 'BSD',
cc0 => 'CC0',
cc_by_nc_sa_3_0 => 'CC BY-NC-SA 3.0',
cmu => 'CMU',
freebsd => 'FreeBSD',
gpl_2 => 'GPLv2',
gpl_2_0 => 'GPLv2',
'gpl_2+' => 'GPLv2+',
gpl_3 => 'GPLv3',
gpl_3_0 => 'GPLv3',
'gpl_3+' => 'GPLv3+',
isc => 'ISC',
lgpl => 'LGPL',
lgpl_2_1 => 'LGPL v2.1',
'lgpl_2_1+' => 'LGPL v2.1+',
lgpl_3 => 'LGPL v3',
'lgpl_3+' => 'LGPL v3+',
mit => 'MIT',
mpl_v2 => 'MPL 2.0',
new_bsd => 'BSD-3',
perl_5 => 'Perl',
public_domain => 'Public Domain',
ruby => 'Ruby',
qpl_1_0 => 'QPLv1',
zlib => 'zlib',
);
sub is_good
@ -75,6 +85,8 @@ sub _munge
$license = lc $license;
$license =~ s/[,-\.\s]/_/g;
$license =~ s/the_//;
$license =~ s/gnu_public_license/gpl/;
$license =~ s/_license//;
$license =~ s/_version//;
$license =~ s/_{2,}/_/g;