From: Vincent Pit Date: Sat, 29 Nov 2008 19:30:20 +0000 (+0100) Subject: Better perl -> ebuild version conversion X-Git-Tag: v0.03~2 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=2da3a2ee3000a7d24d7e112ea569dbed18d0d8cb;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Better perl -> ebuild version conversion --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 6c47c6e..196683b 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -125,9 +125,15 @@ sub prepare { $stat->dist($name . '-' . $version); - my $f = 1; - $version =~ s/_+/$f ? do { $f = 0; '_p' } : ''/ge; - 1 while $version =~ s/(_p[^.]*)\.+/$1/; + $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_name($gentooism{$name} || $name);