Welcome! Please see the About page for a little more info on how this works.

0 votes
in tools.deps by

Currently user cache is customizable via CLJ_CACHE or CLJCONFIG (and XDG..) environment variables,
but inside project dir the path is set by the following code in clojure tools bash script:

`

Determine whether to use user or project cache

if [[ -f deps.edn ]]; then
cache_dir=.cpcache
else
cache_dir="$user_cache_dir"
fi
`

Which effectively makes impossible to run deps.edn project on write protected file system.
Current override is possible via renaming deps.edn and loading it via e.g. "-Sdeps $(cat xdeps.edn)",
with CLJ_CACHE env var, which in turn may create other chained problems, especially in quoting-sensitive environments like systemd.

Proposal: introduce optional environment variable for project cache destination like:

`

Determine whether to use user or project cache

if [[ -f deps.edn ]]; then

if [[ -n "$CLJ_PROJECT_CACHE" ]]; then
  cache_dir="$CLJ_PROJECT_CACHE"
elif [[ -n "$XDG_PROJECT_CACHE" ]]; then
  cache_dir="$XDG_PROJECT_CACHE"
else
  cache_dir=.cpcache
fi

else
cache_dir="$user_cache_dir"
fi
`

2 Answers

0 votes
by

Comment made by: juskrey

Sorry, can't find the repository source of that bash script anywhere, so not attaching a patch file.

0 votes
by
Reference: https://clojure.atlassian.net/browse/TDEPS-119 (reported by juskrey)
...