use File::Spec::Functions qw/catdir catfile/;
use IPC::Cmd qw/run can_run/;
-use version;
use CPANPLUS::Error;
=head1 VERSION
-Version 0.05
+Version 0.07
=cut
-our $VERSION = '0.05';
+our $VERSION = '0.07';
=head1 SYNOPSIS
}
if (IPC::Cmd->can_capture_buffer) {
- my ($success, $errmsg, $output) = run command => [ qw/emerge --info/ ],
- verbose => 0;
+ my $buffers;
+ my ($success, $errmsg) = run command => [ qw/emerge --info/ ],
+ verbose => 0,
+ buffer => \$buffers;
if ($success) {
- for (@{$output || []}) {
- if (/^PORTDIR_OVERLAY=(.*)$/m) {
- $overlays = [ map abs_path($_), split ' ', _unquote($1) ];
- }
- if (/^ACCEPT_KEYWORDS=(.*)$/m) {
- $default_keywords = [ split ' ', _unquote($1) ];
- }
- if (/^DISTDIR=(.*)$/m) {
- $default_distdir = abs_path(_unquote($1));
- }
- if (/^PORTDIR=(.*)$/m) {
- $main_portdir = abs_path(_unquote($1));
- }
+ if ($buffers =~ /^PORTDIR_OVERLAY=(.*)$/m) {
+ $overlays = [ map abs_path($_), split ' ', _unquote($1) ];
+ }
+ if ($buffers =~ /^ACCEPT_KEYWORDS=(.*)$/m) {
+ $default_keywords = [ split ' ', _unquote($1) ];
+ }
+ if ($buffers =~ /^DISTDIR=(.*)$/m) {
+ $default_distdir = abs_path(_unquote($1));
+ }
+ if ($buffers =~ /^PORTDIR=(.*)$/m) {
+ $main_portdir = abs_path(_unquote($1));
}
} else {
error $errmsg;
$stat->distribution($name . '-' . $version);
- $version =~ s/[^\d._]+//g;
- $version =~ s/^[._]*//;
- $version =~ s/[._]*$//;
- $version =~ s/[._]*_[._]*/_/g;
- {
- ($version, my $patch, my @rest) = split /_/, $version;
- $version .= '_p' . $patch if defined $patch;
- $version .= join('.', '', @rest) if @rest;
- }
- $stat->eb_version($version);
+ $stat->eb_version(CPANPLUS::Dist::Gentoo::Maps::version_c2g($version));
$stat->eb_name(CPANPLUS::Dist::Gentoo::Maps::name_c2g($name));
$name = CPANPLUS::Dist::Gentoo::Maps::name_c2g($name);
my $ver;
- $ver = eval { version->new($version) } if defined $version;
+ $ver = CPANPLUS::Dist::Gentoo::Maps::version_c2g($version) if defined $version;
my @portdirs = ($main_portdir, @{$self->status->portdir_overlay});
if (defined $ver) { # implies that $version is defined
for (@ebuilds) {
- next unless /\Q$atom\E-v?([\d._]+).*?\.ebuild$/;
- my $eb_ver = eval { version->new($1) };
- next unless defined $eb_ver and $eb_ver >= $ver;
- return ">=$category/$atom-$version";
+ my ($eb_ver) = /\Q$atom\E-v?([\d._pr-]+).*?\.ebuild$/;
+ return ">=$category/$atom-$ver"
+ if defined $eb_ver
+ and CPANPLUS::Dist::Gentoo::Maps::version_gcmp($eb_ver, $ver) > 0;
}
} else {
return "$category/$atom";
unless ($success) {
error "$errmsg -- aborting";
- if (not $verbose and defined $output and $self->status->verbose) {
+ if (not $verbose and defined $output and $stat->verbose) {
my $msg = join '', @$output;
1 while chomp $msg;
error $msg;
Gentoo (L<http://gentoo.org>).
-L<CPANPLUS>, L<IPC::Cmd> (core modules since 5.9.5), L<version> (since 5.009).
+L<CPANPLUS>, L<IPC::Cmd> (core modules since 5.9.5).
-L<Cwd> (since perl 5) L<File::Path> (5.001), L<File::Copy> (5.002), L<File::Spec::Functions> (5.00504).
+L<Cwd>, L<Carp> (since perl 5), L<File::Path> (5.001), L<File::Copy> (5.002), L<File::Spec::Functions> (5.00504).
=head1 SEE ALSO