opam icon indicating copy to clipboard operation
opam copied to clipboard

Add an environment variable to relocate the download-cache folder

Open mtelvers opened this issue 1 year ago • 0 comments

It would be very helpful if an environment variable could be used to configure the location of the $OPAMROOT/download-cache. Currently, download-cache is hardcoded.

https://github.com/ocaml/opam/blob/d5d6dddc40d9baad9c6e774074a97820ffbc4851/src/repository/opamRepositoryPath.ml#L18

In obuilder, we persist the opam cache between jobs by mounting a file system on the download-cache location. This works well under Linux/FreeBSD/macOS, but under Windows mounting is more problematic. Windows provides the mountvol command to do this. mountvol requires an empty directory where we typically don't have one; it also requires the volume to be specified in the \\?\Volume{guid} format, which is an additional overhead to calculate. It would be great to be able to have an environment variable like OPAMDOWNLOADCACHE=d:\download-cache.

mtelvers avatar Oct 17 '24 09:10 mtelvers