-
Notifications
You must be signed in to change notification settings - Fork 710
Per-Version Index Cache in ~/.cabal directory #7502
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
Comments
No counterindication, as far as I can see. |
That would be an welcome change, specially when developing for cabal, since there are usually multiple cabals involved in the whole compile/run thingy. |
This was discussed and it is not trivial. The Please outline how you would prevent cache corruption. |
Good point about cabal update! Does it do a full rewrite of the index cache file or is it an in-place update? |
The obvious thing to do is to just have |
I think this issue is important to fix, because having several versions of |
I think that a suitable invalidation strategy is that if the This check if helpfully already implemented in
Situation 2 shouldn't happen anymore (unless you are developing cabal-install) since there will be a per-version cache, each cabal-install will Then to consider backwards compatibility.
When the new cabal-install runs To summarise:
|
cabal-install will now use a version suffixed cache file for the index state. If you are regularly changing between cabal-install versions, this will be less annoying as you won't have to regenerate the cache each time you switch project. There is one tricky part of the implementation. If you update the index with a newer cabal-install, then the old-style cabal-install caches are invalidated by replacing them with an empty file. This is because in cabal-install (until this commit), the freshness of the cache was now checked by `readIndexCache`. If you update with an older `cabal-install` then the freshness check will see the cache for your new cabal-install is older than the index, and update it. Fixes #7502
cabal-install will now use a version suffixed cache file for the index state. If you are regularly changing between cabal-install versions, this will be less annoying as you won't have to regenerate the cache each time you switch project. There is one tricky part of the implementation. If you update the index with a newer cabal-install, then the old-style cabal-install caches are invalidated by replacing them with an empty file. This is because in cabal-install (until this commit), the freshness of the cache was now checked by `readIndexCache`. If you update with an older `cabal-install` then the freshness check will see the cache for your new cabal-install is older than the index, and update it. Fixes #7502
Switching between cabal install versions can occur either when developing cabal, or when using nix-shells that bring different versions into scope, among other reasons.
Each time you switch versions, you get
Warning: Parsing the index cache failed
and it needs to regenerate the index cache.This can be tedious and time consuming.
I suggest that cabal store its index cache per-cabal-version rather than always in the same spot, thus helping to more frequently avoid this issue.
The text was updated successfully, but these errors were encountered: