]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo/Maps.pm
Update gentooisms
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo / Maps.pm
index 957450dd6621206e832dde99186d5705b4223eae..774726b390ff46a2fb376b2a3832af5d608cc291 100644 (file)
@@ -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
 
@@ -313,6 +316,56 @@ sub perl_version_c2g {
  return join '.', map int, @parts;
 }
 
+=head2 C<get_portage_timestamp $portage>
+
+Get the numerical timestamp associated with the portage tree located at C<$portage>.
+Requires L<POSIX::strptime>, and returns C<undef> 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<TIMESTAMP>
+
+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 () { 1343034901 }
+
 =head1 SEE ALSO
 
 L<CPANPLUS::Dist::Gentoo>.
@@ -336,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.
 
@@ -348,7 +401,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 +424,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
@@ -419,7 +470,6 @@ Tie-EncryptedHash       tie-encryptedhash
 Time-Period             Period
 Tk                      perl-tk
 Wx                      wxperl
-XML-Sablotron           XML-Sablot
 YAML                    yaml
 gettext                 Locale-gettext
 txt2html                TextToHTML