On Sun, Jul 07, 2019 at 08:56:00PM -0400, Kurt Mosiejczuk wrote:
> This patch improves license handling for portgen(1).
>
> It changes munging to trim off the second part of "X or Y" licenses so
> that if the first license is acceptable, we just get a pass. Currently,
> a "MIT or BSD" license string will fail with "unknown license".
Since if the first one doesn't match, we'll tag it and include the
original line, we can see if it ends up that we need additional
handling.
> It also changes munging to abbreviate "software" to "sw" and
> "foundation" to "fdn". That is mainly to handle "Python Software
> Foundation" and "Apache Software License" without having to put a large
> separation between the string and result license in the good_licenses
> table.
>
> I did some basic testing with examples of these more complicated
> licenses along with a couple easy ones.
I didn't have any good test cases for these, but if those examples you
have are relatively common, I think this is an improvement.
With the change to s/_or_.*// with the trailing underscore as discussed,
OK afresh1@
>
> --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 8 Jul 2019 00:48:13 -0000
> @@ -28,28 +28,30 @@ 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',
> + apache_sw => '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',
> + python_sw_fdn => 'PDF',
> + ruby => 'Ruby',
> + qpl_1_0 => 'QPLv1',
> + zlib => 'zlib',
> );
>
> sub is_good
> @@ -78,6 +80,9 @@ sub _munge
> $license =~ s/_license//;
> $license =~ s/_version//;
> $license =~ s/_{2,}/_/g;
> + $license =~ s/_software/_sw/;
> + $license =~ s/_foundation/_fdn/;
> + $license =~ s/_or.*$//;
>
> return $license;
> }
>
--
andrew - http://afresh1.com
I wish life had an UNDO function.