Skip to content
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

Cache is not pointing to existing one #49

Closed
cderv opened this issue Apr 6, 2019 · 4 comments
Closed

Cache is not pointing to existing one #49

cderv opened this issue Apr 6, 2019 · 4 comments

Comments

@cderv
Copy link
Contributor

cderv commented Apr 6, 2019

Don't know if it is a side effect of #46 but currently the cache is not the same

packageVersion("renv")
#> [1] '0.2.0.68'
renv:::renv_paths_cache()
#> [1] "C:\\Users\\chris\\AppData\\Local/renv/cache/R-3.5/v2"
renv:::renv_cache_list()
#> character(0)
library(magrittr)
fs::dir_ls(renv:::renv_paths_common(""))  %>%
  fs::dir_ls()
#> C:/Users/chris/AppData/Local/renv/R-3.5/binary
#> C:/Users/chris/AppData/Local/renv/R-3.5/bootstrap
#> C:/Users/chris/AppData/Local/renv/R-3.5/cache
#> C:/Users/chris/AppData/Local/renv/R-3.5/repos
#> C:/Users/chris/AppData/Local/renv/source/rcmdcheck
#> C:/Users/chris/AppData/Local/renv/source/remotes
#> C:/Users/chris/AppData/Local/renv/source/renv
#> C:/Users/chris/AppData/Local/renv/source/skeleton

Created on 2019-04-06 by the reprex package (v0.2.1.9000)

As you see above renv:::renv_paths_cache() path does not exist. I have renv/R-3.5 and renv/source and not renv/cache

Something has changed I guess...

@cderv
Copy link
Contributor Author

cderv commented Apr 6, 2019

After using further the new version of renv and installing new package with renv::install, I have now a renv/cache and other at root directory (binary, and repos)

packageVersion("renv")
#> [1] '0.2.0.68'
renv:::renv_paths_cache()
#> [1] "C:\\Users\\chris\\AppData\\Local/renv/cache/R-3.5/v2"
renv:::renv_cache_list()
#> [1] "C:\\Users\\chris\\AppData\\Local/renv/cache/R-3.5/v2/brew/1.0-6/83a95e35c28b386681e1a05f29fae496/brew/DESCRIPTION"             
#> [2] "C:\\Users\\chris\\AppData\\Local/renv/cache/R-3.5/v2/data.table/1.12.0/6756128aea115cf6aa17db1eab6c51d9/data.table/DESCRIPTION"
library(magrittr)
fs::dir_ls(renv:::renv_paths_common(""))
#> C:/Users/chris/AppData/Local/renv/binary
#> C:/Users/chris/AppData/Local/renv/cache
#> C:/Users/chris/AppData/Local/renv/R-3.5
#> C:/Users/chris/AppData/Local/renv/repos
#> C:/Users/chris/AppData/Local/renv/source

Created on 2019-04-06 by the reprex package (v0.2.1.9000)

I believe the old one is not useful anymore ?

@kevinushey
Copy link
Collaborator

Thanks -- this wasn't intentional and should be fixed up now.

> packageVersion("renv")
[1] ‘0.2.0.69> renv_paths_cache()
[1] "~/Library/Application Support/renv/R-3.5/cache/v2"
> Sys.setenv(RENV_PATHS_CACHE = "~/.renv-cache")
> renv_paths_cache()
[1] "~/.renv-cache/R-3.5/v2"

Note that the path format is slightly different when using an environment variable. This is just so that you can reuse the same cache variable across multiple versions of R. Does that make sense? Or should we just use the same path format in each case?

@cderv
Copy link
Contributor Author

cderv commented Apr 6, 2019

It make great sense to be able to reuse a cache environment variable across version. This path make sense "~/.renv-cache/R-3.5/v2" but we would expect the usual path to be "~/Library/Application Support/renv/cache/R-3.5/v2". 🤔

Currently We will have two different directory trees depending of use of environment variable or not...

  • renv_path_root/R_version/cache_name/cache_ver
  • renv_path_cache/R_version/cache_ver

Reading about env var I would have thought
RENV_PATH_CACHE ↔️ RENV_PATH_ROOT/CACHE_NAME

Is only cache directory sensitive to R version or also boostrap, repos and binary as it seems to be intended now ?

@kevinushey
Copy link
Collaborator

I've made a change to ensure the path suffix is consistent:

> renv_paths_cache()
[1] "~/Library/Application Support/renv/cache/R-3.5/v2"

> Sys.setenv(RENV_PATHS_CACHE = tempfile("renv-cache-"))
> renv_paths_cache()
[1] "/var/folders/qt/txb728ms5012wp_4yn369wth0000gn/T//RtmpVH36He/renv-cache-66933cb1f745/R-3.5/v2"

This does invalidate the old cache so old projects will need to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants