X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo%2FMaps.pm;h=8c0b1001d845b0ba46b3de3ea4ae6d37b1367aa4;hb=a693bb0868d5a92f81d7da01b2f4f4d866ac13e4;hp=fd1cd8a1e6f0b3d4e7abe39d1fb56289872149c9;hpb=761b2973c70ba26f3442b701a2d4e8d28c083f11;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo/Maps.pm b/lib/CPANPLUS/Dist/Gentoo/Maps.pm index fd1cd8a..8c0b100 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 @@ -249,6 +252,7 @@ $version_mismatch{$_} = $simple_cleanup for qw< I18N-LangTags IO IPC-System-Simple + Lab-Measurement Log-TraceMessages MusicBrainz-DiscID Net-IRC @@ -312,6 +316,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 () { 1339737301 } + =head1 SEE ALSO L. @@ -335,7 +389,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. @@ -409,6 +463,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