]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo/Maps.pm
This is 0.10
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo / Maps.pm
index ef4abf715a06f5b636f353bcf074b55cf03f9946..1aa7d85458442f641dcf21d7fa48e466778a853e 100644 (file)
@@ -9,11 +9,11 @@ CPANPLUS::Dist::Gentoo::Maps - Map CPAN objects to Gentoo and vice versa.
 
 =head1 VERSION
 
-Version 0.06
+Version 0.10
 
 =cut
 
-our $VERSION = '0.06';
+our $VERSION = '0.10';
 
 =head1 DESCRPITON
 
@@ -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.
@@ -49,6 +79,8 @@ Converts a CPAN version to a Gentoo version.
 sub version_c2g {
  my ($v) = @_;
 
+ return unless defined $v;
+
  $v =~ y/-/_/;
  $v =~ y/0-9._//cd;
 
@@ -63,42 +95,29 @@ sub version_c2g {
  return $v;
 }
 
-=head2 C<version_gcmp $va, $vb>
+=head2 C<perl_version_c2g $version>
 
-Compares two Gentoo versions.
+Converts a perl version as you can find it in prerequisites to a Gentoo version number.
 
 =cut
 
-sub version_gcmp {
- my ($a, $b) = map { defined() ? $_ : 0 } @_;
-
- for ($a, $b) {
-  s/^[._]+//g;
-  s/[._]+$//g;
-  if (/^([\d.]*\d)\.*(?:_p\.*(\d[\d.]*))?\.*(?:-r(\d+))?$/) {
-   $_ = {
-    v => [ split /\.+/, $1 ],
-    p => [ split /\.+/, $2 || 0 ],
-    r => [ $3 || 0 ],
-   };
-  } else {
-   require Carp;
-   Carp::croak("Couldn't parse version string '$_'");
-  }
- }
+sub perl_version_c2g {
+ my ($v) = @_;
+
+ return unless defined $v and $v =~ /^[0-9\.]+$/;
 
- for my $k (qw/v p r/) {
-  my $xa = $a->{$k};
-  my $xb = $b->{$k};
-  while (@$xa or @$xb) {
-   my $na = shift(@$xa) || 0;
-   my $nb = shift(@$xb) || 0;
-   my $c  = $na <=> $nb;
-   return $c if $c;
+ my @parts;
+ if (my ($version, $subversion) = $v =~ /^([0-9]+)\.(0[^\.]+)$/) {
+  my $len = length $subversion;
+  if (my $pad = $len % 3) {
+   $subversion .= '0' x (3 - $pad);
   }
+  @parts = ($version, $subversion =~ /(.{1,3})/g);
+ } else {
+  @parts = split /\./, $v;
  }
 
- return 0;
+ return join '.', map int, @parts;
 }
 
 =head1 SEE ALSO
@@ -113,7 +132,8 @@ You can contact me by mail or on C<irc.perl.org> (vincent).
 
 =head1 BUGS
 
-Please report any bugs or feature requests to C<bug-cpanplus-dist-gentoo at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPANPLUS-Dist-Gentoo>.  I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
+Please report any bugs or feature requests to C<bug-cpanplus-dist-gentoo at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPANPLUS-Dist-Gentoo>.
+I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
 
 =head1 SUPPORT
 
@@ -123,7 +143,7 @@ You can find documentation for this module with the perldoc command.
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009 Vincent Pit, all rights reserved.
+Copyright 2009,2010 Vincent Pit, all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
 
@@ -133,6 +153,7 @@ This program is free software; you can redistribute it and/or modify it under th
 
 __DATA__
 ANSIColor               Term-ANSIColor
+AcePerl                 Ace
 Audio-CD                Audio-CD-disc-cover
 CGI-Simple              Cgi-Simple
 Cache-Mmap              cache-mmap
@@ -151,6 +172,7 @@ Crypt-RSA               crypt-rsa
 Crypt-Random            crypt-random
 DBIx-SearchBuilder      dbix-searchbuilder
 Data-Buffer             data-buffer
+Date-Manip              DateManip
 Digest                  digest-base
 Digest-BubbleBabble     digest-bubblebabble
 Digest-MD2              digest-md2
@@ -181,6 +203,7 @@ Locale-Maketext-Lexicon locale-maketext-lexicon
 Log-Dispatch            log-dispatch
 Math-Pari               math-pari
 Module-Info             module-info
+NTLM                    Authen-NTLM
 Net-Ping                net-ping
 Net-SFTP                net-sftp
 Net-SSH-Perl            net-ssh-perl
@@ -188,6 +211,7 @@ Net-Server              net-server
 OLE-Storage_Lite        OLE-StorageLite
 Ogg-Vorbis-Header       ogg-vorbis-header
 PathTools               File-Spec
+Perl-Tidy               perltidy
 Pod-Parser              PodParser
 Regexp-Common           regexp-common
 SDL_Perl                sdl-perl
@@ -200,6 +224,7 @@ Text-Wrapper            text-wrapper
 Tie-EncryptedHash       tie-encryptedhash
 Tk                      perl-tk
 Wx                      wxperl
+XML-Sablotron           XML-Sablot
 YAML                    yaml
 gettext                 Locale-gettext
 txt2html                TextToHTML