X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo%2FMaps.pm;h=84ede042cb457ff12c42ed3572e594c42020b7d8;hb=75ae75015ae70863bbce2eaef6c796ea0e1786d3;hp=fb2cbd699137a7feab6c01f9f37d10855223d7bc;hpb=5b30d3775087ec80c860185b6fe18998629beacf;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo/Maps.pm b/lib/CPANPLUS/Dist/Gentoo/Maps.pm index fb2cbd6..84ede04 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Maps.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Maps.pm @@ -3,17 +3,20 @@ package CPANPLUS::Dist::Gentoo::Maps; use strict; use warnings; +use File::Spec; +use POSIX (); + =head1 NAME CPANPLUS::Dist::Gentoo::Maps - Map CPAN distribution names, version numbers and license identifiers to their Gentoo counterparts. =head1 VERSION -Version 0.11 +Version 0.12 =cut -our $VERSION = '0.11'; +our $VERSION = '0.12'; =head1 DESCRIPTION @@ -139,7 +142,7 @@ my $default_but_no_strip_2 = sub { }; my $insert_dot_every = sub { - my ($version, $step) = @_; + my ($version, $step, $strip) = @_; my $is_dev = $version =~ /_/; @@ -157,7 +160,9 @@ my $insert_dot_every = sub { my $pat = sprintf '.{1,%d}', $step || 1; push @parts, $subversion =~ /($pat)/g; - s/^0+([^0]|0\z)/$1/ for @parts; + if ($strip) { + s/^0+([^0]|0\z)/$1/ for @parts; + } $version = join '.', @parts; $version .= '_rc' if $is_dev; @@ -218,13 +223,12 @@ $version_mismatch{$_} = $default_but_ignore_v for qw< $version_mismatch{$_} = $default_but_no_strip_1 for qw< Crypt-RC4 + FLV-AudioExtractor File-Grep MogileFS-Client-Async MogileFS-Network ->; - -$version_mismatch{$_} = $default_but_no_strip_2 for qw< - Net-IMAP-Simple + Test-Command-Simple + Unix-Getrusage >; $version_mismatch{$_} = sub { $insert_dot_every->($_[0], 1) } for qw< @@ -233,29 +237,25 @@ $version_mismatch{$_} = sub { $insert_dot_every->($_[0], 1) } for qw< >; $version_mismatch{$_} = sub { $insert_dot_every->($_[0], 3) } for qw< - POE-Component-IKC + Data-Diver >; $version_mismatch{$_} = $simple_cleanup for qw< - Alien-SDL CGI-SpeedyCGI Class-ISA - Data-Uniqid - ExtUtils-Install - File-Path - Getopt-GUI-Long + CryptX + Data-HexDump Gtk2-Notify HTML-Table I18N-LangTags IO IPC-System-Simple Lab-Measurement - Log-TraceMessages - MusicBrainz-DiscID - Net-IRC Net-Ping + REST-Client SDL SOAP-WSDL + TAP-Parser-SourceHandler-pgTAP TeX-Encode Tie-Simple Time-Piece @@ -263,7 +263,6 @@ $version_mismatch{$_} = $simple_cleanup for qw< >; $version_mismatch{$_} = $simple_and_correct_suffixes for qw< - Gimp XML-Grove >; @@ -313,6 +312,56 @@ sub perl_version_c2g { return join '.', map int, @parts; } +=head2 C + +Get the numerical timestamp associated with the portage tree located at C<$portage>. +Requires L, and returns C if it is not available. + +=cut + +sub get_portage_timestamp { + my ($portage) = @_; + + { + local $@; + eval { require POSIX::strptime } or return; + } + + my $file = File::Spec->catfile($portage, 'metadata', 'timestamp.chk'); + return unless -e $file; + + my $timestamp = do { + open my $fh, '<', $file or return; + local $/; + <$fh>; + }; + s/^\s*//, s/\s*$// for $timestamp; + + my $shift = 0; + if ($timestamp =~ s/\s+([+-])([0-9]{2})([0-9]{2})$//) { + $shift = ($2 * 60 + $3) * 60; + $shift = -$shift if $1 eq '-'; + } + + my $old_lc_all = POSIX::setlocale(POSIX::LC_ALL()); + POSIX::setlocale(POSIX::LC_ALL(), 'C'); + $timestamp = POSIX::mktime( + POSIX::strptime($timestamp, '%a, %d %b %Y %H:%M:%S') + ); + POSIX::setlocale(POSIX::LC_ALL(), $old_lc_all); + $timestamp += $shift; + + return $timestamp; +} + +=head2 C + +Numerical timestamp associated with the revision of the portage tree that was used for generating the corrections to the natural cpan-to-gentoo mapping listed in this module. + +=cut + +sub TIMESTAMP () { 1367759701 } + =head1 SEE ALSO L. @@ -336,7 +385,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2009,2010,2011 Vincent Pit, all rights reserved. +Copyright 2009,2010,2011,2012 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. @@ -348,7 +397,6 @@ __DATA__ AcePerl Ace CGI-Simple Cgi-Simple CGI-SpeedyCGI SpeedyCGI -CPAN-Mini-Phalanx100 CPAN-Mini-Phalanx Cache-Mmap cache-mmap Class-Loader class-loader Class-ReturnValue class-returnvalue @@ -372,7 +420,6 @@ Digest-MD2 digest-md2 ExtUtils-Depends extutils-depends ExtUtils-PkgConfig extutils-pkgconfig Frontier-RPC frontier-rpc -Gimp gimp-perl Glib glib-perl Gnome2 gnome2-perl Gnome2-Canvas gnome2-canvas @@ -410,6 +457,7 @@ Pod-Parser PodParser Regexp-Common regexp-common Set-Scalar set-scalar String-CRC32 string-crc32 +Template-Plugin-Latex Template-Latex Text-Autoformat text-autoformat Text-Reform text-reform Text-Template text-template @@ -418,7 +466,6 @@ Tie-EncryptedHash tie-encryptedhash Time-Period Period Tk perl-tk Wx wxperl -XML-Sablotron XML-Sablot YAML yaml gettext Locale-gettext txt2html TextToHTML