]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blob - lib/CPANPLUS/Dist/Gentoo/Maps.pm
Introduce C::D::G::{Atom,Version}
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo / Maps.pm
1 package CPANPLUS::Dist::Gentoo::Maps;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 CPANPLUS::Dist::Gentoo::Maps - Map CPAN objects to Gentoo and vice versa.
9
10 =head1 VERSION
11
12 Version 0.08
13
14 =cut
15
16 our $VERSION = '0.08';
17
18 =head1 DESCRPITON
19
20 This is an helper package to L<CPANPLUS::Dist::Gentoo>.
21
22 =cut
23
24 our %gentooisms;
25
26 /^\s*([\w-]+)\s+([\w-]+)\s*$/ and $gentooisms{$1} = $2 while <DATA>;
27
28 close DATA;
29
30 =head1 FUNCTIONS
31
32 =head2 C<name_c2g $name>
33
34 Maps a CPAN distribution name to its Gentoo counterpart.
35
36 =cut
37
38 sub name_c2g {
39  my ($name) = @_;
40  return $gentooisms{$name} || $name;
41 }
42
43 =head2 C<license_c2g @licenses>
44
45 Maps F<META.yml> C<license> tag values to the corresponding list of Gentoo licenses identifiers.
46 Duplicates are stripped off.
47
48 The included data was gathered from L<Module::Install> and L<Software::License>.
49
50 =cut
51
52 my %licenses = (
53  apache     => [ 'Apache-2.0' ],
54  artistic   => [ 'Artistic' ],
55  artistic_2 => [ 'Artistic-2' ],
56  bsd        => [ 'BSD' ],
57  gpl        => [ 'GPL-1' ],
58  gpl2       => [ 'GPL-2' ],
59  gpl3       => [ 'GPL-3' ],
60  lgpl       => [ 'LGPL-2.1' ],
61  lgpl2      => [ 'LGPL-2.1' ],
62  lgpl3      => [ 'LGPL-3' ],
63  mit        => [ 'MIT' ],
64  mozilla    => [ 'MPL-1.1' ],
65  perl       => [ 'Artistic', 'GPL-2' ],
66 );
67
68 sub license_c2g {
69  my %seen;
70  grep !$seen{$_}++, map @{$licenses{+lc} || []}, @_;
71 }
72
73 =head2 C<version_c2g $version>
74
75 Converts a CPAN version to a Gentoo version.
76
77 =cut
78
79 sub version_c2g {
80  my ($v) = @_;
81
82  $v =~ y/-/_/;
83  $v =~ y/0-9._//cd;
84
85  $v =~ s/^[._]*//;
86  $v =~ s/[._]*$//;
87  $v =~ s/([._])[._]*/$1/g;
88
89  ($v, my $patch, my @rest) = split /_/, $v;
90  $v .= '_p' . $patch if defined $patch;
91  $v .= join('.', '', @rest) if @rest;
92
93  return $v;
94 }
95
96 =head1 SEE ALSO
97
98 L<CPANPLUS::Dist::Gentoo>.
99
100 =head1 AUTHOR
101
102 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
103
104 You can contact me by mail or on C<irc.perl.org> (vincent).
105
106 =head1 BUGS
107
108 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.
109
110 =head1 SUPPORT
111
112 You can find documentation for this module with the perldoc command.
113
114     perldoc CPANPLUS::Dist::Gentoo
115
116 =head1 COPYRIGHT & LICENSE
117
118 Copyright 2009 Vincent Pit, all rights reserved.
119
120 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
121
122 =cut
123
124 1; # End of CPANPLUS::Dist::Gentoo::Maps
125
126 __DATA__
127 ANSIColor               Term-ANSIColor
128 AcePerl                 Ace
129 Audio-CD                Audio-CD-disc-cover
130 CGI-Simple              Cgi-Simple
131 Cache-Mmap              cache-mmap
132 Class-Loader            class-loader
133 Class-ReturnValue       class-returnvalue
134 Config-General          config-general
135 Convert-ASCII-Armour    convert-ascii-armour
136 Convert-PEM             convert-pem
137 Crypt-CBC               crypt-cbc
138 Crypt-DES_EDE3          crypt-des-ede3
139 Crypt-DH                crypt-dh
140 Crypt-DSA               crypt-dsa
141 Crypt-IDEA              crypt-idea
142 Crypt-Primes            crypt-primes
143 Crypt-RSA               crypt-rsa
144 Crypt-Random            crypt-random
145 DBIx-SearchBuilder      dbix-searchbuilder
146 Data-Buffer             data-buffer
147 Digest                  digest-base
148 Digest-BubbleBabble     digest-bubblebabble
149 Digest-MD2              digest-md2
150 ExtUtils-Depends        extutils-depends
151 ExtUtils-PkgConfig      extutils-pkgconfig
152 Frontier-RPC            frontier-rpc
153 Gimp                    gimp-perl
154 Glib                    glib-perl
155 Gnome2-Canvas           gnome2-canvas
156 Gnome2-GConf            gnome2-gconf
157 Gnome2-Print            gnome2-print
158 Gnome2-VFS              gnome2-vfs-perl
159 Gnome2-Wnck             gnome2-wnck
160 Gtk2                    gtk2-perl
161 Gtk2-Ex-FormFactory     gtk2-ex-formfactory
162 Gtk2-GladeXML           gtk2-gladexml
163 Gtk2-Spell              gtk2-spell
164 Gtk2-TrayIcon           gtk2-trayicon
165 Gtk2-TrayManager        gtk2-traymanager
166 Gtk2Fu                  gtk2-fu
167 I18N-LangTags           i18n-langtags
168 Image-Info              ImageInfo
169 Image-Size              ImageSize
170 Inline-Files            inline-files
171 Locale-Maketext         locale-maketext
172 Locale-Maketext-Fuzzy   locale-maketext-fuzzy
173 Locale-Maketext-Lexicon locale-maketext-lexicon
174 Log-Dispatch            log-dispatch
175 Math-Pari               math-pari
176 Module-Info             module-info
177 NTLM                    Authen-NTLM
178 Net-Ping                net-ping
179 Net-SFTP                net-sftp
180 Net-SSH-Perl            net-ssh-perl
181 Net-Server              net-server
182 OLE-Storage_Lite        OLE-StorageLite
183 Ogg-Vorbis-Header       ogg-vorbis-header
184 PathTools               File-Spec
185 Perl-Tidy               perltidy
186 Pod-Parser              PodParser
187 Regexp-Common           regexp-common
188 SDL_Perl                sdl-perl
189 Set-Scalar              set-scalar
190 String-CRC32            string-crc32
191 Text-Autoformat         text-autoformat
192 Text-Reform             text-reform
193 Text-Template           text-template
194 Text-Wrapper            text-wrapper
195 Tie-EncryptedHash       tie-encryptedhash
196 Tk                      perl-tk
197 Wx                      wxperl
198 YAML                    yaml
199 gettext                 Locale-gettext
200 txt2html                TextToHTML