Perl-Toolchain-Gang / CPAN-Common-Index

Common library for searching CPAN indexes
8 stars 10 forks source link

Allow any version requirement string for searching #11

Open dagolden opened 9 years ago

dagolden commented 9 years ago

The API should allow either a scalar version requirement string, not just a single version.

It's a breaking change unless single versions are prefixed with "=", but I'm not sure it's a bad breaking change anyway. Making index lookup function more like what CPAN clients expect is probably less surprising.

kentfredric commented 9 years ago

I'd possibly define such a search API that allows either returning one of the following:

This is obviously not so straight forward to do with all backends, but there's a lot of things that are possible if one ever adds a MetaCPAN::API backend.

Oldest criteria

Often when you have a larger project, you might need an extra dependency.

That dependency in turn, may itself, require a dependency of something newer than you already have.

Common behaviour at present is to simply update to the latest version, which can have a bunch of negative effects, importantly:

Hence, I consider it to be useful to perform a "minimal upgrade" to satisfy a dependency, instead of a maximal one.

However, no tools presently make doing that straight forward that I'm aware of.

Side note I don't know how to classify

There also needs to be some sort of way of saying:

needs X 0.5
needs Y 0.6

And having the system intelligently realise that X 0.7 and Y 0.7 are the same distrubition and offer you install choices respectively.

But also when it opts to install only X 0.5 and Y 0.6 which are Different distributions, offer the right install results that way too.

Reason: One common problem I'll see is cpanm installing something to satisfy one dependency , and then later having to downgrade the dependency it just installed in the same dependency tree.

( An example I hit regularly is simplified here: https://github.com/miyagawa/cpanminus/issues/388 )

But I have no idea where in the levels such a query should go.

dagolden commented 9 years ago

IIRC, my original search API thoughts were to return a high-to-low ordered list of distributions that match the search criteria. This would leave "oldest" or "newest" logic up to the consumer.