skaji/cpm

Fail to install a module when the same filename is present

Opened this issue · 5 comments

ferki commented

cpm fails when trying to install a module with a name matching a file name (or directory name) in the current directory:

FAIL install file:///path/to/project/lib

and the build.log complains about:

[...] Distribution does not have META.json nor META.yml

This for example happens when a project has both a lib directory and the lib module as a dependency, then trying to use e.g. dzil listdeps | cpm install - to install all dependencies. In that case dzil returns lib as a dependency and it conflicts with the lib directory.

Before #161 and #216, core dependencies should have been filtered out in one way or another before passing the dependency list to cpm, so that masked this behavior at least for my use cases. I tried dzil listdeps --omit-core and cpm install --target-perl, but that didn't seem to help.

I could also reproduce the same failure by trying to install any other module with a name that conflicts with a directory or file name in the current directory.

It looks like a real bug, but I wonder if I might have missed some of the available options that might help here? 🤔

skaji commented

For the meanwhile, you can try

dzil listdeps --omit-core=5.008001
ferki commented

For the meanwhile, you can try

dzil listdeps --omit-core=5.008001

Ah, thanks for the example! I did try dzil listdeps --omit-core=5.34.1, but that did not work. I confirm omitting with a different version format helps working around the core module problem with e.g. dzil listdeps --omit-core=5.034001.

Related to miyagawa/cpanminus#564

Thanks for the reference as well! I did not realize cpanm was affected by this naming conflict some time ago 🤔 It seems to be fixed in cpanm by now (using version 1.7044), though: cpanm lib finishes successfully with lib is up to date. (0.65).

skaji commented

If the lib is not a local directory, but a local file, then cpanm lib will fail.

ferki commented

Right, confirmed. Looks like I just got "lucky" with lib being the only conflict for my use cases, and it's a directory. Thank you, I learned something already!