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

Installing dual-life modules from cpanfile #141

Closed
barefootcoder opened this issue Nov 16, 2018 · 3 comments
Closed

Installing dual-life modules from cpanfile #141

barefootcoder opened this issue Nov 16, 2018 · 3 comments

Comments

@barefootcoder
Copy link

I'm closing in on the end of our custom DarkPAN solution using cpm (which I talked about in #138). I know this is not exactly what you designed cpm to do, but it really is almost perfect for how I'm using it. There's just one last niggling detail. :-)

This is a very similar problem to #140, actually. I'm not worried about proper core modules so much as the "dual-life" ones. So here's the issue:

  • In my cpanfile, I don't put exact version numbers for (most) modules. Exact version numbers go in my
  • cpanfile.snapshot, which of course has exact version numbers for everything. I use --resolver snapshot to tell cpm to use the snapshot file to figure out the proper version number. This works great as long as the module is not installed.
  • However, when the module is installed, then we have a problem. Because App::cpm::Master::is_installed is called after the cpanfile is read, but before the snapshot is read. Therefore, the module has a version_range of 0 (i.e. not specified), and there is a version installed, and that's deemed good enough.
  • Of course, if the snapshot file were to be consulted, it would say the version is insufficient. :-(

I can get around the worst problems here by using the (undocumented) --exclude-vendor switch; that at least limits the real problems to the dual-life modules. But App::Prove is an excellent example: it was made core in 5.10.1, but I can easily install an upgraded version if I like (and I do like). And I can put the desired version in my snapshot. But that doesn't matter to cpm because it never checks the snapshot, because by the time the snapshot comes around it's already decided it needn't bother.

Note that it's only when using the cpanfile that I have this problem. If I just tell cpm to install App::Prove directly, it goes ahead and installs the latest version.

I might be able to fix this in a hacky way by excluding $Config{privlibexp} in App::cpm::CLI::_inc (the same place where --exclude-vendor is implemented); obviously trying to exclude $Config{archlibexp} is just going to get me in trouble by trying to install things which are only available by installing perl itself. And, hell: privlibexp might have some of that too. But it might be worth a try if there doesn't seem to be any other option. But I'm soooo close here that I thought I'd run it by you and see if you had any thoughts on how to address this issue.

As always, thanks so much for cpm. It really is changing the way I install Perl modules.

@barefootcoder
Copy link
Author

Were there any thoughts on this? I do think that having something like this would go a long way towards making cpm the perfect solution for private CPAN/DarkPAN solutions. I'm also wondering if cpanm would do this if using its --self-contained switch ... I suspect it would, since (as I mentioned above) doing cpm App::Prove does install the updated version. It's just not picking up from the snapshot that it needs an update.

@skaji
Copy link
Owner

skaji commented Dec 10, 2018

Do you use the same perl binary as you used to create snapshots?

@barefootcoder
Copy link
Author

Reviewing my open tickets here, I can see that this issue is just a subset of #198. So I think having that one open is sufficient; I'm closing this one.

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

No branches or pull requests

2 participants