]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo/Maps.pm
Intuit the correct license from the DSLIP or the META file
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo / Maps.pm
index 94d2e1603234a0c85117c0a02dfa8585f5af80c8..5ce9f7ac5e535196b925c11fe80da9cb507b1266 100644 (file)
@@ -40,6 +40,36 @@ sub name_c2g {
  return $gentooisms{$name} || $name;
 }
 
+=head2 C<license_c2g @licenses>
+
+Maps F<META.yml> C<license> tag values to the corresponding list of Gentoo licenses identifiers.
+Duplicates are stripped off.
+
+The included data was gathered from L<Module::Install> and L<Software::License>.
+
+=cut
+
+my %licenses = (
+ apache     => [ 'Apache-2.0' ],
+ artistic   => [ 'Artistic' ],
+ artistic_2 => [ 'Artistic-2' ],
+ bsd        => [ 'BSD' ],
+ gpl        => [ 'GPL-1' ],
+ gpl2       => [ 'GPL-2' ],
+ gpl3       => [ 'GPL-3' ],
+ lgpl       => [ 'LGPL-2.1' ],
+ lgpl2      => [ 'LGPL-2.1' ],
+ lgpl3      => [ 'LGPL-3' ],
+ mit        => [ 'MIT' ],
+ mozilla    => [ 'MPL-1.1' ],
+ perl       => [ 'Artistic', 'GPL-2' ],
+);
+
+sub license_c2g {
+ my %seen;
+ grep !$seen{$_}++, map @{$licenses{+lc} || []}, @_;
+}
+
 =head2 C<version_c2g $version>
 
 Converts a CPAN version to a Gentoo version.