Skip to content

Can't enable prebuild using file URL #220

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

Open
miyagawa opened this issue May 12, 2022 · 3 comments
Open

Can't enable prebuild using file URL #220

miyagawa opened this issue May 12, 2022 · 3 comments

Comments

@miyagawa
Copy link

I'm experimenting some combinations of using Carmel and cpm in development and production environments.

The goal is to manage the dependencies and snapshot with Carmel, then package the vendor/cache directory to install them with cpm on CI. To replicate what I would get on the CI, I'd like to install the modules the same way using cpm in development as well:

> cpm install -L /path/to/local --resolver 02packages,file://$PWD/vendor/cache --prebuilt

this is not as fast as I want with 200+ deps, because apparently prebuilt is not enabled when the mirror URL is file://. I needed to patch Installer.pm to allow the file:/// URL to force enable the build cache.

Can there be an option to enable this per URL basis, or rather, trust it if the URL is given as a CLI argument?

@skaji
Copy link
Owner

skaji commented May 12, 2022

Currently I restrict cpm from using prebuilds if the mirror is not CPAN

!!( $uri =~ m{^https?://(?:www.cpan.org|backpan.perl.org|cpan.metacpan.org)} );

I think we should keep this by default,
but yeah, we need an option to tell cpm "this mirror is CPAN".

One thing I'm worried about is that
cpanfile allows users to specify dist/url for modules, and in that case, vender/cache will contain modules not only from CPAN but also from some custom mirrors.
This might be not a real problem right now,
but in the future, we need to determine how to cache modules from custom mirrors, I think.

@miyagawa
Copy link
Author

miyagawa commented May 13, 2022

Yep, that's the line I patched and returned 1 if the given URL starts with a file://.

i think ultimately the build cache needs to record where the tarball came from, whether it was CPAN or not. And might be some metadata of integrity, like SHA sum of the tarball. Then if the 02packages contained the sha sum of the tarball (needs an upgrade of the format) you're sure that the build cache was generated using the same archive.

Building and bundling vendor/cache to installs modules solely from the vendor cache is a common technique I recommend in Carmel and Carton, and would be great to be able to speed this up with build caches (i.e. with GitHub actions).

@skaji
Copy link
Owner

skaji commented May 13, 2022

i think ultimately the build cache needs to record where the tarball came from, whether it was CPAN or not. And might be some metadata of integrity, like SHA sum of the tarball. Then if the 02packages contained the sha sum of the tarball (needs an upgrade of the format) you're sure that the build cache was generated using the same archive.

Completely agreed!

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