Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 'perl' dist previous version history is a mess #1527

Open
ribasushi opened this issue May 19, 2015 · 4 comments
Open

The 'perl' dist previous version history is a mess #1527

ribasushi opened this issue May 19, 2015 · 4 comments

Comments

@ribasushi
Copy link

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.

@haarg
Copy link
Member

haarg commented May 19, 2015

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.

@rjbs
Copy link
Contributor

rjbs commented Apr 18, 2021

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.

@haarg
Copy link
Member

haarg commented Apr 18, 2021

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.

@rjbs
Copy link
Contributor

rjbs commented Apr 19, 2021

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants