I tweaked portgen's License.pm module a bit. There were common licenses
that it would spit out as "Unknown". So I modified the munging a little
and added more entries to its list of good licenses.

Now something that states its license is "The MIT License" will no
longer stump it.

ok?

--Kurt

Index: License.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/License.pm,v
retrieving revision 1.5
diff -u -p -r1.5 License.pm
--- License.pm  13 May 2019 00:21:29 -0000      1.5
+++ License.pm  9 Oct 2022 00:07:08 -0000
@@ -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;

Reply via email to