metacpan-web icon indicating copy to clipboard operation
metacpan-web copied to clipboard

The 'perl' dist previous version history is a mess

Open ribasushi opened this issue 9 years ago • 4 comments

Compare the "Other releases" dropdown at http://search.cpan.org/~shay/perl-5.20.2/ To the one provided by metacpan here: https://metacpan.org/release/SHAY/perl-5.20.2

In addition to it being near impossible to find stuff (the RC markers are missing etc), the data at times is plain incorrect, e.g.:

...
<option value="/release/NWCLARK/perl-5.8.4/">
    5.008003
      (NWCLARK on 2004-04-21)   
</option>
...

As far as solutions go I think 'perl' is notable enough to be special cased by the display controller to display normalized sorted entries. CC-ing @rjbs for comments if any.

ribasushi avatar May 19 '15 10:05 ribasushi

For the 5.8.4 release, the tarball includes a META.yml listing the version as 5.008003. Using the filename rather than the META contents would be preferable in this case.

haarg avatar May 19 '15 13:05 haarg

Putting aside the question of bogus metadata, it would be helpful if we could sort the version browser by version number rather than by upload. I realize this is non-standard, but I would argue that the perl distribution warrants special casing. I would be happy to write a sort function, if it would help.

rjbs avatar Apr 18 '21 21:04 rjbs

It does seem reasonable to special case perl for this.

We also could probably do some more useful filtering. It would be good to have a separate page that listed every release of a dist, and then filter the list of versions in the header a bit more.

haarg avatar Apr 18 '21 22:04 haarg

I pulled all the version of Perl listed in the <select> in the HTML and wrote the code below. It's, uh, not my favorite code I've ever written, but it appears much closer to useful for version sorted.

my @sorted =
  map  {; $_->[0] }
  sort {; $b->[1] <=> $a->[1] # 5
       || $b->[2] <=> $a->[2] # 32
       || $b->[3] cmp $a->[3] # 000 (from 0, sprintf-ed)
       || $b->[3] cmp $a->[3] # RC2
       }
  map  {;
    my ($str, $suffix) = split /-/, $_, 2;

    my @parts = split /[._]/, $str;

    if (@parts == 2 && length $parts[1] > 2) {
      splice @parts, 1, 0, substr($parts[1], 0, 3);
      substr $parts[2], 0, 3, '';
    }

    if ($parts[2] =~ /\A([0-9]+)([^0-9].+)?\z/) {
      $parts[2] = sprintf "%03u%s", $1, $2 // '';
    }

    $parts[2] //= 0;
    $suffix   //= '';

    push @parts, $suffix;

    [ $_, @parts ]
  }
  @versions;

rjbs avatar Apr 19 '21 00:04 rjbs