opam icon indicating copy to clipboard operation
opam copied to clipboard

source cache shouldn't be indexed by the checksum only

Open Khady opened this issue 6 months ago • 1 comments

Once in a while we have a problem with opam not downloading the sources for a new version of a package. It's because during the creation of the opam file for the new version, the person does something like

cd opam/packages
mkdir -p pkgname.version2
cd pkgname.version2
opam show --raw pkgname.version1 > opam
emacs opam # replace the url in the `src` field, but DO NOT update the checkum

Then during opam install (after an opam update) we get

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved pkgname.version2  (cached)

And the new version2 is installed, but actually it's with the sources of version1.

The key for the cache could probably be based on the checksum of the tarball AND the url.

Khady avatar May 07 '25 07:05 Khady

Well spotted! Discussed in dev meeting: Indeed, opam should store and retrieve a cached archive regarding checksum and url. For the moment, as archives are stored by their checksum, when it is retrieved, the url is ignored. One solution would be to store somewhere the "checksum - urls" information when caching and on retrieval check it.

rjbou avatar May 13 '25 14:05 rjbou