Open haarg opened 9 years ago
Agreed, it should use CPAN::Meta to parse the meta file properly and extract the data using the API, rather than using a regex on the file.
Incoming #hacktober #cpan-prc PR.
CPAN::Meta
does a lossy conversion when importing meta v1 licenses, specifically it
punts on gpl
, lgpl
, and mozilla
, since it isn't clear which exact version was specified in older Module::Build.
From CPAN::Meta::Converter
:
# The "old" values were defined by Module::Build, and were often vague. I have
# made the decisions below based on reading Module::Build::API and how clearly
# it specifies the version of the license.
my %license_map_2 = (
(map { $_ => $_ } @valid_licenses_2),
apache => 'apache_2_0', # clearly stated as 2.0
artistic => 'artistic_1', # clearly stated as 1
artistic2 => 'artistic_2', # clearly stated as 2
gpl => 'open_source', # we don't know which GPL; punt
lgpl => 'open_source', # we don't know which LGPL; punt
mozilla => 'open_source', # we don't know which MPL; punt
perl => 'perl_5', # clearly Perl 5
restrictive => 'restricted',
);
In Software::License
'open_source'
is mapped in Software::License to Software::License::Mozilla_2_0
and Software::License::PostgreSQL
.
A naive conversion of guess_license_from_meta to use CPAN::Meta for parsing will thus convert a 1.x META file containing license: gpl
to [ 'Software::License::Mozilla_2_0", "Software::License::PostgreSQL"]
rather than the current value of ['Software::License::GPL_1', Software::License::GPL_2', 'Software::License::GPL_3']
.
Would we be sad to change to this result?
I can keep the current behavior while using the CPAN::Meta toolbox, but it'll require more juggling. E.g. using Parse::CPAN::Meta
and CPAN::Meta::Convert
manually to get the original license and meta version before upgrading.
Software::LicenseUtils->guess_license_from_meta is documented as working on META.json, it uses a regex to find the license which only accounts for a single string value. license in meta v2 is an array, so it is unable to match properly.