Browse files

Fix bug where dev versions were not nixed.

Copies over code from my newer package generator. Dev versions are
a crappy idea and dont translate into pacman world.
  • Loading branch information...
1 parent e550017 commit 138f652e2267c0a14adf6cf6a3932dcee45200ff @juster committed May 31, 2012
Showing with 31 additions and 14 deletions.
  1. +19 −0 Changes
  2. +7 −10 lib/CPANPLUS/Dist/Arch.pm
  3. +5 −4 t/01-translate.t
View
19 Changes
@@ -6,6 +6,25 @@
: \____|_| |_|\__,_|_| |_|\__, |\___||___/
: |___/
+* Release 1.21 [2012-05-31 Thu]
+
+** Developer versions nuked to hell. :BUGFIX:
+
+Developer versions on CPAN have a trailing underscore and numeric
+portion (eg 1.2.3_4). These are a largely misunderstood nuisance
+which require special logic on the part of perl/CPAN to compare versions.
+A dev ver drops the trailing number if compared against a non-dev ver
+string. So 1.2.3_4 == 1.2.3 but 1.2.3_4 < 1.2.3_5.
+
+Previously I tried to preserve them but because pacman mercifully
+has no special logic to compare them with non-developer version
+strings I decided to just remove them entirely from pkgvers.
+
+Long story short... 1.2.3_4 is not equivalent to 1.2.3.4 so why
+even try to make it so.
+
+Reported by Florian Pritz (Bluewind)
+
* Release 1.20 [2012-04-29 Sun]
** Be more careful removing duplicate makedepends/depends. :BUGFIX:
View
17 lib/CPANPLUS/Dist/Arch.pm
@@ -570,21 +570,18 @@ sub dist_pkgname
sub dist_pkgver
{
- croak "Must provide arguments to pacman_version" if ( @_ == 0 );
my ($version) = @_;
- # Package versions should be numbers and decimal points only...
- $version =~ tr/-/./;
- $version =~ tr/_0-9.-//cd;
+ # Remove developer versions because pacman has no special logic
+ # to handle comparing them to regular versions such as perl uses.
+ $version =~ s/_[^_]+\z//;
- # Developer packages have a ..._## at the end though...
- unless (( $version =~ tr/_/_/ == 1 ) && ( $version =~ /\d_\d+$/ )) {
- $version =~ tr/_//d; # Delete underscores otherwise.
- }
+ # Package versions should be numbers and decimal points only...
+ $version =~ tr/-_/../;
+ $version =~ tr/0-9.//cd;
$version =~ tr/././s;
- $version =~ s/[.]$//;
- $version =~ s/^[.]//;
+ $version =~ s/^[.]|[.]$//g;
return $version;
}
View
9 t/01-translate.t
@@ -55,12 +55,13 @@ for my $cpan_name ( keys %pkgname_of ) {
my %pkgver_of =
( '1234-5678' => '1234.5678',
- '!1_@23-45' => '123.45',
+ # Everything after the last underscore is removed.
+ '!1_@23-45' => '1',
'98 65 AB.2' => '9865.2',
- '1~!@#$%^&*() _ 2+= - 3\][{}|;":, . 4/?><' => '12.3.4',
+ '1~!@#$%^&*() 2+= - 3\][{}|;":,_ . 4/?><' => '12.3',
'1234-ABCDE.fghi' => '1234',
- '1.14_02' => '1.14_02',
- '12ABCD_ABCD1' => '12_1',
+ '1.14_02' => '1.14',
+ '12ABCD_ABCD1' => '12',
'10.01.07.b610f5f' => '10.01.07.6105', # real!
);

0 comments on commit 138f652

Please sign in to comment.