thaljef / Pinto

Curate your own repository of Perl modules
https://metacpan.org/module/Pinto::Manual
66 stars 49 forks source link

Feature request: ability to install older versions of a module #216

Open kablamo opened 8 years ago

kablamo commented 8 years ago

Lets say I add Foo-Bar-v0.01.tar.gz to Pinto and then Foo-Bar-v0.02.tar.gz to Pinto. It would be nice if I could get an older version from Pinto with a command like:

cpanm --mirror <url> --mirror-only Foo::Bar@0.01

Obviously CPAN supports this, but it doesn't seem like Pinto does. The tricky part is if multiple authors do releases. Not sure if there are some existing CPAN modules which might make it easy to add this feature.

kablamo commented 8 years ago

Some info on how cpanm does this here: http://cpanmetadb.plackperl.org/ which makes it sound like this would be hard and involved cuz we need to provide a rest api and a patch to cpanm.

Not sure if this module would be useful: https://metacpan.org/pod/CPAN::Common::Index

kablamo commented 8 years ago

Figured out I can do this which is pretty close to good enough:

cpanm --mirror <url> --mirror-only AUTHOR/Foo-Bar-0.01.tar.gz

I guess my only problem is AUTHOR is sometimes different because different people do releases. Which makes it hard to get the previous version.

thaljef commented 8 years ago

The primary goal of Pinto is to provide a CPAN index that always yields the same modules (unless you change it). So if you want to provide multiple versions of a module at the same time, then you would create multiple stacks.

But it sounds like you're just looking for a local CPAN mirror that you can install arbitrary modules from. If that's the case, then perhaps CPAN::Mini is the right solution for you.

melezhik commented 8 years ago

Hi Eric! pinto provides a conception of stacks which are cpan index snapshots, so module downgrade is achievable by adjusting index in a stack, I could not recall a certain pinto commands for this but this easily might be found at documentation.

So doing things in a pinto way you do not need point a cpan client with a explicit version of module like you did, but instead you setup a pinto stack with a right module version and then say

cpanm --mirror <url> --mirror-only Foo::Bar

Where an url should relate a proper pinto stack of course .

thaljef commented 8 years ago

There is also the install command, which is just a convenient wrapper around cpanm:

pinto -r <REPOSITORY> install --stack <STACK_NAME> Foo::Bar

But again, this assumes the Pinto model is right for you.