Perl-Toolchain-Gang / CPAN-Meta

Specifications for CPAN distribution META files
36 stars 40 forks source link

Implied versioning not dropped when merging prereqs #140

Open bleargh45 opened 3 weeks ago

bleargh45 commented 3 weeks ago

As part of managing a large dependency tree at work, we have a need to merge multiple cpanfiles together into a single (large) dependency list.

For the most part, this works beautifully, but I have encountered one scenario which provides sub-optimal results...

... when merging 2x dependency lists together where the first has no explicit versioning provided (and so it just cares "do we have it installed at all?"), and the second has an explicit maximum version requirement.

Rather than getting a result similar to < 2.0, we instead get one of >= 0, < 2.0.

While I understand that syntactically this makes sense ("make sure it's installed, and make sure that it has a version number less than 2.0"), it also feels duplicative and wasteful (as the maximum version requirement already implies that the module is installed).

I have attached 2x scripts here to demonstrate this.

cpan-meta-prereqs-cpanfile.pl.txt ... a script which dumps out 2x temporary cpanfile files, and then loads/merges them together, outputting the resulting dependency tree.

cpan-meta-prereqs.pl.txt ... a lower-level script using just CPAN::Meta::Prereqs (instead of Module::CPANfile), which demonstrates same resulting dependency tree

Leont commented 2 weeks ago

This is a CPAN::Meta::Requirements issue, but yeah that is suboptimal.

bleargh45 commented 2 weeks ago

Ah-ha! Thank you!