-
Notifications
You must be signed in to change notification settings - Fork 429
Toolchain cache: use DUNE_CACHE_ROOT instead of XDG_CACHE_HOME #11612
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ambre Austen Suhamy <[email protected]>
Signed-off-by: Ambre Austen Suhamy <[email protected]>
@@ -21,7 +21,7 @@ val is_compiler_and_toolchains_enabled : Package.Name.t -> bool | |||
|
|||
(** Returns the path to the directory containing the given package within the | |||
toolchain directory. This will be something like | |||
$XDG_CACHE_DIR/dune/toolchains/ocaml-base-compiler.5.2.1.XXXXXXXX where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this was a typo, it's XDG_CACHE_HOME
, not DIR
(Path.of_string (Xdg.cache_dir (Lazy.force Dune_util.xdg))) | ||
[ "dune"; "git-repo" ] | ||
in | ||
let dir = Path.L.relative Dune_cache_storage.Layout.root_dir [ "dune"; "git-repo" ] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Dune_cache_storage.Layout.root_dir
return the contents of $XDG_CACHE_HOME
(or similar) if $DUNE_CACHE_ROOT
is not set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it calls Xdg.cache_dir
which is set from the env var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not adding one layer of dune
too much? I would expect it to return ~/.cache/dune
if the directory was not set thus it would be ~/.cache/dune/dune/git-repo
in the case where DUNE_CACHE_ROOT
is not set.
Fixes #11584 and should ease the pain of #11585.
The cache is set up to be at
$DUNE_CACHE_ROOT
, which itself will default on$XDG_CACHE_HOME
if not present. Two places skipped one step and use the XDG directly: the toolchain cache and the rev-store cache. This PR fixes both of these.