Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software::LicenseUtils->guess_license_from_meta doesn't work on META.json #39

Open
haarg opened this issue Jul 22, 2015 · 3 comments
Open

Comments

@haarg
Copy link
Member

haarg commented Jul 22, 2015

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.

@karenetheridge
Copy link
Member

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.

@spazm
Copy link
Contributor

spazm commented Oct 13, 2017

Incoming #hacktober #cpan-prc PR.

@spazm
Copy link
Contributor

spazm commented Oct 14, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants